path
stringlengths 5
304
| repo_name
stringlengths 6
79
| content
stringlengths 27
1.05M
|
---|---|---|
src/client/components/common/asyncComponent.js | uuchat/uuchat | import React from 'react';
export default (loader, collection) => (
class AsyncComponent extends React.Component {
constructor(props) {
super(props);
this.Component = null;
this.state = { Component: AsyncComponent.Component };
}
componentDidMount() {
if (!this.state.Component) {
loader().then((Component) => {
AsyncComponent.Component = Component;
this.setState({ Component });
});
}
}
render() {
if (this.state.Component) {
return (<this.state.Component { ...this.props } { ...collection } />);
} else {
return (<div className="chat-loading"><div className="uu-logo">Power by uuchat.io</div><div className="bounce bounce1"></div><div className="bounce bounce2"></div><div className="bounce bounce3"></div></div>);
}
}
}
); |
client/components/App/index.js | phytertek/mern-community | import React from 'react'
import { NavigationBar } from '../'
import FontIcon from 'material-ui/FontIcon';
import {BottomNavigation, BottomNavigationItem} from 'material-ui/BottomNavigation';
import IconLocationOn from 'material-ui/svg-icons/communication/location-on';
const style = {
fontFamily: 'Roboto, sans-serif'
}
const recentsIcon = <FontIcon className="material-icons">restore</FontIcon>;
const favoritesIcon = <FontIcon className="material-icons">favorite</FontIcon>;
const nearbyIcon = <IconLocationOn />;
const App = React.createClass({
render() {
return(
<div style={style}>
<NavigationBar />
{this.props.children}
</div>
)
}
})
export default App |
ajax/libs/video.js/5.0.0-rc.76/video.novtt.js | vetruvet/cdnjs | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
(function (global){
var topLevel = typeof global !== 'undefined' ? global :
typeof window !== 'undefined' ? window : {}
var minDoc = _dereq_('min-document');
if (typeof document !== 'undefined') {
module.exports = document;
} else {
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}
module.exports = doccy;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9nbG9iYWwvZG9jdW1lbnQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgdG9wTGV2ZWwgPSB0eXBlb2YgZ2xvYmFsICE9PSAndW5kZWZpbmVkJyA/IGdsb2JhbCA6XG4gICAgdHlwZW9mIHdpbmRvdyAhPT0gJ3VuZGVmaW5lZCcgPyB3aW5kb3cgOiB7fVxudmFyIG1pbkRvYyA9IHJlcXVpcmUoJ21pbi1kb2N1bWVudCcpO1xuXG5pZiAodHlwZW9mIGRvY3VtZW50ICE9PSAndW5kZWZpbmVkJykge1xuICAgIG1vZHVsZS5leHBvcnRzID0gZG9jdW1lbnQ7XG59IGVsc2Uge1xuICAgIHZhciBkb2NjeSA9IHRvcExldmVsWydfX0dMT0JBTF9ET0NVTUVOVF9DQUNIRUA0J107XG5cbiAgICBpZiAoIWRvY2N5KSB7XG4gICAgICAgIGRvY2N5ID0gdG9wTGV2ZWxbJ19fR0xPQkFMX0RPQ1VNRU5UX0NBQ0hFQDQnXSA9IG1pbkRvYztcbiAgICB9XG5cbiAgICBtb2R1bGUuZXhwb3J0cyA9IGRvY2N5O1xufVxuIl19
},{"min-document":3}],2:[function(_dereq_,module,exports){
(function (global){
if (typeof window !== "undefined") {
module.exports = window;
} else if (typeof global !== "undefined") {
module.exports = global;
} else if (typeof self !== "undefined"){
module.exports = self;
} else {
module.exports = {};
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9nbG9iYWwvd2luZG93LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiaWYgKHR5cGVvZiB3aW5kb3cgIT09IFwidW5kZWZpbmVkXCIpIHtcbiAgICBtb2R1bGUuZXhwb3J0cyA9IHdpbmRvdztcbn0gZWxzZSBpZiAodHlwZW9mIGdsb2JhbCAhPT0gXCJ1bmRlZmluZWRcIikge1xuICAgIG1vZHVsZS5leHBvcnRzID0gZ2xvYmFsO1xufSBlbHNlIGlmICh0eXBlb2Ygc2VsZiAhPT0gXCJ1bmRlZmluZWRcIil7XG4gICAgbW9kdWxlLmV4cG9ydHMgPSBzZWxmO1xufSBlbHNlIHtcbiAgICBtb2R1bGUuZXhwb3J0cyA9IHt9O1xufVxuIl19
},{}],3:[function(_dereq_,module,exports){
},{}],4:[function(_dereq_,module,exports){
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Native method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates a function that invokes `func` with the `this` binding of the
* created function and arguments from `start` and beyond provided as an array.
*
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.restParam(function(what, names) {
* return what + ' ' + _.initial(names).join(', ') +
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
* });
*
* say('hello', 'fred', 'barney', 'pebbles');
* // => 'hello fred, barney, & pebbles'
*/
function restParam(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
rest = Array(length);
while (++index < length) {
rest[index] = args[start + index];
}
switch (start) {
case 0: return func.call(this, rest);
case 1: return func.call(this, args[0], rest);
case 2: return func.call(this, args[0], args[1], rest);
}
var otherArgs = Array(start + 1);
index = -1;
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = rest;
return func.apply(this, otherArgs);
};
}
module.exports = restParam;
},{}],5:[function(_dereq_,module,exports){
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function arrayCopy(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
module.exports = arrayCopy;
},{}],6:[function(_dereq_,module,exports){
/**
* A specialized version of `_.forEach` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEach;
},{}],7:[function(_dereq_,module,exports){
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property names to copy.
* @param {Object} [object={}] The object to copy properties to.
* @returns {Object} Returns `object`.
*/
function baseCopy(source, props, object) {
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
object[key] = source[key];
}
return object;
}
module.exports = baseCopy;
},{}],8:[function(_dereq_,module,exports){
var createBaseFor = _dereq_('./createBaseFor');
/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
* over `object` properties returned by `keysFunc` invoking `iteratee` for
* each property. Iteratee functions may exit iteration early by explicitly
* returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
module.exports = baseFor;
},{"./createBaseFor":15}],9:[function(_dereq_,module,exports){
var baseFor = _dereq_('./baseFor'),
keysIn = _dereq_('../object/keysIn');
/**
* The base implementation of `_.forIn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForIn(object, iteratee) {
return baseFor(object, iteratee, keysIn);
}
module.exports = baseForIn;
},{"../object/keysIn":36,"./baseFor":8}],10:[function(_dereq_,module,exports){
var arrayEach = _dereq_('./arrayEach'),
baseMergeDeep = _dereq_('./baseMergeDeep'),
isArray = _dereq_('../lang/isArray'),
isArrayLike = _dereq_('./isArrayLike'),
isObject = _dereq_('../lang/isObject'),
isObjectLike = _dereq_('./isObjectLike'),
isTypedArray = _dereq_('../lang/isTypedArray'),
keys = _dereq_('../object/keys');
/**
* The base implementation of `_.merge` without support for argument juggling,
* multiple sources, and `this` binding `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {Function} [customizer] The function to customize merged values.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates values with source counterparts.
* @returns {Object} Returns `object`.
*/
function baseMerge(object, source, customizer, stackA, stackB) {
if (!isObject(object)) {
return object;
}
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
props = isSrcArr ? undefined : keys(source);
arrayEach(props || source, function(srcValue, key) {
if (props) {
key = srcValue;
srcValue = source[key];
}
if (isObjectLike(srcValue)) {
stackA || (stackA = []);
stackB || (stackB = []);
baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
}
else {
var value = object[key],
result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
isCommon = result === undefined;
if (isCommon) {
result = srcValue;
}
if ((result !== undefined || (isSrcArr && !(key in object))) &&
(isCommon || (result === result ? (result !== value) : (value === value)))) {
object[key] = result;
}
}
});
return object;
}
module.exports = baseMerge;
},{"../lang/isArray":27,"../lang/isObject":30,"../lang/isTypedArray":33,"../object/keys":35,"./arrayEach":6,"./baseMergeDeep":11,"./isArrayLike":18,"./isObjectLike":23}],11:[function(_dereq_,module,exports){
var arrayCopy = _dereq_('./arrayCopy'),
isArguments = _dereq_('../lang/isArguments'),
isArray = _dereq_('../lang/isArray'),
isArrayLike = _dereq_('./isArrayLike'),
isPlainObject = _dereq_('../lang/isPlainObject'),
isTypedArray = _dereq_('../lang/isTypedArray'),
toPlainObject = _dereq_('../lang/toPlainObject');
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize merged values.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates values with source counterparts.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
var length = stackA.length,
srcValue = source[key];
while (length--) {
if (stackA[length] == srcValue) {
object[key] = stackB[length];
return;
}
}
var value = object[key],
result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
isCommon = result === undefined;
if (isCommon) {
result = srcValue;
if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
result = isArray(value)
? value
: (isArrayLike(value) ? arrayCopy(value) : []);
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
result = isArguments(value)
? toPlainObject(value)
: (isPlainObject(value) ? value : {});
}
else {
isCommon = false;
}
}
// Add the source value to the stack of traversed objects and associate
// it with its merged value.
stackA.push(srcValue);
stackB.push(result);
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
} else if (result === result ? (result !== value) : (value === value)) {
object[key] = result;
}
}
module.exports = baseMergeDeep;
},{"../lang/isArguments":26,"../lang/isArray":27,"../lang/isPlainObject":31,"../lang/isTypedArray":33,"../lang/toPlainObject":34,"./arrayCopy":5,"./isArrayLike":18}],12:[function(_dereq_,module,exports){
var toObject = _dereq_('./toObject');
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : toObject(object)[key];
};
}
module.exports = baseProperty;
},{"./toObject":25}],13:[function(_dereq_,module,exports){
var identity = _dereq_('../utility/identity');
/**
* A specialized version of `baseCallback` which only supports `this` binding
* and specifying the number of arguments to provide to `func`.
*
* @private
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function bindCallback(func, thisArg, argCount) {
if (typeof func != 'function') {
return identity;
}
if (thisArg === undefined) {
return func;
}
switch (argCount) {
case 1: return function(value) {
return func.call(thisArg, value);
};
case 3: return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(thisArg, accumulator, value, index, collection);
};
case 5: return function(value, other, key, object, source) {
return func.call(thisArg, value, other, key, object, source);
};
}
return function() {
return func.apply(thisArg, arguments);
};
}
module.exports = bindCallback;
},{"../utility/identity":39}],14:[function(_dereq_,module,exports){
var bindCallback = _dereq_('./bindCallback'),
isIterateeCall = _dereq_('./isIterateeCall'),
restParam = _dereq_('../function/restParam');
/**
* Creates a `_.assign`, `_.defaults`, or `_.merge` function.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return restParam(function(object, sources) {
var index = -1,
length = object == null ? 0 : sources.length,
customizer = length > 2 ? sources[length - 2] : undefined,
guard = length > 2 ? sources[2] : undefined,
thisArg = length > 1 ? sources[length - 1] : undefined;
if (typeof customizer == 'function') {
customizer = bindCallback(customizer, thisArg, 5);
length -= 2;
} else {
customizer = typeof thisArg == 'function' ? thisArg : undefined;
length -= (customizer ? 1 : 0);
}
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, customizer);
}
}
return object;
});
}
module.exports = createAssigner;
},{"../function/restParam":4,"./bindCallback":13,"./isIterateeCall":21}],15:[function(_dereq_,module,exports){
var toObject = _dereq_('./toObject');
/**
* Creates a base function for `_.forIn` or `_.forInRight`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var iterable = toObject(object),
props = keysFunc(object),
length = props.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
var key = props[index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
module.exports = createBaseFor;
},{"./toObject":25}],16:[function(_dereq_,module,exports){
var baseProperty = _dereq_('./baseProperty');
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
module.exports = getLength;
},{"./baseProperty":12}],17:[function(_dereq_,module,exports){
var isNative = _dereq_('../lang/isNative');
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = object == null ? undefined : object[key];
return isNative(value) ? value : undefined;
}
module.exports = getNative;
},{"../lang/isNative":29}],18:[function(_dereq_,module,exports){
var getLength = _dereq_('./getLength'),
isLength = _dereq_('./isLength');
/**
* Checks if `value` is array-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value));
}
module.exports = isArrayLike;
},{"./getLength":16,"./isLength":22}],19:[function(_dereq_,module,exports){
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
var isHostObject = (function() {
try {
Object({ 'toString': 0 } + '');
} catch(e) {
return function() { return false; };
}
return function(value) {
// IE < 9 presents many host objects as `Object` objects that can coerce
// to strings despite having improperly defined `toString` methods.
return typeof value.toString != 'function' && typeof (value + '') == 'string';
};
}());
module.exports = isHostObject;
},{}],20:[function(_dereq_,module,exports){
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
length = length == null ? MAX_SAFE_INTEGER : length;
return value > -1 && value % 1 == 0 && value < length;
}
module.exports = isIndex;
},{}],21:[function(_dereq_,module,exports){
var isArrayLike = _dereq_('./isArrayLike'),
isIndex = _dereq_('./isIndex'),
isObject = _dereq_('../lang/isObject');
/**
* Checks if the provided arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)) {
var other = object[index];
return value === value ? (value === other) : (other !== other);
}
return false;
}
module.exports = isIterateeCall;
},{"../lang/isObject":30,"./isArrayLike":18,"./isIndex":20}],22:[function(_dereq_,module,exports){
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
},{}],23:[function(_dereq_,module,exports){
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isObjectLike;
},{}],24:[function(_dereq_,module,exports){
var isArguments = _dereq_('../lang/isArguments'),
isArray = _dereq_('../lang/isArray'),
isIndex = _dereq_('./isIndex'),
isLength = _dereq_('./isLength'),
isString = _dereq_('../lang/isString'),
keysIn = _dereq_('../object/keysIn');
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A fallback implementation of `Object.keys` which creates an array of the
* own enumerable property names of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function shimKeys(object) {
var props = keysIn(object),
propsLength = props.length,
length = propsLength && object.length;
var allowIndexes = !!length && isLength(length) &&
(isArray(object) || isArguments(object) || isString(object));
var index = -1,
result = [];
while (++index < propsLength) {
var key = props[index];
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
return result;
}
module.exports = shimKeys;
},{"../lang/isArguments":26,"../lang/isArray":27,"../lang/isString":32,"../object/keysIn":36,"./isIndex":20,"./isLength":22}],25:[function(_dereq_,module,exports){
var isObject = _dereq_('../lang/isObject'),
isString = _dereq_('../lang/isString'),
support = _dereq_('../support');
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
if (support.unindexedChars && isString(value)) {
var index = -1,
length = value.length,
result = Object(value);
while (++index < length) {
result[index] = value.charAt(index);
}
return result;
}
return isObject(value) ? value : Object(value);
}
module.exports = toObject;
},{"../lang/isObject":30,"../lang/isString":32,"../support":38}],26:[function(_dereq_,module,exports){
var isArrayLike = _dereq_('../internal/isArrayLike'),
isObjectLike = _dereq_('../internal/isObjectLike');
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Native method references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
return isObjectLike(value) && isArrayLike(value) &&
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
}
module.exports = isArguments;
},{"../internal/isArrayLike":18,"../internal/isObjectLike":23}],27:[function(_dereq_,module,exports){
var getNative = _dereq_('../internal/getNative'),
isLength = _dereq_('../internal/isLength'),
isObjectLike = _dereq_('../internal/isObjectLike');
/** `Object#toString` result references. */
var arrayTag = '[object Array]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsArray = getNative(Array, 'isArray');
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(function() { return arguments; }());
* // => false
*/
var isArray = nativeIsArray || function(value) {
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
};
module.exports = isArray;
},{"../internal/getNative":17,"../internal/isLength":22,"../internal/isObjectLike":23}],28:[function(_dereq_,module,exports){
var isObject = _dereq_('./isObject');
/** `Object#toString` result references. */
var funcTag = '[object Function]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 which returns 'object' for typed array constructors.
return isObject(value) && objToString.call(value) == funcTag;
}
module.exports = isFunction;
},{"./isObject":30}],29:[function(_dereq_,module,exports){
var isFunction = _dereq_('./isFunction'),
isHostObject = _dereq_('../internal/isHostObject'),
isObjectLike = _dereq_('../internal/isObjectLike');
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* Checks if `value` is a native function.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
* @example
*
* _.isNative(Array.prototype.push);
* // => true
*
* _.isNative(_);
* // => false
*/
function isNative(value) {
if (value == null) {
return false;
}
if (isFunction(value)) {
return reIsNative.test(fnToString.call(value));
}
return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
}
module.exports = isNative;
},{"../internal/isHostObject":19,"../internal/isObjectLike":23,"./isFunction":28}],30:[function(_dereq_,module,exports){
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = isObject;
},{}],31:[function(_dereq_,module,exports){
var baseForIn = _dereq_('../internal/baseForIn'),
isArguments = _dereq_('./isArguments'),
isHostObject = _dereq_('../internal/isHostObject'),
isObjectLike = _dereq_('../internal/isObjectLike'),
support = _dereq_('../support');
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* **Note:** This method assumes objects created by the `Object` constructor
* have no inherited enumerable properties.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
var Ctor;
// Exit early for non `Object` objects.
if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) ||
(!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
return false;
}
// IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited
// enumerable properties.
var result;
if (support.ownLast) {
baseForIn(value, function(subValue, key, object) {
result = hasOwnProperty.call(object, key);
return false;
});
return result !== false;
}
// In most environments an object's own properties are iterated before
// its inherited properties. If the last iterated property is an object's
// own property then there are no inherited enumerable properties.
baseForIn(value, function(subValue, key) {
result = key;
});
return result === undefined || hasOwnProperty.call(value, result);
}
module.exports = isPlainObject;
},{"../internal/baseForIn":9,"../internal/isHostObject":19,"../internal/isObjectLike":23,"../support":38,"./isArguments":26}],32:[function(_dereq_,module,exports){
var isObjectLike = _dereq_('../internal/isObjectLike');
/** `Object#toString` result references. */
var stringTag = '[object String]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
}
module.exports = isString;
},{"../internal/isObjectLike":23}],33:[function(_dereq_,module,exports){
var isLength = _dereq_('../internal/isLength'),
isObjectLike = _dereq_('../internal/isObjectLike');
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
function isTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
}
module.exports = isTypedArray;
},{"../internal/isLength":22,"../internal/isObjectLike":23}],34:[function(_dereq_,module,exports){
var baseCopy = _dereq_('../internal/baseCopy'),
keysIn = _dereq_('../object/keysIn');
/**
* Converts `value` to a plain object flattening inherited enumerable
* properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return baseCopy(value, keysIn(value));
}
module.exports = toPlainObject;
},{"../internal/baseCopy":7,"../object/keysIn":36}],35:[function(_dereq_,module,exports){
var getNative = _dereq_('../internal/getNative'),
isArrayLike = _dereq_('../internal/isArrayLike'),
isObject = _dereq_('../lang/isObject'),
shimKeys = _dereq_('../internal/shimKeys'),
support = _dereq_('../support');
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = getNative(Object, 'keys');
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
* for more details.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object == null ? undefined : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object == 'function' ? support.enumPrototypes : isArrayLike(object))) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
};
module.exports = keys;
},{"../internal/getNative":17,"../internal/isArrayLike":18,"../internal/shimKeys":24,"../lang/isObject":30,"../support":38}],36:[function(_dereq_,module,exports){
var arrayEach = _dereq_('../internal/arrayEach'),
isArguments = _dereq_('../lang/isArguments'),
isArray = _dereq_('../lang/isArray'),
isFunction = _dereq_('../lang/isFunction'),
isIndex = _dereq_('../internal/isIndex'),
isLength = _dereq_('../internal/isLength'),
isObject = _dereq_('../lang/isObject'),
isString = _dereq_('../lang/isString'),
support = _dereq_('../support');
/** `Object#toString` result references. */
var arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
stringTag = '[object String]';
/** Used to fix the JScript `[[DontEnum]]` bug. */
var shadowProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
'toLocaleString', 'toString', 'valueOf'
];
/** Used for native method references. */
var errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to avoid iterating over non-enumerable properties in IE < 9. */
var nonEnumProps = {};
nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true };
nonEnumProps[objectTag] = { 'constructor': true };
arrayEach(shadowProps, function(key) {
for (var tag in nonEnumProps) {
if (hasOwnProperty.call(nonEnumProps, tag)) {
var props = nonEnumProps[tag];
props[key] = hasOwnProperty.call(props, key);
}
}
});
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
if (object == null) {
return [];
}
if (!isObject(object)) {
object = Object(object);
}
var length = object.length;
length = (length && isLength(length) &&
(isArray(object) || isArguments(object) || isString(object)) && length) || 0;
var Ctor = object.constructor,
index = -1,
proto = (isFunction(Ctor) && Ctor.prototype) || objectProto,
isProto = proto === object,
result = Array(length),
skipIndexes = length > 0,
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
skipProto = support.enumPrototypes && isFunction(object);
while (++index < length) {
result[index] = (index + '');
}
// lodash skips the `constructor` property when it infers it's iterating
// over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
// attribute of an existing property and the `constructor` property of a
// prototype defaults to non-enumerable.
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name')) &&
!(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var tag = object === stringProto ? stringTag : (object === errorProto ? errorTag : objToString.call(object)),
nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag];
if (tag == objectTag) {
proto = objectProto;
}
length = shadowProps.length;
while (length--) {
key = shadowProps[length];
var nonEnum = nonEnums[key];
if (!(isProto && nonEnum) &&
(nonEnum ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) {
result.push(key);
}
}
}
return result;
}
module.exports = keysIn;
},{"../internal/arrayEach":6,"../internal/isIndex":20,"../internal/isLength":22,"../lang/isArguments":26,"../lang/isArray":27,"../lang/isFunction":28,"../lang/isObject":30,"../lang/isString":32,"../support":38}],37:[function(_dereq_,module,exports){
var baseMerge = _dereq_('../internal/baseMerge'),
createAssigner = _dereq_('../internal/createAssigner');
/**
* Recursively merges own enumerable properties of the source object(s), that
* don't resolve to `undefined` into the destination object. Subsequent sources
* overwrite property assignments of previous sources. If `customizer` is
* provided it's invoked to produce the merged values of the destination and
* source properties. If `customizer` returns `undefined` merging is handled
* by the method instead. The `customizer` is bound to `thisArg` and invoked
* with five arguments: (objectValue, sourceValue, key, object, source).
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {Object} Returns `object`.
* @example
*
* var users = {
* 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
* };
*
* var ages = {
* 'data': [{ 'age': 36 }, { 'age': 40 }]
* };
*
* _.merge(users, ages);
* // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
*
* // using a customizer callback
* var object = {
* 'fruits': ['apple'],
* 'vegetables': ['beet']
* };
*
* var other = {
* 'fruits': ['banana'],
* 'vegetables': ['carrot']
* };
*
* _.merge(object, other, function(a, b) {
* if (_.isArray(a)) {
* return a.concat(b);
* }
* });
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
*/
var merge = createAssigner(baseMerge);
module.exports = merge;
},{"../internal/baseMerge":10,"../internal/createAssigner":14}],38:[function(_dereq_,module,exports){
/** Used for native method references. */
var arrayProto = Array.prototype,
errorProto = Error.prototype,
objectProto = Object.prototype;
/** Native method references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
/**
* An object environment feature flags.
*
* @static
* @memberOf _
* @type Object
*/
var support = {};
(function(x) {
var Ctor = function() { this.x = x; },
object = { '0': x, 'length': x },
props = [];
Ctor.prototype = { 'valueOf': x, 'y': x };
for (var key in new Ctor) { props.push(key); }
/**
* Detect if `name` or `message` properties of `Error.prototype` are
* enumerable by default (IE < 9, Safari < 5.1).
*
* @memberOf _.support
* @type boolean
*/
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') ||
propertyIsEnumerable.call(errorProto, 'name');
/**
* Detect if `prototype` properties are enumerable by default.
*
* Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
* (if the prototype or a property on the prototype has been set)
* incorrectly set the `[[Enumerable]]` value of a function's `prototype`
* property to `true`.
*
* @memberOf _.support
* @type boolean
*/
support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
/**
* Detect if properties shadowing those on `Object.prototype` are non-enumerable.
*
* In IE < 9 an object's own properties, shadowing non-enumerable ones,
* are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
*
* @memberOf _.support
* @type boolean
*/
support.nonEnumShadows = !/valueOf/.test(props);
/**
* Detect if own properties are iterated after inherited properties (IE < 9).
*
* @memberOf _.support
* @type boolean
*/
support.ownLast = props[0] != 'x';
/**
* Detect if `Array#shift` and `Array#splice` augment array-like objects
* correctly.
*
* Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
* `shift()` and `splice()` functions that fail to remove the last element,
* `value[0]`, of array-like objects even though the "length" property is
* set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
* while `splice()` is buggy regardless of mode in IE < 9.
*
* @memberOf _.support
* @type boolean
*/
support.spliceObjects = (splice.call(object, 0, 1), !object[0]);
/**
* Detect lack of support for accessing string characters by index.
*
* IE < 8 can't access characters by index. IE 8 can only access characters
* by index on string literals, not string objects.
*
* @memberOf _.support
* @type boolean
*/
support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
}(1, 0));
module.exports = support;
},{}],39:[function(_dereq_,module,exports){
/**
* This method returns the first argument provided to it.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'user': 'fred' };
*
* _.identity(object) === object;
* // => true
*/
function identity(value) {
return value;
}
module.exports = identity;
},{}],40:[function(_dereq_,module,exports){
'use strict';
// modified from https://github.com/es-shims/es6-shim
var keys = _dereq_('object-keys');
var canBeObject = function (obj) {
return typeof obj !== 'undefined' && obj !== null;
};
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
var defineProperties = _dereq_('define-properties');
var toObject = Object;
var push = Array.prototype.push;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
var assignShim = function assign(target, source1) {
if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
var objTarget = toObject(target);
var s, source, i, props, syms;
for (s = 1; s < arguments.length; ++s) {
source = toObject(arguments[s]);
props = keys(source);
if (hasSymbols && Object.getOwnPropertySymbols) {
syms = Object.getOwnPropertySymbols(source);
for (i = 0; i < syms.length; ++i) {
if (propIsEnumerable.call(source, syms[i])) {
push.call(props, syms[i]);
}
}
}
for (i = 0; i < props.length; ++i) {
objTarget[props[i]] = source[props[i]];
}
}
return objTarget;
};
defineProperties(assignShim, {
shim: function shimObjectAssign() {
var assignHasPendingExceptions = function () {
if (!Object.assign || !Object.preventExtensions) {
return false;
}
// Firefox 37 still has "pending exception" logic in its Object.assign implementation,
// which is 72% slower than our shim, and Firefox 40's native implementation.
var thrower = Object.preventExtensions({ 1: 2 });
try {
Object.assign(thrower, 'xy');
} catch (e) {
return thrower[1] === 'y';
}
};
defineProperties(
Object,
{ assign: assignShim },
{ assign: assignHasPendingExceptions }
);
return Object.assign || assignShim;
}
});
module.exports = assignShim;
},{"define-properties":41,"object-keys":43}],41:[function(_dereq_,module,exports){
'use strict';
var keys = _dereq_('object-keys');
var foreach = _dereq_('foreach');
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
var toStr = Object.prototype.toString;
var isFunction = function (fn) {
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
};
var arePropertyDescriptorsSupported = function () {
var obj = {};
try {
Object.defineProperty(obj, 'x', { value: obj, enumerable: false });
/* eslint-disable no-unused-vars */
for (var _ in obj) { return false; }
/* eslint-enable no-unused-vars */
return obj.x === obj;
} catch (e) { /* this is IE 8. */
return false;
}
};
var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported();
var defineProperty = function (object, name, value, predicate) {
if (name in object && (!isFunction(predicate) || !predicate())) {
return;
}
if (supportsDescriptors) {
Object.defineProperty(object, name, {
configurable: true,
enumerable: false,
writable: true,
value: value
});
} else {
object[name] = value;
}
};
var defineProperties = function (object, map) {
var predicates = arguments.length > 2 ? arguments[2] : {};
var props = keys(map);
if (hasSymbols) {
props = props.concat(Object.getOwnPropertySymbols(map));
}
foreach(props, function (name) {
defineProperty(object, name, map[name], predicates[name]);
});
};
defineProperties.supportsDescriptors = !!supportsDescriptors;
module.exports = defineProperties;
},{"foreach":42,"object-keys":43}],42:[function(_dereq_,module,exports){
var hasOwn = Object.prototype.hasOwnProperty;
var toString = Object.prototype.toString;
module.exports = function forEach (obj, fn, ctx) {
if (toString.call(fn) !== '[object Function]') {
throw new TypeError('iterator must be a function');
}
var l = obj.length;
if (l === +l) {
for (var i = 0; i < l; i++) {
fn.call(ctx, obj[i], i, obj);
}
} else {
for (var k in obj) {
if (hasOwn.call(obj, k)) {
fn.call(ctx, obj[k], k, obj);
}
}
}
};
},{}],43:[function(_dereq_,module,exports){
'use strict';
// modified from https://github.com/es-shims/es5-shim
var has = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var slice = Array.prototype.slice;
var isArgs = _dereq_('./isArguments');
var hasDontEnumBug = !({ 'toString': null }).propertyIsEnumerable('toString');
var hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype');
var dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
var equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
};
var blacklistedKeys = {
$window: true,
$console: true,
$parent: true,
$self: true,
$frames: true,
$webkitIndexedDB: true,
$webkitStorageInfo: true
};
var hasAutomationEqualityBug = (function () {
/* global window */
if (typeof window === 'undefined') { return false; }
for (var k in window) {
if (!blacklistedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
try {
equalsConstructorPrototype(window[k]);
} catch (e) {
return true;
}
}
}
return false;
}());
var equalsConstructorPrototypeIfNotBuggy = function (o) {
/* global window */
if (typeof window === 'undefined' && !hasAutomationEqualityBug) {
return equalsConstructorPrototype(o);
}
try {
return equalsConstructorPrototype(o);
} catch (e) {
return false;
}
};
var keysShim = function keys(object) {
var isObject = object !== null && typeof object === 'object';
var isFunction = toStr.call(object) === '[object Function]';
var isArguments = isArgs(object);
var isString = isObject && toStr.call(object) === '[object String]';
var theKeys = [];
if (!isObject && !isFunction && !isArguments) {
throw new TypeError('Object.keys called on a non-object');
}
var skipProto = hasProtoEnumBug && isFunction;
if (isString && object.length > 0 && !has.call(object, 0)) {
for (var i = 0; i < object.length; ++i) {
theKeys.push(String(i));
}
}
if (isArguments && object.length > 0) {
for (var j = 0; j < object.length; ++j) {
theKeys.push(String(j));
}
} else {
for (var name in object) {
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
theKeys.push(String(name));
}
}
}
if (hasDontEnumBug) {
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
for (var k = 0; k < dontEnums.length; ++k) {
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
theKeys.push(dontEnums[k]);
}
}
}
return theKeys;
};
keysShim.shim = function shimObjectKeys() {
if (!Object.keys) {
Object.keys = keysShim;
} else {
var keysWorksWithArguments = (function () {
// Safari 5.0 bug
return (Object.keys(arguments) || '').length === 2;
}(1, 2));
if (!keysWorksWithArguments) {
var originalKeys = Object.keys;
Object.keys = function keys(object) {
if (isArgs(object)) {
return originalKeys(slice.call(object));
} else {
return originalKeys(object);
}
};
}
}
return Object.keys || keysShim;
};
module.exports = keysShim;
},{"./isArguments":44}],44:[function(_dereq_,module,exports){
'use strict';
var toStr = Object.prototype.toString;
module.exports = function isArguments(value) {
var str = toStr.call(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = str !== '[object Array]' &&
value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
toStr.call(value.callee) === '[object Function]';
}
return isArgs;
};
},{}],45:[function(_dereq_,module,exports){
module.exports = SafeParseTuple
function SafeParseTuple(obj, reviver) {
var json
var error = null
try {
json = JSON.parse(obj, reviver)
} catch (err) {
error = err
}
return [error, json]
}
},{}],46:[function(_dereq_,module,exports){
/**
* @file big-play-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('./button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('./component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* Initial play button. Shows before the video has played. The hiding of the
* big play button is done via CSS and player states.
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @extends Button
* @class BigPlayButton
*/
var BigPlayButton = (function (_Button) {
_inherits(BigPlayButton, _Button);
function BigPlayButton(player, options) {
_classCallCheck(this, BigPlayButton);
_Button.call(this, player, options);
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
BigPlayButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-big-play-button';
};
/**
* Handles click for play
*
* @method handleClick
*/
BigPlayButton.prototype.handleClick = function handleClick() {
this.player_.play();
};
return BigPlayButton;
})(_buttonJs2['default']);
BigPlayButton.prototype.controlText_ = 'Play Video';
_componentJs2['default'].registerComponent('BigPlayButton', BigPlayButton);
exports['default'] = BigPlayButton;
module.exports = exports['default'];
},{"./button.js":47,"./component.js":48}],47:[function(_dereq_,module,exports){
/**
* @file button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('./component');
var _component2 = _interopRequireDefault(_component);
var _utilsDomJs = _dereq_('./utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsEventsJs = _dereq_('./utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var _utilsFnJs = _dereq_('./utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* Base class for all buttons
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @extends Component
* @class Button
*/
var Button = (function (_Component) {
_inherits(Button, _Component);
function Button(player, options) {
_classCallCheck(this, Button);
_Component.call(this, player, options);
this.emitTapEvents();
this.on('tap', this.handleClick);
this.on('click', this.handleClick);
this.on('focus', this.handleFocus);
this.on('blur', this.handleBlur);
}
/**
* Create the component's DOM element
*
* @param {String=} type Element's node type. e.g. 'div'
* @param {Object=} props An object of element attributes that should be set on the element Tag name
* @return {Element}
* @method createEl
*/
Button.prototype.createEl = function createEl() {
var tag = arguments.length <= 0 || arguments[0] === undefined ? 'button' : arguments[0];
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
// Add standard Aria and Tabindex info
props = _objectAssign2['default']({
className: this.buildCSSClass(),
'role': 'button',
'type': 'button', // Necessary since the default button type is "submit"
'aria-live': 'polite', // let the screen reader user know that the text of the button may change
tabIndex: 0
}, props);
var el = _Component.prototype.createEl.call(this, tag, props);
this.controlTextEl_ = Dom.createEl('span', {
className: 'vjs-control-text'
});
el.appendChild(this.controlTextEl_);
this.controlText(this.controlText_);
return el;
};
/**
* Controls text - both request and localize
*
* @param {String} text Text for button
* @return {String}
* @method controlText
*/
Button.prototype.controlText = function controlText(text) {
if (!text) return this.controlText_ || 'Need Text';
this.controlText_ = text;
this.controlTextEl_.innerHTML = this.localize(this.controlText_);
return this;
};
/**
* Allows sub components to stack CSS class names
*
* @return {String}
* @method buildCSSClass
*/
Button.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-control vjs-button ' + _Component.prototype.buildCSSClass.call(this);
};
/**
* Handle Click - Override with specific functionality for button
*
* @method handleClick
*/
Button.prototype.handleClick = function handleClick() {};
/**
* Handle Focus - Add keyboard functionality to element
*
* @method handleFocus
*/
Button.prototype.handleFocus = function handleFocus() {
Events.on(_globalDocument2['default'], 'keydown', Fn.bind(this, this.handleKeyPress));
};
/**
* Handle KeyPress (document level) - Trigger click when keys are pressed
*
* @method handleKeyPress
*/
Button.prototype.handleKeyPress = function handleKeyPress(event) {
// Check for space bar (32) or enter (13) keys
if (event.which === 32 || event.which === 13) {
event.preventDefault();
this.handleClick(event);
}
};
/**
* Handle Blur - Remove keyboard triggers
*
* @method handleBlur
*/
Button.prototype.handleBlur = function handleBlur() {
Events.off(_globalDocument2['default'], 'keydown', Fn.bind(this, this.handleKeyPress));
};
return Button;
})(_component2['default']);
_component2['default'].registerComponent('Button', Button);
exports['default'] = Button;
module.exports = exports['default'];
},{"./component":48,"./utils/dom.js":107,"./utils/events.js":108,"./utils/fn.js":109,"global/document":1,"object.assign":40}],48:[function(_dereq_,module,exports){
/**
* @file component.js
*
* Player Component - Base class for all UI objects
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _utilsDomJs = _dereq_('./utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFnJs = _dereq_('./utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsGuidJs = _dereq_('./utils/guid.js');
var Guid = _interopRequireWildcard(_utilsGuidJs);
var _utilsEventsJs = _dereq_('./utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var _utilsLogJs = _dereq_('./utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _utilsToTitleCaseJs = _dereq_('./utils/to-title-case.js');
var _utilsToTitleCaseJs2 = _interopRequireDefault(_utilsToTitleCaseJs);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _utilsMergeOptionsJs = _dereq_('./utils/merge-options.js');
var _utilsMergeOptionsJs2 = _interopRequireDefault(_utilsMergeOptionsJs);
/**
* Base UI Component class
* Components are embeddable UI objects that are represented by both a
* javascript object and an element in the DOM. They can be children of other
* components, and can have many children themselves.
* ```js
* // adding a button to the player
* var button = player.addChild('button');
* button.el(); // -> button element
* ```
* ```html
* <div class="video-js">
* <div class="vjs-button">Button</div>
* </div>
* ```
* Components are also event targets.
* ```js
* button.on('click', function(){
* console.log('Button Clicked!');
* });
* button.trigger('customevent');
* ```
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @class Component
*/
var Component = (function () {
function Component(player, options, ready) {
_classCallCheck(this, Component);
// The component might be the player itself and we can't pass `this` to super
if (!player && this.play) {
this.player_ = player = this; // eslint-disable-line
} else {
this.player_ = player;
}
// Make a copy of prototype.options_ to protect against overriding defaults
this.options_ = _utilsMergeOptionsJs2['default']({}, this.options_);
// Updated options with supplied options
options = this.options_ = _utilsMergeOptionsJs2['default'](this.options_, options);
// Get ID from options or options element if one is supplied
this.id_ = options.id || options.el && options.el.id;
// If there was no ID from the options, generate one
if (!this.id_) {
// Don't require the player ID function in the case of mock players
var id = player && player.id && player.id() || 'no_player';
this.id_ = id + '_component_' + Guid.newGUID();
}
this.name_ = options.name || null;
// Create element if one wasn't provided in options
if (options.el) {
this.el_ = options.el;
} else if (options.createEl !== false) {
this.el_ = this.createEl();
}
this.children_ = [];
this.childIndex_ = {};
this.childNameIndex_ = {};
// Add any child components in options
if (options.initChildren !== false) {
this.initChildren();
}
this.ready(ready);
// Don't want to trigger ready here or it will before init is actually
// finished for all children that run this constructor
if (options.reportTouchActivity !== false) {
this.enableTouchActivity();
}
}
/**
* Dispose of the component and all child components
*
* @method dispose
*/
Component.prototype.dispose = function dispose() {
this.trigger({ type: 'dispose', bubbles: false });
// Dispose all children.
if (this.children_) {
for (var i = this.children_.length - 1; i >= 0; i--) {
if (this.children_[i].dispose) {
this.children_[i].dispose();
}
}
}
// Delete child references
this.children_ = null;
this.childIndex_ = null;
this.childNameIndex_ = null;
// Remove all event listeners.
this.off();
// Remove element from DOM
if (this.el_.parentNode) {
this.el_.parentNode.removeChild(this.el_);
}
Dom.removeElData(this.el_);
this.el_ = null;
};
/**
* Return the component's player
*
* @return {Player}
* @method player
*/
Component.prototype.player = function player() {
return this.player_;
};
/**
* Deep merge of options objects
* Whenever a property is an object on both options objects
* the two properties will be merged using mergeOptions.
* This is used for merging options for child components. We
* want it to be easy to override individual options on a child
* component without having to rewrite all the other default options.
* ```js
* Parent.prototype.options_ = {
* children: {
* 'childOne': { 'foo': 'bar', 'asdf': 'fdsa' },
* 'childTwo': {},
* 'childThree': {}
* }
* }
* newOptions = {
* children: {
* 'childOne': { 'foo': 'baz', 'abc': '123' }
* 'childTwo': null,
* 'childFour': {}
* }
* }
*
* this.options(newOptions);
* ```
* RESULT
* ```js
* {
* children: {
* 'childOne': { 'foo': 'baz', 'asdf': 'fdsa', 'abc': '123' },
* 'childTwo': null, // Disabled. Won't be initialized.
* 'childThree': {},
* 'childFour': {}
* }
* }
* ```
*
* @param {Object} obj Object of new option values
* @return {Object} A NEW object of this.options_ and obj merged
* @method options
*/
Component.prototype.options = function options(obj) {
_utilsLogJs2['default'].warn('this.options() has been deprecated and will be moved to the constructor in 6.0');
if (!obj) {
return this.options_;
}
this.options_ = _utilsMergeOptionsJs2['default'](this.options_, obj);
return this.options_;
};
/**
* Get the component's DOM element
* ```js
* var domEl = myComponent.el();
* ```
*
* @return {Element}
* @method el
*/
Component.prototype.el = function el() {
return this.el_;
};
/**
* Create the component's DOM element
*
* @param {String=} tagName Element's node type. e.g. 'div'
* @param {Object=} attributes An object of element attributes that should be set on the element
* @return {Element}
* @method createEl
*/
Component.prototype.createEl = function createEl(tagName, attributes) {
return Dom.createEl(tagName, attributes);
};
Component.prototype.localize = function localize(string) {
var code = this.player_.language && this.player_.language();
var languages = this.player_.languages && this.player_.languages();
if (!code || !languages) {
return string;
}
var language = languages[code];
if (language && language[string]) {
return language[string];
}
var primaryCode = code.split('-')[0];
var primaryLang = languages[primaryCode];
if (primaryLang && primaryLang[string]) {
return primaryLang[string];
}
return string;
};
/**
* Return the component's DOM element where children are inserted.
* Will either be the same as el() or a new element defined in createEl().
*
* @return {Element}
* @method contentEl
*/
Component.prototype.contentEl = function contentEl() {
return this.contentEl_ || this.el_;
};
/**
* Get the component's ID
* ```js
* var id = myComponent.id();
* ```
*
* @return {String}
* @method id
*/
Component.prototype.id = function id() {
return this.id_;
};
/**
* Get the component's name. The name is often used to reference the component.
* ```js
* var name = myComponent.name();
* ```
*
* @return {String}
* @method name
*/
Component.prototype.name = function name() {
return this.name_;
};
/**
* Get an array of all child components
* ```js
* var kids = myComponent.children();
* ```
*
* @return {Array} The children
* @method children
*/
Component.prototype.children = function children() {
return this.children_;
};
/**
* Returns a child component with the provided ID
*
* @return {Component}
* @method getChildById
*/
Component.prototype.getChildById = function getChildById(id) {
return this.childIndex_[id];
};
/**
* Returns a child component with the provided name
*
* @return {Component}
* @method getChild
*/
Component.prototype.getChild = function getChild(name) {
return this.childNameIndex_[name];
};
/**
* Adds a child component inside this component
* ```js
* myComponent.el();
* // -> <div class='my-component'></div>
* myComponent.children();
* // [empty array]
*
* var myButton = myComponent.addChild('MyButton');
* // -> <div class='my-component'><div class="my-button">myButton<div></div>
* // -> myButton === myComonent.children()[0];
* ```
* Pass in options for child constructors and options for children of the child
* ```js
* var myButton = myComponent.addChild('MyButton', {
* text: 'Press Me',
* children: {
* buttonChildExample: {
* buttonChildOption: true
* }
* }
* });
* ```
*
* @param {String|Component} child The class name or instance of a child to add
* @param {Object=} options Options, including options to be passed to children of the child.
* @return {Component} The child component (created by this process if a string was used)
* @method addChild
*/
Component.prototype.addChild = function addChild(child) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var component = undefined;
var componentName = undefined;
// If child is a string, create nt with options
if (typeof child === 'string') {
componentName = child;
// Options can also be specified as a boolean, so convert to an empty object if false.
if (!options) {
options = {};
}
// Same as above, but true is deprecated so show a warning.
if (options === true) {
_utilsLogJs2['default'].warn('Initializing a child component with `true` is deprecated. Children should be defined in an array when possible, but if necessary use an object instead of `true`.');
options = {};
}
// If no componentClass in options, assume componentClass is the name lowercased
// (e.g. playButton)
var componentClassName = options.componentClass || _utilsToTitleCaseJs2['default'](componentName);
// Set name through options
options.name = componentName;
// Create a new object & element for this controls set
// If there's no .player_, this is a player
var ComponentClass = Component.getComponent(componentClassName);
component = new ComponentClass(this.player_ || this, options);
// child is a component instance
} else {
component = child;
}
this.children_.push(component);
if (typeof component.id === 'function') {
this.childIndex_[component.id()] = component;
}
// If a name wasn't used to create the component, check if we can use the
// name function of the component
componentName = componentName || component.name && component.name();
if (componentName) {
this.childNameIndex_[componentName] = component;
}
// Add the UI object's element to the container div (box)
// Having an element is not required
if (typeof component.el === 'function' && component.el()) {
this.contentEl().appendChild(component.el());
}
// Return so it can stored on parent object if desired.
return component;
};
/**
* Remove a child component from this component's list of children, and the
* child component's element from this component's element
*
* @param {Component} component Component to remove
* @method removeChild
*/
Component.prototype.removeChild = function removeChild(component) {
if (typeof component === 'string') {
component = this.getChild(component);
}
if (!component || !this.children_) {
return;
}
var childFound = false;
for (var i = this.children_.length - 1; i >= 0; i--) {
if (this.children_[i] === component) {
childFound = true;
this.children_.splice(i, 1);
break;
}
}
if (!childFound) {
return;
}
this.childIndex_[component.id()] = null;
this.childNameIndex_[component.name()] = null;
var compEl = component.el();
if (compEl && compEl.parentNode === this.contentEl()) {
this.contentEl().removeChild(component.el());
}
};
/**
* Add and initialize default child components from options
* ```js
* // when an instance of MyComponent is created, all children in options
* // will be added to the instance by their name strings and options
* MyComponent.prototype.options_.children = {
* myChildComponent: {
* myChildOption: true
* }
* }
* ```
* // Or when creating the component
* ```js
* var myComp = new MyComponent(player, {
* children: {
* myChildComponent: {
* myChildOption: true
* }
* }
* });
* ```
* The children option can also be an Array of child names or
* child options objects (that also include a 'name' key).
* ```js
* var myComp = new MyComponent(player, {
* children: [
* 'button',
* {
* name: 'button',
* someOtherOption: true
* }
* ]
* });
* ```
*
* @method initChildren
*/
Component.prototype.initChildren = function initChildren() {
var _this = this;
var children = this.options_.children;
if (children) {
(function () {
// `this` is `parent`
var parentOptions = _this.options_;
var handleAdd = function handleAdd(name, opts) {
// Allow options for children to be set at the parent options
// e.g. videojs(id, { controlBar: false });
// instead of videojs(id, { children: { controlBar: false });
if (parentOptions[name] !== undefined) {
opts = parentOptions[name];
}
// Allow for disabling default components
// e.g. options['children']['posterImage'] = false
if (opts === false) {
return;
}
// Allow options to be passed as a simple boolean if no configuration
// is necessary.
if (opts === true) {
opts = {};
}
// We also want to pass the original player options to each component as well so they don't need to
// reach back into the player for options later.
opts.playerOptions = _this.options_.playerOptions;
// Create and add the child component.
// Add a direct reference to the child by name on the parent instance.
// If two of the same component are used, different names should be supplied
// for each
_this[name] = _this.addChild(name, opts);
};
// Allow for an array of children details to passed in the options
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var child = children[i];
var _name = undefined;
var opts = undefined;
if (typeof child === 'string') {
// ['myComponent']
_name = child;
opts = {};
} else {
// [{ name: 'myComponent', otherOption: true }]
_name = child.name;
opts = child;
}
handleAdd(_name, opts);
}
} else {
Object.getOwnPropertyNames(children).forEach(function (name) {
handleAdd(name, children[name]);
});
}
})();
}
};
/**
* Allows sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
Component.prototype.buildCSSClass = function buildCSSClass() {
// Child classes can include a function that does:
// return 'CLASS NAME' + this._super();
return '';
};
/**
* Add an event listener to this component's element
* ```js
* var myFunc = function(){
* var myComponent = this;
* // Do something when the event is fired
* };
*
* myComponent.on('eventType', myFunc);
* ```
* The context of myFunc will be myComponent unless previously bound.
* Alternatively, you can add a listener to another element or component.
* ```js
* myComponent.on(otherElement, 'eventName', myFunc);
* myComponent.on(otherComponent, 'eventName', myFunc);
* ```
* The benefit of using this over `VjsEvents.on(otherElement, 'eventName', myFunc)`
* and `otherComponent.on('eventName', myFunc)` is that this way the listeners
* will be automatically cleaned up when either component is disposed.
* It will also bind myComponent as the context of myFunc.
* **NOTE**: When using this on elements in the page other than window
* and document (both permanent), if you remove the element from the DOM
* you need to call `myComponent.trigger(el, 'dispose')` on it to clean up
* references to it and allow the browser to garbage collect it.
*
* @param {String|Component} first The event type or other component
* @param {Function|String} second The event handler or event type
* @param {Function} third The event handler
* @return {Component}
* @method on
*/
Component.prototype.on = function on(first, second, third) {
var _this2 = this;
if (typeof first === 'string' || Array.isArray(first)) {
Events.on(this.el_, first, Fn.bind(this, second));
// Targeting another component or element
} else {
(function () {
var target = first;
var type = second;
var fn = Fn.bind(_this2, third);
// When this component is disposed, remove the listener from the other component
var removeOnDispose = function removeOnDispose() {
return _this2.off(target, type, fn);
};
// Use the same function ID so we can remove it later it using the ID
// of the original listener
removeOnDispose.guid = fn.guid;
_this2.on('dispose', removeOnDispose);
// If the other component is disposed first we need to clean the reference
// to the other component in this component's removeOnDispose listener
// Otherwise we create a memory leak.
var cleanRemover = function cleanRemover() {
return _this2.off('dispose', removeOnDispose);
};
// Add the same function ID so we can easily remove it later
cleanRemover.guid = fn.guid;
// Check if this is a DOM node
if (first.nodeName) {
// Add the listener to the other element
Events.on(target, type, fn);
Events.on(target, 'dispose', cleanRemover);
// Should be a component
// Not using `instanceof Component` because it makes mock players difficult
} else if (typeof first.on === 'function') {
// Add the listener to the other component
target.on(type, fn);
target.on('dispose', cleanRemover);
}
})();
}
return this;
};
/**
* Remove an event listener from this component's element
* ```js
* myComponent.off('eventType', myFunc);
* ```
* If myFunc is excluded, ALL listeners for the event type will be removed.
* If eventType is excluded, ALL listeners will be removed from the component.
* Alternatively you can use `off` to remove listeners that were added to other
* elements or components using `myComponent.on(otherComponent...`.
* In this case both the event type and listener function are REQUIRED.
* ```js
* myComponent.off(otherElement, 'eventType', myFunc);
* myComponent.off(otherComponent, 'eventType', myFunc);
* ```
*
* @param {String=|Component} first The event type or other component
* @param {Function=|String} second The listener function or event type
* @param {Function=} third The listener for other component
* @return {Component}
* @method off
*/
Component.prototype.off = function off(first, second, third) {
if (!first || typeof first === 'string' || Array.isArray(first)) {
Events.off(this.el_, first, second);
} else {
var target = first;
var type = second;
// Ensure there's at least a guid, even if the function hasn't been used
var fn = Fn.bind(this, third);
// Remove the dispose listener on this component,
// which was given the same guid as the event listener
this.off('dispose', fn);
if (first.nodeName) {
// Remove the listener
Events.off(target, type, fn);
// Remove the listener for cleaning the dispose listener
Events.off(target, 'dispose', fn);
} else {
target.off(type, fn);
target.off('dispose', fn);
}
}
return this;
};
/**
* Add an event listener to be triggered only once and then removed
* ```js
* myComponent.one('eventName', myFunc);
* ```
* Alternatively you can add a listener to another element or component
* that will be triggered only once.
* ```js
* myComponent.one(otherElement, 'eventName', myFunc);
* myComponent.one(otherComponent, 'eventName', myFunc);
* ```
*
* @param {String|Component} first The event type or other component
* @param {Function|String} second The listener function or event type
* @param {Function=} third The listener function for other component
* @return {Component}
* @method one
*/
Component.prototype.one = function one(first, second, third) {
var _this3 = this,
_arguments = arguments;
if (typeof first === 'string' || Array.isArray(first)) {
Events.one(this.el_, first, Fn.bind(this, second));
} else {
(function () {
var target = first;
var type = second;
var fn = Fn.bind(_this3, third);
var newFunc = function newFunc() {
_this3.off(target, type, newFunc);
fn.apply(null, _arguments);
};
// Keep the same function ID so we can remove it later
newFunc.guid = fn.guid;
_this3.on(target, type, newFunc);
})();
}
return this;
};
/**
* Trigger an event on an element
* ```js
* myComponent.trigger('eventName');
* myComponent.trigger({'type':'eventName'});
* myComponent.trigger('eventName', {data: 'some data'});
* myComponent.trigger({'type':'eventName'}, {data: 'some data'});
* ```
*
* @param {Event|Object|String} event A string (the type) or an event object with a type attribute
* @param {Object} [hash] data hash to pass along with the event
* @return {Component} self
* @method trigger
*/
Component.prototype.trigger = function trigger(event, hash) {
Events.trigger(this.el_, event, hash);
return this;
};
/**
* Bind a listener to the component's ready state.
* Different from event listeners in that if the ready event has already happened
* it will trigger the function immediately.
*
* @param {Function} fn Ready listener
* @param {Boolean} sync Exec the listener synchronously if component is ready
* @return {Component}
* @method ready
*/
Component.prototype.ready = function ready(fn) {
var sync = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
if (fn) {
if (this.isReady_) {
if (sync) {
fn.call(this);
} else {
// Call the function asynchronously by default for consistency
this.setTimeout(fn, 1);
}
} else {
this.readyQueue_ = this.readyQueue_ || [];
this.readyQueue_.push(fn);
}
}
return this;
};
/**
* Trigger the ready listeners
*
* @return {Component}
* @method triggerReady
*/
Component.prototype.triggerReady = function triggerReady() {
this.isReady_ = true;
// Ensure ready is triggerd asynchronously
this.setTimeout(function () {
var readyQueue = this.readyQueue_;
if (readyQueue && readyQueue.length > 0) {
readyQueue.forEach(function (fn) {
fn.call(this);
}, this);
// Reset Ready Queue
this.readyQueue_ = [];
}
// Allow for using event listeners also
this.trigger('ready');
}, 1);
};
/**
* Check if a component's element has a CSS class name
*
* @param {String} classToCheck Classname to check
* @return {Component}
* @method hasClass
*/
Component.prototype.hasClass = function hasClass(classToCheck) {
return Dom.hasElClass(this.el_, classToCheck);
};
/**
* Add a CSS class name to the component's element
*
* @param {String} classToAdd Classname to add
* @return {Component}
* @method addClass
*/
Component.prototype.addClass = function addClass(classToAdd) {
Dom.addElClass(this.el_, classToAdd);
return this;
};
/**
* Remove and return a CSS class name from the component's element
*
* @param {String} classToRemove Classname to remove
* @return {Component}
* @method removeClass
*/
Component.prototype.removeClass = function removeClass(classToRemove) {
Dom.removeElClass(this.el_, classToRemove);
return this;
};
/**
* Show the component element if hidden
*
* @return {Component}
* @method show
*/
Component.prototype.show = function show() {
this.removeClass('vjs-hidden');
return this;
};
/**
* Hide the component element if currently showing
*
* @return {Component}
* @method hide
*/
Component.prototype.hide = function hide() {
this.addClass('vjs-hidden');
return this;
};
/**
* Lock an item in its visible state
* To be used with fadeIn/fadeOut.
*
* @return {Component}
* @private
* @method lockShowing
*/
Component.prototype.lockShowing = function lockShowing() {
this.addClass('vjs-lock-showing');
return this;
};
/**
* Unlock an item to be hidden
* To be used with fadeIn/fadeOut.
*
* @return {Component}
* @private
* @method unlockShowing
*/
Component.prototype.unlockShowing = function unlockShowing() {
this.removeClass('vjs-lock-showing');
return this;
};
/**
* Set or get the width of the component (CSS values)
* Setting the video tag dimension values only works with values in pixels.
* Percent values will not work.
* Some percents can be used, but width()/height() will return the number + %,
* not the actual computed width/height.
*
* @param {Number|String=} num Optional width number
* @param {Boolean} skipListeners Skip the 'resize' event trigger
* @return {Component} This component, when setting the width
* @return {Number|String} The width, when getting
* @method width
*/
Component.prototype.width = function width(num, skipListeners) {
return this.dimension('width', num, skipListeners);
};
/**
* Get or set the height of the component (CSS values)
* Setting the video tag dimension values only works with values in pixels.
* Percent values will not work.
* Some percents can be used, but width()/height() will return the number + %,
* not the actual computed width/height.
*
* @param {Number|String=} num New component height
* @param {Boolean=} skipListeners Skip the resize event trigger
* @return {Component} This component, when setting the height
* @return {Number|String} The height, when getting
* @method height
*/
Component.prototype.height = function height(num, skipListeners) {
return this.dimension('height', num, skipListeners);
};
/**
* Set both width and height at the same time
*
* @param {Number|String} width Width of player
* @param {Number|String} height Height of player
* @return {Component} The component
* @method dimensions
*/
Component.prototype.dimensions = function dimensions(width, height) {
// Skip resize listeners on width for optimization
return this.width(width, true).height(height);
};
/**
* Get or set width or height
* This is the shared code for the width() and height() methods.
* All for an integer, integer + 'px' or integer + '%';
* Known issue: Hidden elements officially have a width of 0. We're defaulting
* to the style.width value and falling back to computedStyle which has the
* hidden element issue. Info, but probably not an efficient fix:
* http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/
*
* @param {String} widthOrHeight 'width' or 'height'
* @param {Number|String=} num New dimension
* @param {Boolean=} skipListeners Skip resize event trigger
* @return {Component} The component if a dimension was set
* @return {Number|String} The dimension if nothing was set
* @private
* @method dimension
*/
Component.prototype.dimension = function dimension(widthOrHeight, num, skipListeners) {
if (num !== undefined) {
// Set to zero if null or literally NaN (NaN !== NaN)
if (num === null || num !== num) {
num = 0;
}
// Check if using css width/height (% or px) and adjust
if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) {
this.el_.style[widthOrHeight] = num;
} else if (num === 'auto') {
this.el_.style[widthOrHeight] = '';
} else {
this.el_.style[widthOrHeight] = num + 'px';
}
// skipListeners allows us to avoid triggering the resize event when setting both width and height
if (!skipListeners) {
this.trigger('resize');
}
// Return component
return this;
}
// Not setting a value, so getting it
// Make sure element exists
if (!this.el_) {
return 0;
}
// Get dimension value from style
var val = this.el_.style[widthOrHeight];
var pxIndex = val.indexOf('px');
if (pxIndex !== -1) {
// Return the pixel value with no 'px'
return parseInt(val.slice(0, pxIndex), 10);
}
// No px so using % or no style was set, so falling back to offsetWidth/height
// If component has display:none, offset will return 0
// TODO: handle display:none and no dimension style using px
return parseInt(this.el_['offset' + _utilsToTitleCaseJs2['default'](widthOrHeight)], 10);
};
/**
* Emit 'tap' events when touch events are supported
* This is used to support toggling the controls through a tap on the video.
* We're requiring them to be enabled because otherwise every component would
* have this extra overhead unnecessarily, on mobile devices where extra
* overhead is especially bad.
*
* @private
* @method emitTapEvents
*/
Component.prototype.emitTapEvents = function emitTapEvents() {
// Track the start time so we can determine how long the touch lasted
var touchStart = 0;
var firstTouch = null;
// Maximum movement allowed during a touch event to still be considered a tap
// Other popular libs use anywhere from 2 (hammer.js) to 15, so 10 seems like a nice, round number.
var tapMovementThreshold = 10;
// The maximum length a touch can be while still being considered a tap
var touchTimeThreshold = 200;
var couldBeTap = undefined;
this.on('touchstart', function (event) {
// If more than one finger, don't consider treating this as a click
if (event.touches.length === 1) {
// Copy the touches object to prevent modifying the original
firstTouch = _objectAssign2['default']({}, event.touches[0]);
// Record start time so we can detect a tap vs. "touch and hold"
touchStart = new Date().getTime();
// Reset couldBeTap tracking
couldBeTap = true;
}
});
this.on('touchmove', function (event) {
// If more than one finger, don't consider treating this as a click
if (event.touches.length > 1) {
couldBeTap = false;
} else if (firstTouch) {
// Some devices will throw touchmoves for all but the slightest of taps.
// So, if we moved only a small distance, this could still be a tap
var xdiff = event.touches[0].pageX - firstTouch.pageX;
var ydiff = event.touches[0].pageY - firstTouch.pageY;
var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
if (touchDistance > tapMovementThreshold) {
couldBeTap = false;
}
}
});
var noTap = function noTap() {
couldBeTap = false;
};
// TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s
this.on('touchleave', noTap);
this.on('touchcancel', noTap);
// When the touch ends, measure how long it took and trigger the appropriate
// event
this.on('touchend', function (event) {
firstTouch = null;
// Proceed only if the touchmove/leave/cancel event didn't happen
if (couldBeTap === true) {
// Measure how long the touch lasted
var touchTime = new Date().getTime() - touchStart;
// Make sure the touch was less than the threshold to be considered a tap
if (touchTime < touchTimeThreshold) {
// Don't let browser turn this into a click
event.preventDefault();
this.trigger('tap');
// It may be good to copy the touchend event object and change the
// type to tap, if the other event properties aren't exact after
// Events.fixEvent runs (e.g. event.target)
}
}
});
};
/**
* Report user touch activity when touch events occur
* User activity is used to determine when controls should show/hide. It's
* relatively simple when it comes to mouse events, because any mouse event
* should show the controls. So we capture mouse events that bubble up to the
* player and report activity when that happens.
* With touch events it isn't as easy. We can't rely on touch events at the
* player level, because a tap (touchstart + touchend) on the video itself on
* mobile devices is meant to turn controls off (and on). User activity is
* checked asynchronously, so what could happen is a tap event on the video
* turns the controls off, then the touchend event bubbles up to the player,
* which if it reported user activity, would turn the controls right back on.
* (We also don't want to completely block touch events from bubbling up)
* Also a touchmove, touch+hold, and anything other than a tap is not supposed
* to turn the controls back on on a mobile device.
* Here we're setting the default component behavior to report user activity
* whenever touch events happen, and this can be turned off by components that
* want touch events to act differently.
*
* @method enableTouchActivity
*/
Component.prototype.enableTouchActivity = function enableTouchActivity() {
// Don't continue if the root player doesn't support reporting user activity
if (!this.player() || !this.player().reportUserActivity) {
return;
}
// listener for reporting that the user is active
var report = Fn.bind(this.player(), this.player().reportUserActivity);
var touchHolding = undefined;
this.on('touchstart', function () {
report();
// For as long as the they are touching the device or have their mouse down,
// we consider them active even if they're not moving their finger or mouse.
// So we want to continue to update that they are active
this.clearInterval(touchHolding);
// report at the same interval as activityCheck
touchHolding = this.setInterval(report, 250);
});
var touchEnd = function touchEnd(event) {
report();
// stop the interval that maintains activity if the touch is holding
this.clearInterval(touchHolding);
};
this.on('touchmove', report);
this.on('touchend', touchEnd);
this.on('touchcancel', touchEnd);
};
/**
* Creates timeout and sets up disposal automatically.
*
* @param {Function} fn The function to run after the timeout.
* @param {Number} timeout Number of ms to delay before executing specified function.
* @return {Number} Returns the timeout ID
* @method setTimeout
*/
Component.prototype.setTimeout = function setTimeout(fn, timeout) {
fn = Fn.bind(this, fn);
// window.setTimeout would be preferable here, but due to some bizarre issue with Sinon and/or Phantomjs, we can't.
var timeoutId = _globalWindow2['default'].setTimeout(fn, timeout);
var disposeFn = function disposeFn() {
this.clearTimeout(timeoutId);
};
disposeFn.guid = 'vjs-timeout-' + timeoutId;
this.on('dispose', disposeFn);
return timeoutId;
};
/**
* Clears a timeout and removes the associated dispose listener
*
* @param {Number} timeoutId The id of the timeout to clear
* @return {Number} Returns the timeout ID
* @method clearTimeout
*/
Component.prototype.clearTimeout = function clearTimeout(timeoutId) {
_globalWindow2['default'].clearTimeout(timeoutId);
var disposeFn = function disposeFn() {};
disposeFn.guid = 'vjs-timeout-' + timeoutId;
this.off('dispose', disposeFn);
return timeoutId;
};
/**
* Creates an interval and sets up disposal automatically.
*
* @param {Function} fn The function to run every N seconds.
* @param {Number} interval Number of ms to delay before executing specified function.
* @return {Number} Returns the interval ID
* @method setInterval
*/
Component.prototype.setInterval = function setInterval(fn, interval) {
fn = Fn.bind(this, fn);
var intervalId = _globalWindow2['default'].setInterval(fn, interval);
var disposeFn = function disposeFn() {
this.clearInterval(intervalId);
};
disposeFn.guid = 'vjs-interval-' + intervalId;
this.on('dispose', disposeFn);
return intervalId;
};
/**
* Clears an interval and removes the associated dispose listener
*
* @param {Number} intervalId The id of the interval to clear
* @return {Number} Returns the interval ID
* @method clearInterval
*/
Component.prototype.clearInterval = function clearInterval(intervalId) {
_globalWindow2['default'].clearInterval(intervalId);
var disposeFn = function disposeFn() {};
disposeFn.guid = 'vjs-interval-' + intervalId;
this.off('dispose', disposeFn);
return intervalId;
};
/**
* Registers a component
*
* @param {String} name Name of the component to register
* @param {Object} comp The component to register
* @static
* @method registerComponent
*/
Component.registerComponent = function registerComponent(name, comp) {
if (!Component.components_) {
Component.components_ = {};
}
Component.components_[name] = comp;
return comp;
};
/**
* Gets a component by name
*
* @param {String} name Name of the component to get
* @return {Component}
* @static
* @method getComponent
*/
Component.getComponent = function getComponent(name) {
if (Component.components_ && Component.components_[name]) {
return Component.components_[name];
}
if (_globalWindow2['default'] && _globalWindow2['default'].videojs && _globalWindow2['default'].videojs[name]) {
_utilsLogJs2['default'].warn('The ' + name + ' component was added to the videojs object when it should be registered using videojs.registerComponent(name, component)');
return _globalWindow2['default'].videojs[name];
}
};
/**
* Sets up the constructor using the supplied init method
* or uses the init of the parent object
*
* @param {Object} props An object of properties
* @static
* @deprecated
* @method extend
*/
Component.extend = function extend(props) {
props = props || {};
_utilsLogJs2['default'].warn('Component.extend({}) has been deprecated, use videojs.extends(Component, {}) instead');
// Set up the constructor using the supplied init method
// or using the init of the parent object
// Make sure to check the unobfuscated version for external libs
var init = props.init || props.init || this.prototype.init || this.prototype.init || function () {};
// In Resig's simple class inheritance (previously used) the constructor
// is a function that calls `this.init.apply(arguments)`
// However that would prevent us from using `ParentObject.call(this);`
// in a Child constructor because the `this` in `this.init`
// would still refer to the Child and cause an infinite loop.
// We would instead have to do
// `ParentObject.prototype.init.apply(this, arguments);`
// Bleh. We're not creating a _super() function, so it's good to keep
// the parent constructor reference simple.
var subObj = function subObj() {
init.apply(this, arguments);
};
// Inherit from this object's prototype
subObj.prototype = Object.create(this.prototype);
// Reset the constructor property for subObj otherwise
// instances of subObj would have the constructor of the parent Object
subObj.prototype.constructor = subObj;
// Make the class extendable
subObj.extend = Component.extend;
// Extend subObj's prototype with functions and other properties from props
for (var _name2 in props) {
if (props.hasOwnProperty(_name2)) {
subObj.prototype[_name2] = props[_name2];
}
}
return subObj;
};
return Component;
})();
Component.registerComponent('Component', Component);
exports['default'] = Component;
module.exports = exports['default'];
},{"./utils/dom.js":107,"./utils/events.js":108,"./utils/fn.js":109,"./utils/guid.js":111,"./utils/log.js":112,"./utils/merge-options.js":113,"./utils/to-title-case.js":116,"global/window":2,"object.assign":40}],49:[function(_dereq_,module,exports){
/**
* @file control-bar.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
// Required children
var _playToggleJs = _dereq_('./play-toggle.js');
var _playToggleJs2 = _interopRequireDefault(_playToggleJs);
var _timeControlsCurrentTimeDisplayJs = _dereq_('./time-controls/current-time-display.js');
var _timeControlsCurrentTimeDisplayJs2 = _interopRequireDefault(_timeControlsCurrentTimeDisplayJs);
var _timeControlsDurationDisplayJs = _dereq_('./time-controls/duration-display.js');
var _timeControlsDurationDisplayJs2 = _interopRequireDefault(_timeControlsDurationDisplayJs);
var _timeControlsTimeDividerJs = _dereq_('./time-controls/time-divider.js');
var _timeControlsTimeDividerJs2 = _interopRequireDefault(_timeControlsTimeDividerJs);
var _timeControlsRemainingTimeDisplayJs = _dereq_('./time-controls/remaining-time-display.js');
var _timeControlsRemainingTimeDisplayJs2 = _interopRequireDefault(_timeControlsRemainingTimeDisplayJs);
var _liveDisplayJs = _dereq_('./live-display.js');
var _liveDisplayJs2 = _interopRequireDefault(_liveDisplayJs);
var _progressControlProgressControlJs = _dereq_('./progress-control/progress-control.js');
var _progressControlProgressControlJs2 = _interopRequireDefault(_progressControlProgressControlJs);
var _fullscreenToggleJs = _dereq_('./fullscreen-toggle.js');
var _fullscreenToggleJs2 = _interopRequireDefault(_fullscreenToggleJs);
var _volumeControlVolumeControlJs = _dereq_('./volume-control/volume-control.js');
var _volumeControlVolumeControlJs2 = _interopRequireDefault(_volumeControlVolumeControlJs);
var _volumeMenuButtonJs = _dereq_('./volume-menu-button.js');
var _volumeMenuButtonJs2 = _interopRequireDefault(_volumeMenuButtonJs);
var _muteToggleJs = _dereq_('./mute-toggle.js');
var _muteToggleJs2 = _interopRequireDefault(_muteToggleJs);
var _textTrackControlsChaptersButtonJs = _dereq_('./text-track-controls/chapters-button.js');
var _textTrackControlsChaptersButtonJs2 = _interopRequireDefault(_textTrackControlsChaptersButtonJs);
var _textTrackControlsSubtitlesButtonJs = _dereq_('./text-track-controls/subtitles-button.js');
var _textTrackControlsSubtitlesButtonJs2 = _interopRequireDefault(_textTrackControlsSubtitlesButtonJs);
var _textTrackControlsCaptionsButtonJs = _dereq_('./text-track-controls/captions-button.js');
var _textTrackControlsCaptionsButtonJs2 = _interopRequireDefault(_textTrackControlsCaptionsButtonJs);
var _playbackRateMenuPlaybackRateMenuButtonJs = _dereq_('./playback-rate-menu/playback-rate-menu-button.js');
var _playbackRateMenuPlaybackRateMenuButtonJs2 = _interopRequireDefault(_playbackRateMenuPlaybackRateMenuButtonJs);
var _spacerControlsCustomControlSpacerJs = _dereq_('./spacer-controls/custom-control-spacer.js');
var _spacerControlsCustomControlSpacerJs2 = _interopRequireDefault(_spacerControlsCustomControlSpacerJs);
/**
* Container of main controls
*
* @extends Component
* @class ControlBar
*/
var ControlBar = (function (_Component) {
_inherits(ControlBar, _Component);
function ControlBar() {
_classCallCheck(this, ControlBar);
_Component.apply(this, arguments);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
ControlBar.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-control-bar'
});
};
return ControlBar;
})(_componentJs2['default']);
ControlBar.prototype.options_ = {
loadEvent: 'play',
children: ['playToggle', 'volumeMenuButton', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'muteToggle', 'volumeControl', 'chaptersButton', 'subtitlesButton', 'captionsButton', 'fullscreenToggle']
};
_componentJs2['default'].registerComponent('ControlBar', ControlBar);
exports['default'] = ControlBar;
module.exports = exports['default'];
},{"../component.js":48,"./fullscreen-toggle.js":50,"./live-display.js":51,"./mute-toggle.js":52,"./play-toggle.js":53,"./playback-rate-menu/playback-rate-menu-button.js":54,"./progress-control/progress-control.js":58,"./spacer-controls/custom-control-spacer.js":60,"./text-track-controls/captions-button.js":63,"./text-track-controls/chapters-button.js":64,"./text-track-controls/subtitles-button.js":67,"./time-controls/current-time-display.js":70,"./time-controls/duration-display.js":71,"./time-controls/remaining-time-display.js":72,"./time-controls/time-divider.js":73,"./volume-control/volume-control.js":75,"./volume-menu-button.js":77}],50:[function(_dereq_,module,exports){
/**
* @file fullscreen-toggle.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('../button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* Toggle fullscreen video
*
* @extends Button
* @class FullscreenToggle
*/
var FullscreenToggle = (function (_Button) {
_inherits(FullscreenToggle, _Button);
function FullscreenToggle() {
_classCallCheck(this, FullscreenToggle);
_Button.apply(this, arguments);
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
FullscreenToggle.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-fullscreen-control ' + _Button.prototype.buildCSSClass.call(this);
};
/**
* Handles click for full screen
*
* @method handleClick
*/
FullscreenToggle.prototype.handleClick = function handleClick() {
if (!this.player_.isFullscreen()) {
this.player_.requestFullscreen();
this.controlText('Non-Fullscreen');
} else {
this.player_.exitFullscreen();
this.controlText('Fullscreen');
}
};
return FullscreenToggle;
})(_buttonJs2['default']);
FullscreenToggle.prototype.controlText_ = 'Fullscreen';
_componentJs2['default'].registerComponent('FullscreenToggle', FullscreenToggle);
exports['default'] = FullscreenToggle;
module.exports = exports['default'];
},{"../button.js":47,"../component.js":48}],51:[function(_dereq_,module,exports){
/**
* @file live-display.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
/**
* Displays the live indicator
* TODO - Future make it click to snap to live
*
* @extends Component
* @class LiveDisplay
*/
var LiveDisplay = (function (_Component) {
_inherits(LiveDisplay, _Component);
function LiveDisplay() {
_classCallCheck(this, LiveDisplay);
_Component.apply(this, arguments);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
LiveDisplay.prototype.createEl = function createEl() {
var el = _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-live-control vjs-control'
});
this.contentEl_ = Dom.createEl('div', {
className: 'vjs-live-display',
innerHTML: '<span class="vjs-control-text">' + this.localize('Stream Type') + '</span>' + this.localize('LIVE'),
'aria-live': 'off'
});
el.appendChild(this.contentEl_);
return el;
};
return LiveDisplay;
})(_component2['default']);
_component2['default'].registerComponent('LiveDisplay', LiveDisplay);
exports['default'] = LiveDisplay;
module.exports = exports['default'];
},{"../component":48,"../utils/dom.js":107}],52:[function(_dereq_,module,exports){
/**
* @file mute-toggle.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _button = _dereq_('../button');
var _button2 = _interopRequireDefault(_button);
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
/**
* A button component for muting the audio
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Button
* @class MuteToggle
*/
var MuteToggle = (function (_Button) {
_inherits(MuteToggle, _Button);
function MuteToggle(player, options) {
_classCallCheck(this, MuteToggle);
_Button.call(this, player, options);
this.on(player, 'volumechange', this.update);
// hide mute toggle if the current tech doesn't support volume control
if (player.tech && player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
this.on(player, 'loadstart', function () {
this.update(); // We need to update the button to account for a default muted state.
if (player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
}
});
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
MuteToggle.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-mute-control ' + _Button.prototype.buildCSSClass.call(this);
};
/**
* Handle click on mute
*
* @method handleClick
*/
MuteToggle.prototype.handleClick = function handleClick() {
this.player_.muted(this.player_.muted() ? false : true);
};
/**
* Update volume
*
* @method update
*/
MuteToggle.prototype.update = function update() {
var vol = this.player_.volume(),
level = 3;
if (vol === 0 || this.player_.muted()) {
level = 0;
} else if (vol < 0.33) {
level = 1;
} else if (vol < 0.67) {
level = 2;
}
// Don't rewrite the button text if the actual text doesn't change.
// This causes unnecessary and confusing information for screen reader users.
// This check is needed because this function gets called every time the volume level is changed.
var toMute = this.player_.muted() ? 'Unmute' : 'Mute';
var localizedMute = this.localize(toMute);
if (this.controlText() !== localizedMute) {
this.controlText(localizedMute);
}
/* TODO improve muted icon classes */
for (var i = 0; i < 4; i++) {
Dom.removeElClass(this.el_, 'vjs-vol-' + i);
}
Dom.addElClass(this.el_, 'vjs-vol-' + level);
};
return MuteToggle;
})(_button2['default']);
MuteToggle.prototype.controlText_ = 'Mute';
_component2['default'].registerComponent('MuteToggle', MuteToggle);
exports['default'] = MuteToggle;
module.exports = exports['default'];
},{"../button":47,"../component":48,"../utils/dom.js":107}],53:[function(_dereq_,module,exports){
/**
* @file play-toggle.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('../button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* Button to toggle between play and pause
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Button
* @class PlayToggle
*/
var PlayToggle = (function (_Button) {
_inherits(PlayToggle, _Button);
function PlayToggle(player, options) {
_classCallCheck(this, PlayToggle);
_Button.call(this, player, options);
this.on(player, 'play', this.handlePlay);
this.on(player, 'pause', this.handlePause);
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
PlayToggle.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-play-control ' + _Button.prototype.buildCSSClass.call(this);
};
/**
* Handle click to toggle between play and pause
*
* @method handleClick
*/
PlayToggle.prototype.handleClick = function handleClick() {
if (this.player_.paused()) {
this.player_.play();
} else {
this.player_.pause();
}
};
/**
* Add the vjs-playing class to the element so it can change appearance
*
* @method handlePlay
*/
PlayToggle.prototype.handlePlay = function handlePlay() {
this.removeClass('vjs-paused');
this.addClass('vjs-playing');
this.controlText('Pause'); // change the button text to "Pause"
};
/**
* Add the vjs-paused class to the element so it can change appearance
*
* @method handlePause
*/
PlayToggle.prototype.handlePause = function handlePause() {
this.removeClass('vjs-playing');
this.addClass('vjs-paused');
this.controlText('Play'); // change the button text to "Play"
};
return PlayToggle;
})(_buttonJs2['default']);
PlayToggle.prototype.controlText_ = 'Play';
_componentJs2['default'].registerComponent('PlayToggle', PlayToggle);
exports['default'] = PlayToggle;
module.exports = exports['default'];
},{"../button.js":47,"../component.js":48}],54:[function(_dereq_,module,exports){
/**
* @file playback-rate-menu-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _menuMenuButtonJs = _dereq_('../../menu/menu-button.js');
var _menuMenuButtonJs2 = _interopRequireDefault(_menuMenuButtonJs);
var _menuMenuJs = _dereq_('../../menu/menu.js');
var _menuMenuJs2 = _interopRequireDefault(_menuMenuJs);
var _playbackRateMenuItemJs = _dereq_('./playback-rate-menu-item.js');
var _playbackRateMenuItemJs2 = _interopRequireDefault(_playbackRateMenuItemJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
/**
* The component for controlling the playback rate
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuButton
* @class PlaybackRateMenuButton
*/
var PlaybackRateMenuButton = (function (_MenuButton) {
_inherits(PlaybackRateMenuButton, _MenuButton);
function PlaybackRateMenuButton(player, options) {
_classCallCheck(this, PlaybackRateMenuButton);
_MenuButton.call(this, player, options);
this.updateVisibility();
this.updateLabel();
this.on(player, 'loadstart', this.updateVisibility);
this.on(player, 'ratechange', this.updateLabel);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
PlaybackRateMenuButton.prototype.createEl = function createEl() {
var el = _MenuButton.prototype.createEl.call(this);
this.labelEl_ = Dom.createEl('div', {
className: 'vjs-playback-rate-value',
innerHTML: 1.0
});
el.appendChild(this.labelEl_);
return el;
};
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
PlaybackRateMenuButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-playback-rate ' + _MenuButton.prototype.buildCSSClass.call(this);
};
/**
* Create the playback rate menu
*
* @return {Menu} Menu object populated with items
* @method createMenu
*/
PlaybackRateMenuButton.prototype.createMenu = function createMenu() {
var menu = new _menuMenuJs2['default'](this.player());
var rates = this.playbackRates();
if (rates) {
for (var i = rates.length - 1; i >= 0; i--) {
menu.addChild(new _playbackRateMenuItemJs2['default'](this.player(), { 'rate': rates[i] + 'x' }));
}
}
return menu;
};
/**
* Updates ARIA accessibility attributes
*
* @method updateARIAAttributes
*/
PlaybackRateMenuButton.prototype.updateARIAAttributes = function updateARIAAttributes() {
// Current playback rate
this.el().setAttribute('aria-valuenow', this.player().playbackRate());
};
/**
* Handle menu item click
*
* @method handleClick
*/
PlaybackRateMenuButton.prototype.handleClick = function handleClick() {
// select next rate option
var currentRate = this.player().playbackRate();
var rates = this.playbackRates();
// this will select first one if the last one currently selected
var newRate = rates[0];
for (var i = 0; i < rates.length; i++) {
if (rates[i] > currentRate) {
newRate = rates[i];
break;
}
}
this.player().playbackRate(newRate);
};
/**
* Get possible playback rates
*
* @return {Array} Possible playback rates
* @method playbackRates
*/
PlaybackRateMenuButton.prototype.playbackRates = function playbackRates() {
return this.options_['playbackRates'] || this.options_.playerOptions && this.options_.playerOptions['playbackRates'];
};
/**
* Get supported playback rates
*
* @return {Array} Supported playback rates
* @method playbackRateSupported
*/
PlaybackRateMenuButton.prototype.playbackRateSupported = function playbackRateSupported() {
return this.player().tech && this.player().tech['featuresPlaybackRate'] && this.playbackRates() && this.playbackRates().length > 0;
};
/**
* Hide playback rate controls when they're no playback rate options to select
*
* @method updateVisibility
*/
PlaybackRateMenuButton.prototype.updateVisibility = function updateVisibility() {
if (this.playbackRateSupported()) {
this.removeClass('vjs-hidden');
} else {
this.addClass('vjs-hidden');
}
};
/**
* Update button label when rate changed
*
* @method updateLabel
*/
PlaybackRateMenuButton.prototype.updateLabel = function updateLabel() {
if (this.playbackRateSupported()) {
this.labelEl_.innerHTML = this.player().playbackRate() + 'x';
}
};
return PlaybackRateMenuButton;
})(_menuMenuButtonJs2['default']);
PlaybackRateMenuButton.prototype.controlText_ = 'Playback Rate';
_componentJs2['default'].registerComponent('PlaybackRateMenuButton', PlaybackRateMenuButton);
exports['default'] = PlaybackRateMenuButton;
module.exports = exports['default'];
},{"../../component.js":48,"../../menu/menu-button.js":84,"../../menu/menu.js":86,"../../utils/dom.js":107,"./playback-rate-menu-item.js":55}],55:[function(_dereq_,module,exports){
/**
* @file playback-rate-menu-item.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _menuMenuItemJs = _dereq_('../../menu/menu-item.js');
var _menuMenuItemJs2 = _interopRequireDefault(_menuMenuItemJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* The specific menu item type for selecting a playback rate
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuItem
* @class PlaybackRateMenuItem
*/
var PlaybackRateMenuItem = (function (_MenuItem) {
_inherits(PlaybackRateMenuItem, _MenuItem);
function PlaybackRateMenuItem(player, options) {
_classCallCheck(this, PlaybackRateMenuItem);
var label = options['rate'];
var rate = parseFloat(label, 10);
// Modify options for parent MenuItem class's init.
options['label'] = label;
options['selected'] = rate === 1;
_MenuItem.call(this, player, options);
this.label = label;
this.rate = rate;
this.on(player, 'ratechange', this.update);
}
/**
* Handle click on menu item
*
* @method handleClick
*/
PlaybackRateMenuItem.prototype.handleClick = function handleClick() {
_MenuItem.prototype.handleClick.call(this);
this.player().playbackRate(this.rate);
};
/**
* Update playback rate with selected rate
*
* @method update
*/
PlaybackRateMenuItem.prototype.update = function update() {
this.selected(this.player().playbackRate() === this.rate);
};
return PlaybackRateMenuItem;
})(_menuMenuItemJs2['default']);
PlaybackRateMenuItem.prototype.contentElType = 'button';
_componentJs2['default'].registerComponent('PlaybackRateMenuItem', PlaybackRateMenuItem);
exports['default'] = PlaybackRateMenuItem;
module.exports = exports['default'];
},{"../../component.js":48,"../../menu/menu-item.js":85}],56:[function(_dereq_,module,exports){
/**
* @file load-progress-bar.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
/**
* Shows load progress
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class LoadProgressBar
*/
var LoadProgressBar = (function (_Component) {
_inherits(LoadProgressBar, _Component);
function LoadProgressBar(player, options) {
_classCallCheck(this, LoadProgressBar);
_Component.call(this, player, options);
this.on(player, 'progress', this.update);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
LoadProgressBar.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-load-progress',
innerHTML: '<span class="vjs-control-text"><span>' + this.localize('Loaded') + '</span>: 0%</span>'
});
};
/**
* Update progress bar
*
* @method update
*/
LoadProgressBar.prototype.update = function update() {
var buffered = this.player_.buffered();
var duration = this.player_.duration();
var bufferedEnd = this.player_.bufferedEnd();
var children = this.el_.children;
// get the percent width of a time compared to the total end
var percentify = function percentify(time, end) {
var percent = time / end || 0; // no NaN
return (percent >= 1 ? 1 : percent) * 100 + '%';
};
// update the width of the progress bar
this.el_.style.width = percentify(bufferedEnd, duration);
// add child elements to represent the individual buffered time ranges
for (var i = 0; i < buffered.length; i++) {
var start = buffered.start(i);
var end = buffered.end(i);
var part = children[i];
if (!part) {
part = this.el_.appendChild(Dom.createEl());
}
// set the percent based on the width of the progress bar (bufferedEnd)
part.style.left = percentify(start, bufferedEnd);
part.style.width = percentify(end - start, bufferedEnd);
}
// remove unused buffered range elements
for (var i = children.length; i > buffered.length; i--) {
this.el_.removeChild(children[i - 1]);
}
};
return LoadProgressBar;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('LoadProgressBar', LoadProgressBar);
exports['default'] = LoadProgressBar;
module.exports = exports['default'];
},{"../../component.js":48,"../../utils/dom.js":107}],57:[function(_dereq_,module,exports){
/**
* @file play-progress-bar.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
/**
* Shows play progress
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class PlayProgressBar
*/
var PlayProgressBar = (function (_Component) {
_inherits(PlayProgressBar, _Component);
function PlayProgressBar(player, options) {
_classCallCheck(this, PlayProgressBar);
_Component.call(this, player, options);
this.updateDataAttr();
this.on(player, 'timeupdate', this.updateDataAttr);
player.ready(Fn.bind(this, this.updateDataAttr));
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
PlayProgressBar.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-play-progress',
innerHTML: '<span class="vjs-control-text"><span>' + this.localize('Progress') + '</span>: 0%</span>'
});
};
PlayProgressBar.prototype.updateDataAttr = function updateDataAttr() {
var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
this.el_.setAttribute('data-current-time', _utilsFormatTimeJs2['default'](time, this.player_.duration()));
};
return PlayProgressBar;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('PlayProgressBar', PlayProgressBar);
exports['default'] = PlayProgressBar;
module.exports = exports['default'];
},{"../../component.js":48,"../../utils/fn.js":109,"../../utils/format-time.js":110}],58:[function(_dereq_,module,exports){
/**
* @file progress-control.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _seekBarJs = _dereq_('./seek-bar.js');
var _seekBarJs2 = _interopRequireDefault(_seekBarJs);
/**
* The Progress Control component contains the seek bar, load progress,
* and play progress
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class ProgressControl
*/
var ProgressControl = (function (_Component) {
_inherits(ProgressControl, _Component);
function ProgressControl() {
_classCallCheck(this, ProgressControl);
_Component.apply(this, arguments);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
ProgressControl.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-progress-control vjs-control'
});
};
return ProgressControl;
})(_componentJs2['default']);
ProgressControl.prototype.options_ = {
children: {
'seekBar': {}
}
};
_componentJs2['default'].registerComponent('ProgressControl', ProgressControl);
exports['default'] = ProgressControl;
module.exports = exports['default'];
},{"../../component.js":48,"./seek-bar.js":59}],59:[function(_dereq_,module,exports){
/**
* @file seek-bar.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _sliderSliderJs = _dereq_('../../slider/slider.js');
var _sliderSliderJs2 = _interopRequireDefault(_sliderSliderJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _loadProgressBarJs = _dereq_('./load-progress-bar.js');
var _loadProgressBarJs2 = _interopRequireDefault(_loadProgressBarJs);
var _playProgressBarJs = _dereq_('./play-progress-bar.js');
var _playProgressBarJs2 = _interopRequireDefault(_playProgressBarJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
/**
* Seek Bar and holder for the progress bars
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Slider
* @class SeekBar
*/
var SeekBar = (function (_Slider) {
_inherits(SeekBar, _Slider);
function SeekBar(player, options) {
_classCallCheck(this, SeekBar);
_Slider.call(this, player, options);
this.on(player, 'timeupdate', this.updateARIAAttributes);
player.ready(Fn.bind(this, this.updateARIAAttributes));
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
SeekBar.prototype.createEl = function createEl() {
return _Slider.prototype.createEl.call(this, 'div', {
className: 'vjs-progress-holder',
'aria-label': 'video progress bar'
});
};
/**
* Update ARIA accessibility attributes
*
* @method updateARIAAttributes
*/
SeekBar.prototype.updateARIAAttributes = function updateARIAAttributes() {
// Allows for smooth scrubbing, when player can't keep up.
var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
this.el_.setAttribute('aria-valuenow', (this.getPercent() * 100).toFixed(2)); // machine readable value of progress bar (percentage complete)
this.el_.setAttribute('aria-valuetext', _utilsFormatTimeJs2['default'](time, this.player_.duration())); // human readable value of progress bar (time complete)
};
/**
* Get percentage of video played
*
* @return {Number} Percentage played
* @method getPercent
*/
SeekBar.prototype.getPercent = function getPercent() {
var percent = this.player_.currentTime() / this.player_.duration();
return percent >= 1 ? 1 : percent;
};
/**
* Handle mouse down on seek bar
*
* @method handleMouseDown
*/
SeekBar.prototype.handleMouseDown = function handleMouseDown(event) {
_Slider.prototype.handleMouseDown.call(this, event);
this.player_.scrubbing(true);
this.videoWasPlaying = !this.player_.paused();
this.player_.pause();
};
/**
* Handle mouse move on seek bar
*
* @method handleMouseMove
*/
SeekBar.prototype.handleMouseMove = function handleMouseMove(event) {
var newTime = this.calculateDistance(event) * this.player_.duration();
// Don't let video end while scrubbing.
if (newTime === this.player_.duration()) {
newTime = newTime - 0.1;
}
// Set new time (tell player to seek to new time)
this.player_.currentTime(newTime);
};
/**
* Handle mouse up on seek bar
*
* @method handleMouseUp
*/
SeekBar.prototype.handleMouseUp = function handleMouseUp(event) {
_Slider.prototype.handleMouseUp.call(this, event);
this.player_.scrubbing(false);
if (this.videoWasPlaying) {
this.player_.play();
}
};
/**
* Move more quickly fast forward for keyboard-only users
*
* @method stepForward
*/
SeekBar.prototype.stepForward = function stepForward() {
this.player_.currentTime(this.player_.currentTime() + 5); // more quickly fast forward for keyboard-only users
};
/**
* Move more quickly rewind for keyboard-only users
*
* @method stepBack
*/
SeekBar.prototype.stepBack = function stepBack() {
this.player_.currentTime(this.player_.currentTime() - 5); // more quickly rewind for keyboard-only users
};
return SeekBar;
})(_sliderSliderJs2['default']);
SeekBar.prototype.options_ = {
children: {
'loadProgressBar': {},
'playProgressBar': {}
},
'barName': 'playProgressBar'
};
SeekBar.prototype.playerEvent = 'timeupdate';
_componentJs2['default'].registerComponent('SeekBar', SeekBar);
exports['default'] = SeekBar;
module.exports = exports['default'];
},{"../../component.js":48,"../../slider/slider.js":91,"../../utils/fn.js":109,"../../utils/format-time.js":110,"./load-progress-bar.js":56,"./play-progress-bar.js":57}],60:[function(_dereq_,module,exports){
/**
* @file custom-control-spacer.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _spacerJs = _dereq_('./spacer.js');
var _spacerJs2 = _interopRequireDefault(_spacerJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* Spacer specifically meant to be used as an insertion point for new plugins, etc.
*
* @extends Spacer
* @class CustomControlSpacer
*/
var CustomControlSpacer = (function (_Spacer) {
_inherits(CustomControlSpacer, _Spacer);
function CustomControlSpacer() {
_classCallCheck(this, CustomControlSpacer);
_Spacer.apply(this, arguments);
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
CustomControlSpacer.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-custom-control-spacer ' + _Spacer.prototype.buildCSSClass.call(this);
};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
CustomControlSpacer.prototype.createEl = function createEl() {
return _Spacer.prototype.createEl.call(this, {
className: this.buildCSSClass()
});
};
return CustomControlSpacer;
})(_spacerJs2['default']);
_componentJs2['default'].registerComponent('CustomControlSpacer', CustomControlSpacer);
exports['default'] = CustomControlSpacer;
module.exports = exports['default'];
},{"../../component.js":48,"./spacer.js":61}],61:[function(_dereq_,module,exports){
/**
* @file spacer.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* Just an empty spacer element that can be used as an append point for plugins, etc.
* Also can be used to create space between elements when necessary.
*
* @extends Component
* @class Spacer
*/
var Spacer = (function (_Component) {
_inherits(Spacer, _Component);
function Spacer() {
_classCallCheck(this, Spacer);
_Component.apply(this, arguments);
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
Spacer.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-spacer ' + _Component.prototype.buildCSSClass.call(this);
};
/**
* Create the component's DOM element
*
* @param {Object} props An object of properties
* @return {Element}
* @method createEl
*/
Spacer.prototype.createEl = function createEl(props) {
return _Component.prototype.createEl.call(this, 'div', {
className: this.buildCSSClass()
});
};
return Spacer;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('Spacer', Spacer);
exports['default'] = Spacer;
module.exports = exports['default'];
},{"../../component.js":48}],62:[function(_dereq_,module,exports){
/**
* @file caption-settings-menu-item.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _textTrackMenuItemJs = _dereq_('./text-track-menu-item.js');
var _textTrackMenuItemJs2 = _interopRequireDefault(_textTrackMenuItemJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* The menu item for caption track settings menu
*
* @param {Player|Object} player
* @param {Object=} options
* @extends TextTrackMenuItem
* @class CaptionSettingsMenuItem
*/
var CaptionSettingsMenuItem = (function (_TextTrackMenuItem) {
_inherits(CaptionSettingsMenuItem, _TextTrackMenuItem);
function CaptionSettingsMenuItem(player, options) {
_classCallCheck(this, CaptionSettingsMenuItem);
options['track'] = {
'kind': options['kind'],
'player': player,
'label': options['kind'] + ' settings',
'default': false,
mode: 'disabled'
};
_TextTrackMenuItem.call(this, player, options);
this.addClass('vjs-texttrack-settings');
}
/**
* Handle click on menu item
*
* @method handleClick
*/
CaptionSettingsMenuItem.prototype.handleClick = function handleClick() {
this.player().getChild('textTrackSettings').show();
};
return CaptionSettingsMenuItem;
})(_textTrackMenuItemJs2['default']);
_componentJs2['default'].registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem);
exports['default'] = CaptionSettingsMenuItem;
module.exports = exports['default'];
},{"../../component.js":48,"./text-track-menu-item.js":69}],63:[function(_dereq_,module,exports){
/**
* @file captions-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _textTrackButtonJs = _dereq_('./text-track-button.js');
var _textTrackButtonJs2 = _interopRequireDefault(_textTrackButtonJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _captionSettingsMenuItemJs = _dereq_('./caption-settings-menu-item.js');
var _captionSettingsMenuItemJs2 = _interopRequireDefault(_captionSettingsMenuItemJs);
/**
* The button component for toggling and selecting captions
*
* @param {Object} player Player object
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends TextTrackButton
* @class CaptionsButton
*/
var CaptionsButton = (function (_TextTrackButton) {
_inherits(CaptionsButton, _TextTrackButton);
function CaptionsButton(player, options, ready) {
_classCallCheck(this, CaptionsButton);
_TextTrackButton.call(this, player, options, ready);
this.el_.setAttribute('aria-label', 'Captions Menu');
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
CaptionsButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-captions-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
};
/**
* Update caption menu items
*
* @method update
*/
CaptionsButton.prototype.update = function update() {
var threshold = 2;
_TextTrackButton.prototype.update.call(this);
// if native, then threshold is 1 because no settings button
if (this.player().tech && this.player().tech['featuresNativeTextTracks']) {
threshold = 1;
}
if (this.items && this.items.length > threshold) {
this.show();
} else {
this.hide();
}
};
/**
* Create caption menu items
*
* @return {Array} Array of menu items
* @method createItems
*/
CaptionsButton.prototype.createItems = function createItems() {
var items = [];
if (!(this.player().tech && this.player().tech['featuresNativeTextTracks'])) {
items.push(new _captionSettingsMenuItemJs2['default'](this.player_, { 'kind': this.kind_ }));
}
return _TextTrackButton.prototype.createItems.call(this, items);
};
return CaptionsButton;
})(_textTrackButtonJs2['default']);
CaptionsButton.prototype.kind_ = 'captions';
CaptionsButton.prototype.controlText_ = 'Captions';
_componentJs2['default'].registerComponent('CaptionsButton', CaptionsButton);
exports['default'] = CaptionsButton;
module.exports = exports['default'];
},{"../../component.js":48,"./caption-settings-menu-item.js":62,"./text-track-button.js":68}],64:[function(_dereq_,module,exports){
/**
* @file chapters-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _textTrackButtonJs = _dereq_('./text-track-button.js');
var _textTrackButtonJs2 = _interopRequireDefault(_textTrackButtonJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _textTrackMenuItemJs = _dereq_('./text-track-menu-item.js');
var _textTrackMenuItemJs2 = _interopRequireDefault(_textTrackMenuItemJs);
var _chaptersTrackMenuItemJs = _dereq_('./chapters-track-menu-item.js');
var _chaptersTrackMenuItemJs2 = _interopRequireDefault(_chaptersTrackMenuItemJs);
var _menuMenuJs = _dereq_('../../menu/menu.js');
var _menuMenuJs2 = _interopRequireDefault(_menuMenuJs);
var _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsToTitleCaseJs = _dereq_('../../utils/to-title-case.js');
var _utilsToTitleCaseJs2 = _interopRequireDefault(_utilsToTitleCaseJs);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
/**
* The button component for toggling and selecting chapters
* Chapters act much differently than other text tracks
* Cues are navigation vs. other tracks of alternative languages
*
* @param {Object} player Player object
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends TextTrackButton
* @class ChaptersButton
*/
var ChaptersButton = (function (_TextTrackButton) {
_inherits(ChaptersButton, _TextTrackButton);
function ChaptersButton(player, options, ready) {
_classCallCheck(this, ChaptersButton);
_TextTrackButton.call(this, player, options, ready);
this.el_.setAttribute('aria-label', 'Chapters Menu');
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
ChaptersButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-chapters-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
};
/**
* Create a menu item for each text track
*
* @return {Array} Array of menu items
* @method createItems
*/
ChaptersButton.prototype.createItems = function createItems() {
var items = [];
var tracks = this.player_.textTracks();
if (!tracks) {
return items;
}
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
if (track['kind'] === this.kind_) {
items.push(new _textTrackMenuItemJs2['default'](this.player_, {
'track': track
}));
}
}
return items;
};
/**
* Create menu from chapter buttons
*
* @return {Menu} Menu of chapter buttons
* @method createMenu
*/
ChaptersButton.prototype.createMenu = function createMenu() {
var tracks = this.player_.textTracks() || [];
var chaptersTrack = undefined;
var items = this.items = [];
for (var i = 0, l = tracks.length; i < l; i++) {
var track = tracks[i];
if (track['kind'] === this.kind_) {
if (!track.cues) {
track['mode'] = 'hidden';
/* jshint loopfunc:true */
// TODO see if we can figure out a better way of doing this https://github.com/videojs/video.js/issues/1864
_globalWindow2['default'].setTimeout(Fn.bind(this, function () {
this.createMenu();
}), 100);
/* jshint loopfunc:false */
} else {
chaptersTrack = track;
break;
}
}
}
var menu = this.menu;
if (menu === undefined) {
menu = new _menuMenuJs2['default'](this.player_);
menu.contentEl().appendChild(Dom.createEl('li', {
className: 'vjs-menu-title',
innerHTML: _utilsToTitleCaseJs2['default'](this.kind_),
tabIndex: -1
}));
}
if (chaptersTrack) {
var cues = chaptersTrack['cues'],
cue = undefined;
for (var i = 0, l = cues.length; i < l; i++) {
cue = cues[i];
var mi = new _chaptersTrackMenuItemJs2['default'](this.player_, {
'track': chaptersTrack,
'cue': cue
});
items.push(mi);
menu.addChild(mi);
}
this.addChild(menu);
}
if (this.items.length > 0) {
this.show();
}
return menu;
};
return ChaptersButton;
})(_textTrackButtonJs2['default']);
ChaptersButton.prototype.kind_ = 'chapters';
ChaptersButton.prototype.controlText_ = 'Chapters';
_componentJs2['default'].registerComponent('ChaptersButton', ChaptersButton);
exports['default'] = ChaptersButton;
module.exports = exports['default'];
},{"../../component.js":48,"../../menu/menu.js":86,"../../utils/dom.js":107,"../../utils/fn.js":109,"../../utils/to-title-case.js":116,"./chapters-track-menu-item.js":65,"./text-track-button.js":68,"./text-track-menu-item.js":69,"global/window":2}],65:[function(_dereq_,module,exports){
/**
* @file chapters-track-menu-item.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _menuMenuItemJs = _dereq_('../../menu/menu-item.js');
var _menuMenuItemJs2 = _interopRequireDefault(_menuMenuItemJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
/**
* The chapter track menu item
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuItem
* @class ChaptersTrackMenuItem
*/
var ChaptersTrackMenuItem = (function (_MenuItem) {
_inherits(ChaptersTrackMenuItem, _MenuItem);
function ChaptersTrackMenuItem(player, options) {
_classCallCheck(this, ChaptersTrackMenuItem);
var track = options['track'];
var cue = options['cue'];
var currentTime = player.currentTime();
// Modify options for parent MenuItem class's init.
options['label'] = cue.text;
options['selected'] = cue['startTime'] <= currentTime && currentTime < cue['endTime'];
_MenuItem.call(this, player, options);
this.track = track;
this.cue = cue;
track.addEventListener('cuechange', Fn.bind(this, this.update));
}
/**
* Handle click on menu item
*
* @method handleClick
*/
ChaptersTrackMenuItem.prototype.handleClick = function handleClick() {
_MenuItem.prototype.handleClick.call(this);
this.player_.currentTime(this.cue.startTime);
this.update(this.cue.startTime);
};
/**
* Update chapter menu item
*
* @method update
*/
ChaptersTrackMenuItem.prototype.update = function update() {
var cue = this.cue;
var currentTime = this.player_.currentTime();
// vjs.log(currentTime, cue.startTime);
this.selected(cue['startTime'] <= currentTime && currentTime < cue['endTime']);
};
return ChaptersTrackMenuItem;
})(_menuMenuItemJs2['default']);
_componentJs2['default'].registerComponent('ChaptersTrackMenuItem', ChaptersTrackMenuItem);
exports['default'] = ChaptersTrackMenuItem;
module.exports = exports['default'];
},{"../../component.js":48,"../../menu/menu-item.js":85,"../../utils/fn.js":109}],66:[function(_dereq_,module,exports){
/**
* @file off-text-track-menu-item.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _textTrackMenuItemJs = _dereq_('./text-track-menu-item.js');
var _textTrackMenuItemJs2 = _interopRequireDefault(_textTrackMenuItemJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* A special menu item for turning of a specific type of text track
*
* @param {Player|Object} player
* @param {Object=} options
* @extends TextTrackMenuItem
* @class OffTextTrackMenuItem
*/
var OffTextTrackMenuItem = (function (_TextTrackMenuItem) {
_inherits(OffTextTrackMenuItem, _TextTrackMenuItem);
function OffTextTrackMenuItem(player, options) {
_classCallCheck(this, OffTextTrackMenuItem);
// Create pseudo track info
// Requires options['kind']
options['track'] = {
'kind': options['kind'],
'player': player,
'label': options['kind'] + ' off',
'default': false,
'mode': 'disabled'
};
_TextTrackMenuItem.call(this, player, options);
this.selected(true);
}
/**
* Handle text track change
*
* @param {Object} event Event object
* @method handleTracksChange
*/
OffTextTrackMenuItem.prototype.handleTracksChange = function handleTracksChange(event) {
var tracks = this.player().textTracks();
var selected = true;
for (var i = 0, l = tracks.length; i < l; i++) {
var track = tracks[i];
if (track['kind'] === this.track['kind'] && track['mode'] === 'showing') {
selected = false;
break;
}
}
this.selected(selected);
};
return OffTextTrackMenuItem;
})(_textTrackMenuItemJs2['default']);
_componentJs2['default'].registerComponent('OffTextTrackMenuItem', OffTextTrackMenuItem);
exports['default'] = OffTextTrackMenuItem;
module.exports = exports['default'];
},{"../../component.js":48,"./text-track-menu-item.js":69}],67:[function(_dereq_,module,exports){
/**
* @file subtitles-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _textTrackButtonJs = _dereq_('./text-track-button.js');
var _textTrackButtonJs2 = _interopRequireDefault(_textTrackButtonJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* The button component for toggling and selecting subtitles
*
* @param {Object} player Player object
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends TextTrackButton
* @class SubtitlesButton
*/
var SubtitlesButton = (function (_TextTrackButton) {
_inherits(SubtitlesButton, _TextTrackButton);
function SubtitlesButton(player, options, ready) {
_classCallCheck(this, SubtitlesButton);
_TextTrackButton.call(this, player, options, ready);
this.el_.setAttribute('aria-label', 'Subtitles Menu');
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
SubtitlesButton.prototype.buildCSSClass = function buildCSSClass() {
return 'vjs-subtitles-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
};
return SubtitlesButton;
})(_textTrackButtonJs2['default']);
SubtitlesButton.prototype.kind_ = 'subtitles';
SubtitlesButton.prototype.controlText_ = 'Subtitles';
_componentJs2['default'].registerComponent('SubtitlesButton', SubtitlesButton);
exports['default'] = SubtitlesButton;
module.exports = exports['default'];
},{"../../component.js":48,"./text-track-button.js":68}],68:[function(_dereq_,module,exports){
/**
* @file text-track-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _menuMenuButtonJs = _dereq_('../../menu/menu-button.js');
var _menuMenuButtonJs2 = _interopRequireDefault(_menuMenuButtonJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _textTrackMenuItemJs = _dereq_('./text-track-menu-item.js');
var _textTrackMenuItemJs2 = _interopRequireDefault(_textTrackMenuItemJs);
var _offTextTrackMenuItemJs = _dereq_('./off-text-track-menu-item.js');
var _offTextTrackMenuItemJs2 = _interopRequireDefault(_offTextTrackMenuItemJs);
/**
* The base class for buttons that toggle specific text track types (e.g. subtitles)
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuButton
* @class TextTrackButton
*/
var TextTrackButton = (function (_MenuButton) {
_inherits(TextTrackButton, _MenuButton);
function TextTrackButton(player, options) {
_classCallCheck(this, TextTrackButton);
_MenuButton.call(this, player, options);
var tracks = this.player_.textTracks();
if (this.items.length <= 1) {
this.hide();
}
if (!tracks) {
return;
}
var updateHandler = Fn.bind(this, this.update);
tracks.addEventListener('removetrack', updateHandler);
tracks.addEventListener('addtrack', updateHandler);
this.player_.on('dispose', function () {
tracks.removeEventListener('removetrack', updateHandler);
tracks.removeEventListener('addtrack', updateHandler);
});
}
// Create a menu item for each text track
TextTrackButton.prototype.createItems = function createItems() {
var items = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
// Add an OFF menu item to turn all tracks off
items.push(new _offTextTrackMenuItemJs2['default'](this.player_, { 'kind': this.kind_ }));
var tracks = this.player_.textTracks();
if (!tracks) {
return items;
}
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
// only add tracks that are of the appropriate kind and have a label
if (track['kind'] === this.kind_) {
items.push(new _textTrackMenuItemJs2['default'](this.player_, {
'track': track
}));
}
}
return items;
};
return TextTrackButton;
})(_menuMenuButtonJs2['default']);
_componentJs2['default'].registerComponent('TextTrackButton', TextTrackButton);
exports['default'] = TextTrackButton;
module.exports = exports['default'];
},{"../../component.js":48,"../../menu/menu-button.js":84,"../../utils/fn.js":109,"./off-text-track-menu-item.js":66,"./text-track-menu-item.js":69}],69:[function(_dereq_,module,exports){
/**
* @file text-track-menu-item.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _menuMenuItemJs = _dereq_('../../menu/menu-item.js');
var _menuMenuItemJs2 = _interopRequireDefault(_menuMenuItemJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* The specific menu item type for selecting a language within a text track kind
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuItem
* @class TextTrackMenuItem
*/
var TextTrackMenuItem = (function (_MenuItem) {
_inherits(TextTrackMenuItem, _MenuItem);
function TextTrackMenuItem(player, options) {
var _this = this;
_classCallCheck(this, TextTrackMenuItem);
var track = options['track'];
var tracks = player.textTracks();
// Modify options for parent MenuItem class's init.
options['label'] = track['label'] || track['language'] || 'Unknown';
options['selected'] = track['default'] || track['mode'] === 'showing';
_MenuItem.call(this, player, options);
this.track = track;
if (tracks) {
(function () {
var changeHandler = Fn.bind(_this, _this.handleTracksChange);
tracks.addEventListener('change', changeHandler);
_this.on('dispose', function () {
tracks.removeEventListener('change', changeHandler);
});
})();
}
// iOS7 doesn't dispatch change events to TextTrackLists when an
// associated track's mode changes. Without something like
// Object.observe() (also not present on iOS7), it's not
// possible to detect changes to the mode attribute and polyfill
// the change event. As a poor substitute, we manually dispatch
// change events whenever the controls modify the mode.
if (tracks && tracks.onchange === undefined) {
(function () {
var event = undefined;
_this.on(['tap', 'click'], function () {
if (typeof _globalWindow2['default'].Event !== 'object') {
// Android 2.3 throws an Illegal Constructor error for window.Event
try {
event = new _globalWindow2['default'].Event('change');
} catch (err) {}
}
if (!event) {
event = _globalDocument2['default'].createEvent('Event');
event.initEvent('change', true, true);
}
tracks.dispatchEvent(event);
});
})();
}
}
/**
* Handle click on text track
*
* @method handleClick
*/
TextTrackMenuItem.prototype.handleClick = function handleClick(event) {
var kind = this.track['kind'];
var tracks = this.player_.textTracks();
_MenuItem.prototype.handleClick.call(this, event);
if (!tracks) return;
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
if (track['kind'] !== kind) {
continue;
}
if (track === this.track) {
track['mode'] = 'showing';
} else {
track['mode'] = 'disabled';
}
}
};
/**
* Handle text track change
*
* @method handleTracksChange
*/
TextTrackMenuItem.prototype.handleTracksChange = function handleTracksChange(event) {
this.selected(this.track['mode'] === 'showing');
};
return TextTrackMenuItem;
})(_menuMenuItemJs2['default']);
_componentJs2['default'].registerComponent('TextTrackMenuItem', TextTrackMenuItem);
exports['default'] = TextTrackMenuItem;
module.exports = exports['default'];
},{"../../component.js":48,"../../menu/menu-item.js":85,"../../utils/fn.js":109,"global/document":1,"global/window":2}],70:[function(_dereq_,module,exports){
/**
* @file current-time-display.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
/**
* Displays the current time
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class CurrentTimeDisplay
*/
var CurrentTimeDisplay = (function (_Component) {
_inherits(CurrentTimeDisplay, _Component);
function CurrentTimeDisplay(player, options) {
_classCallCheck(this, CurrentTimeDisplay);
_Component.call(this, player, options);
this.on(player, 'timeupdate', this.updateContent);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
CurrentTimeDisplay.prototype.createEl = function createEl() {
var el = _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-current-time vjs-time-control vjs-control'
});
this.contentEl_ = Dom.createEl('div', {
className: 'vjs-current-time-display',
innerHTML: '<span class="vjs-control-text">Current Time </span>' + '0:00', // label the current time for screen reader users
'aria-live': 'off' // tell screen readers not to automatically read the time as it changes
});
el.appendChild(this.contentEl_);
return el;
};
/**
* Update current time display
*
* @method updateContent
*/
CurrentTimeDisplay.prototype.updateContent = function updateContent() {
// Allows for smooth scrubbing, when player can't keep up.
var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
var localizedText = this.localize('Current Time');
var formattedTime = _utilsFormatTimeJs2['default'](time, this.player_.duration());
this.contentEl_.innerHTML = '<span class="vjs-control-text">' + localizedText + '</span> ' + formattedTime;
};
return CurrentTimeDisplay;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('CurrentTimeDisplay', CurrentTimeDisplay);
exports['default'] = CurrentTimeDisplay;
module.exports = exports['default'];
},{"../../component.js":48,"../../utils/dom.js":107,"../../utils/format-time.js":110}],71:[function(_dereq_,module,exports){
/**
* @file duration-display.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
/**
* Displays the duration
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class DurationDisplay
*/
var DurationDisplay = (function (_Component) {
_inherits(DurationDisplay, _Component);
function DurationDisplay(player, options) {
_classCallCheck(this, DurationDisplay);
_Component.call(this, player, options);
// this might need to be changed to 'durationchange' instead of 'timeupdate' eventually,
// however the durationchange event fires before this.player_.duration() is set,
// so the value cannot be written out using this method.
// Once the order of durationchange and this.player_.duration() being set is figured out,
// this can be updated.
this.on(player, 'timeupdate', this.updateContent);
this.on(player, 'loadedmetadata', this.updateContent);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
DurationDisplay.prototype.createEl = function createEl() {
var el = _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-duration vjs-time-control vjs-control'
});
this.contentEl_ = Dom.createEl('div', {
className: 'vjs-duration-display',
innerHTML: '<span class="vjs-control-text">' + this.localize('Duration Time') + '</span> 0:00', // label the duration time for screen reader users
'aria-live': 'off' // tell screen readers not to automatically read the time as it changes
});
el.appendChild(this.contentEl_);
return el;
};
/**
* Update duration time display
*
* @method updateContent
*/
DurationDisplay.prototype.updateContent = function updateContent() {
var duration = this.player_.duration();
if (duration) {
var localizedText = this.localize('Duration Time');
var formattedTime = _utilsFormatTimeJs2['default'](duration);
this.contentEl_.innerHTML = '<span class="vjs-control-text">' + localizedText + '</span> ' + formattedTime; // label the duration time for screen reader users
}
};
return DurationDisplay;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('DurationDisplay', DurationDisplay);
exports['default'] = DurationDisplay;
module.exports = exports['default'];
},{"../../component.js":48,"../../utils/dom.js":107,"../../utils/format-time.js":110}],72:[function(_dereq_,module,exports){
/**
* @file remaining-time-display.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFormatTimeJs = _dereq_('../../utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
/**
* Displays the time left in the video
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class RemainingTimeDisplay
*/
var RemainingTimeDisplay = (function (_Component) {
_inherits(RemainingTimeDisplay, _Component);
function RemainingTimeDisplay(player, options) {
_classCallCheck(this, RemainingTimeDisplay);
_Component.call(this, player, options);
this.on(player, 'timeupdate', this.updateContent);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
RemainingTimeDisplay.prototype.createEl = function createEl() {
var el = _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-remaining-time vjs-time-control vjs-control'
});
this.contentEl_ = Dom.createEl('div', {
className: 'vjs-remaining-time-display',
innerHTML: '<span class="vjs-control-text">' + this.localize('Remaining Time') + '</span> -0:00', // label the remaining time for screen reader users
'aria-live': 'off' // tell screen readers not to automatically read the time as it changes
});
el.appendChild(this.contentEl_);
return el;
};
/**
* Update remaining time display
*
* @method updateContent
*/
RemainingTimeDisplay.prototype.updateContent = function updateContent() {
if (this.player_.duration()) {
var localizedText = this.localize('Remaining Time');
var formattedTime = _utilsFormatTimeJs2['default'](this.player_.remainingTime());
this.contentEl_.innerHTML = '<span class="vjs-control-text">' + localizedText + '</span> -' + formattedTime;
}
// Allows for smooth scrubbing, when player can't keep up.
// var time = (this.player_.scrubbing()) ? this.player_.getCache().currentTime : this.player_.currentTime();
// this.contentEl_.innerHTML = vjs.formatTime(time, this.player_.duration());
};
return RemainingTimeDisplay;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('RemainingTimeDisplay', RemainingTimeDisplay);
exports['default'] = RemainingTimeDisplay;
module.exports = exports['default'];
},{"../../component.js":48,"../../utils/dom.js":107,"../../utils/format-time.js":110}],73:[function(_dereq_,module,exports){
/**
* @file time-divider.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* The separator between the current time and duration.
* Can be hidden if it's not needed in the design.
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class TimeDivider
*/
var TimeDivider = (function (_Component) {
_inherits(TimeDivider, _Component);
function TimeDivider() {
_classCallCheck(this, TimeDivider);
_Component.apply(this, arguments);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
TimeDivider.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-time-control vjs-time-divider',
innerHTML: '<div><span>/</span></div>'
});
};
return TimeDivider;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('TimeDivider', TimeDivider);
exports['default'] = TimeDivider;
module.exports = exports['default'];
},{"../../component.js":48}],74:[function(_dereq_,module,exports){
/**
* @file volume-bar.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _sliderSliderJs = _dereq_('../../slider/slider.js');
var _sliderSliderJs2 = _interopRequireDefault(_sliderSliderJs);
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('../../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
// Required children
var _volumeLevelJs = _dereq_('./volume-level.js');
var _volumeLevelJs2 = _interopRequireDefault(_volumeLevelJs);
/**
* The bar that contains the volume level and can be clicked on to adjust the level
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Slider
* @class VolumeBar
*/
var VolumeBar = (function (_Slider) {
_inherits(VolumeBar, _Slider);
function VolumeBar(player, options) {
_classCallCheck(this, VolumeBar);
_Slider.call(this, player, options);
this.on(player, 'volumechange', this.updateARIAAttributes);
player.ready(Fn.bind(this, this.updateARIAAttributes));
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
VolumeBar.prototype.createEl = function createEl() {
return _Slider.prototype.createEl.call(this, 'div', {
className: 'vjs-volume-bar',
'aria-label': 'volume level'
});
};
/**
* Handle mouse move on volume bar
*
* @method handleMouseMove
*/
VolumeBar.prototype.handleMouseMove = function handleMouseMove(event) {
if (this.player_.muted()) {
this.player_.muted(false);
}
this.player_.volume(this.calculateDistance(event));
};
/**
* Get percent of volume level
*
* @retun {Number} Volume level percent
* @method getPercent
*/
VolumeBar.prototype.getPercent = function getPercent() {
if (this.player_.muted()) {
return 0;
} else {
return this.player_.volume();
}
};
/**
* Increase volume level for keyboard users
*
* @method stepForward
*/
VolumeBar.prototype.stepForward = function stepForward() {
this.player_.volume(this.player_.volume() + 0.1);
};
/**
* Decrease volume level for keyboard users
*
* @method stepBack
*/
VolumeBar.prototype.stepBack = function stepBack() {
this.player_.volume(this.player_.volume() - 0.1);
};
/**
* Update ARIA accessibility attributes
*
* @method updateARIAAttributes
*/
VolumeBar.prototype.updateARIAAttributes = function updateARIAAttributes() {
// Current value of volume bar as a percentage
var volume = (this.player_.volume() * 100).toFixed(2);
this.el_.setAttribute('aria-valuenow', volume);
this.el_.setAttribute('aria-valuetext', volume + '%');
};
return VolumeBar;
})(_sliderSliderJs2['default']);
VolumeBar.prototype.options_ = {
children: {
'volumeLevel': {}
},
'barName': 'volumeLevel'
};
VolumeBar.prototype.playerEvent = 'volumechange';
_componentJs2['default'].registerComponent('VolumeBar', VolumeBar);
exports['default'] = VolumeBar;
module.exports = exports['default'];
},{"../../component.js":48,"../../slider/slider.js":91,"../../utils/fn.js":109,"./volume-level.js":76}],75:[function(_dereq_,module,exports){
/**
* @file volume-control.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
// Required children
var _volumeBarJs = _dereq_('./volume-bar.js');
var _volumeBarJs2 = _interopRequireDefault(_volumeBarJs);
/**
* The component for controlling the volume level
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class VolumeControl
*/
var VolumeControl = (function (_Component) {
_inherits(VolumeControl, _Component);
function VolumeControl(player, options) {
_classCallCheck(this, VolumeControl);
_Component.call(this, player, options);
// hide volume controls when they're not supported by the current tech
if (player.tech && player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
this.on(player, 'loadstart', function () {
if (player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
}
});
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
VolumeControl.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-volume-control vjs-control'
});
};
return VolumeControl;
})(_componentJs2['default']);
VolumeControl.prototype.options_ = {
children: {
'volumeBar': {}
}
};
_componentJs2['default'].registerComponent('VolumeControl', VolumeControl);
exports['default'] = VolumeControl;
module.exports = exports['default'];
},{"../../component.js":48,"./volume-bar.js":74}],76:[function(_dereq_,module,exports){
/**
* @file volume-level.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
/**
* Shows volume level
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class VolumeLevel
*/
var VolumeLevel = (function (_Component) {
_inherits(VolumeLevel, _Component);
function VolumeLevel() {
_classCallCheck(this, VolumeLevel);
_Component.apply(this, arguments);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
VolumeLevel.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-volume-level',
innerHTML: '<span class="vjs-control-text"></span>'
});
};
return VolumeLevel;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('VolumeLevel', VolumeLevel);
exports['default'] = VolumeLevel;
module.exports = exports['default'];
},{"../../component.js":48}],77:[function(_dereq_,module,exports){
/**
* @file volume-menu-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('../button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _menuMenuJs = _dereq_('../menu/menu.js');
var _menuMenuJs2 = _interopRequireDefault(_menuMenuJs);
var _menuMenuButtonJs = _dereq_('../menu/menu-button.js');
var _menuMenuButtonJs2 = _interopRequireDefault(_menuMenuButtonJs);
var _muteToggleJs = _dereq_('./mute-toggle.js');
var _muteToggleJs2 = _interopRequireDefault(_muteToggleJs);
var _volumeControlVolumeBarJs = _dereq_('./volume-control/volume-bar.js');
var _volumeControlVolumeBarJs2 = _interopRequireDefault(_volumeControlVolumeBarJs);
/**
* Button for volume menu
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuButton
* @class VolumeMenuButton
*/
var VolumeMenuButton = (function (_MenuButton) {
_inherits(VolumeMenuButton, _MenuButton);
function VolumeMenuButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, VolumeMenuButton);
// If the vertical option isn't passed at all, default to true.
if (options.vertical === undefined) {
// If an inline volumeMenuButton is used, we should default to using a horizontal
// slider for obvious reasons.
if (options.inline) {
options.vertical = false;
} else {
options.vertical = true;
}
}
// The vertical option needs to be set on the volumeBar as well, since that will
// need to be passed along to the VolumeBar constructor
options.volumeBar = options.volumeBar || {};
options.volumeBar.vertical = !!options.vertical;
_MenuButton.call(this, player, options);
// Same listeners as MuteToggle
this.on(player, 'volumechange', this.volumeUpdate);
this.on(player, 'loadstart', this.volumeUpdate);
// hide mute toggle if the current tech doesn't support volume control
if (player.tech && player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
}
this.on(player, 'loadstart', function () {
if (player.tech['featuresVolumeControl'] === false) {
this.addClass('vjs-hidden');
} else {
this.removeClass('vjs-hidden');
}
});
this.addClass('vjs-menu-button');
}
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
VolumeMenuButton.prototype.buildCSSClass = function buildCSSClass() {
var orientationClass = '';
if (!!this.options_.vertical) {
orientationClass = 'vjs-volume-menu-button-vertical';
} else {
orientationClass = 'vjs-volume-menu-button-horizontal';
}
return 'vjs-volume-menu-button ' + _MenuButton.prototype.buildCSSClass.call(this) + ' ' + orientationClass;
};
/**
* Allow sub components to stack CSS class names
*
* @return {Menu} The volume menu button
* @method createMenu
*/
VolumeMenuButton.prototype.createMenu = function createMenu() {
var menu = new _menuMenuJs2['default'](this.player_, {
contentElType: 'div'
});
var vc = new _volumeControlVolumeBarJs2['default'](this.player_, this.options_.volumeBar);
vc.on('focus', function () {
menu.lockShowing();
});
vc.on('blur', function () {
menu.unlockShowing();
});
menu.addChild(vc);
return menu;
};
/**
* Handle click on volume menu and calls super
*
* @method handleClick
*/
VolumeMenuButton.prototype.handleClick = function handleClick() {
_muteToggleJs2['default'].prototype.handleClick.call(this);
_MenuButton.prototype.handleClick.call(this);
};
return VolumeMenuButton;
})(_menuMenuButtonJs2['default']);
VolumeMenuButton.prototype.volumeUpdate = _muteToggleJs2['default'].prototype.update;
VolumeMenuButton.prototype.controlText_ = 'Mute';
_componentJs2['default'].registerComponent('VolumeMenuButton', VolumeMenuButton);
exports['default'] = VolumeMenuButton;
module.exports = exports['default'];
},{"../button.js":47,"../component.js":48,"../menu/menu-button.js":84,"../menu/menu.js":86,"./mute-toggle.js":52,"./volume-control/volume-bar.js":74}],78:[function(_dereq_,module,exports){
/**
* @file error-display.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('./component');
var _component2 = _interopRequireDefault(_component);
var _utilsDomJs = _dereq_('./utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
/**
* Display that an error has occurred making the video unplayable
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @extends Component
* @class ErrorDisplay
*/
var ErrorDisplay = (function (_Component) {
_inherits(ErrorDisplay, _Component);
function ErrorDisplay(player, options) {
_classCallCheck(this, ErrorDisplay);
_Component.call(this, player, options);
this.update();
this.on(player, 'error', this.update);
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
ErrorDisplay.prototype.createEl = function createEl() {
var el = _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-error-display'
});
this.contentEl_ = Dom.createEl('div');
el.appendChild(this.contentEl_);
return el;
};
/**
* Update the error message in localized language
*
* @method update
*/
ErrorDisplay.prototype.update = function update() {
if (this.player().error()) {
this.contentEl_.innerHTML = this.localize(this.player().error().message);
}
};
return ErrorDisplay;
})(_component2['default']);
_component2['default'].registerComponent('ErrorDisplay', ErrorDisplay);
exports['default'] = ErrorDisplay;
module.exports = exports['default'];
},{"./component":48,"./utils/dom.js":107}],79:[function(_dereq_,module,exports){
/**
* @file event-target.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _utilsEventsJs = _dereq_('./utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var EventTarget = function EventTarget() {};
EventTarget.prototype.allowedEvents_ = {};
EventTarget.prototype.on = function (type, fn) {
// Remove the addEventListener alias before calling Events.on
// so we don't get into an infinite type loop
var ael = this.addEventListener;
this.addEventListener = Function.prototype;
Events.on(this, type, fn);
this.addEventListener = ael;
};
EventTarget.prototype.addEventListener = EventTarget.prototype.on;
EventTarget.prototype.off = function (type, fn) {
Events.off(this, type, fn);
};
EventTarget.prototype.removeEventListener = EventTarget.prototype.off;
EventTarget.prototype.one = function (type, fn) {
Events.one(this, type, fn);
};
EventTarget.prototype.trigger = function (event) {
var type = event.type || event;
if (typeof event === 'string') {
event = {
type: type
};
}
event = Events.fixEvent(event);
if (this.allowedEvents_[type] && this['on' + type]) {
this['on' + type](event);
}
Events.trigger(this, event);
};
// The standard DOM EventTarget.dispatchEvent() is aliased to trigger()
EventTarget.prototype.dispatchEvent = EventTarget.prototype.trigger;
exports['default'] = EventTarget;
module.exports = exports['default'];
},{"./utils/events.js":108}],80:[function(_dereq_,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utilsLog = _dereq_('./utils/log');
var _utilsLog2 = _interopRequireDefault(_utilsLog);
/*
* @file extends.js
*
* A combination of node inherits and babel's inherits (after transpile).
* Both work the same but node adds `super_` to the subClass
* and Bable adds the superClass as __proto__. Both seem useful.
*/
var _inherits = function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) {
// node
subClass.super_ = superClass;
}
};
/*
* Function for subclassing using the same inheritance that
* videojs uses internally
* ```js
* var Button = videojs.getComponent('Button');
* ```
* ```js
* var MyButton = videojs.extends(Button, {
* constructor: function(player, options) {
* Button.call(this, player, options);
* },
* onClick: function() {
* // doSomething
* }
* });
* ```
*/
var extendsFn = function extendsFn(superClass) {
var subClassMethods = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var subClass = function subClass() {
superClass.apply(this, arguments);
};
var methods = {};
if (typeof subClassMethods === 'object') {
if (typeof subClassMethods.init === 'function') {
_utilsLog2['default'].warn('Constructor logic via init() is deprecated; please use constructor() instead.');
subClassMethods.constructor = subClassMethods.init;
}
if (subClassMethods.constructor !== Object.prototype.constructor) {
subClass = subClassMethods.constructor;
}
methods = subClassMethods;
} else if (typeof subClassMethods === 'function') {
subClass = subClassMethods;
}
_inherits(subClass, superClass);
// Extend subObj's prototype with functions and other properties from props
for (var name in methods) {
if (methods.hasOwnProperty(name)) {
subClass.prototype[name] = methods[name];
}
}
return subClass;
};
exports['default'] = extendsFn;
module.exports = exports['default'];
},{"./utils/log":112}],81:[function(_dereq_,module,exports){
/**
* @file fullscreen-api.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/*
* Store the browser-specific methods for the fullscreen API
* @type {Object|undefined}
* @private
*/
var FullscreenApi = {};
// browser API methods
// map approach from Screenful.js - https://github.com/sindresorhus/screenfull.js
var apiMap = [
// Spec: https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
// WebKit
['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
// Old WebKit (Safari 5.1)
['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'],
// Mozilla
['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'],
// Microsoft
['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
var specApi = apiMap[0];
var browserApi = undefined;
// determine the supported set of functions
for (var i = 0; i < apiMap.length; i++) {
// check for exitFullscreen function
if (apiMap[i][1] in _globalDocument2['default']) {
browserApi = apiMap[i];
break;
}
}
// map the browser API names to the spec API names
if (browserApi) {
for (var i = 0; i < browserApi.length; i++) {
FullscreenApi[specApi[i]] = browserApi[i];
}
}
exports['default'] = FullscreenApi;
module.exports = exports['default'];
},{"global/document":1}],82:[function(_dereq_,module,exports){
/**
* @file loading-spinner.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('./component');
var _component2 = _interopRequireDefault(_component);
/* Loading Spinner
================================================================================ */
/**
* Loading spinner for waiting events
*
* @extends Component
* @class LoadingSpinner
*/
var LoadingSpinner = (function (_Component) {
_inherits(LoadingSpinner, _Component);
function LoadingSpinner() {
_classCallCheck(this, LoadingSpinner);
_Component.apply(this, arguments);
}
/**
* Create the component's DOM element
*
* @method createEl
*/
LoadingSpinner.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-loading-spinner'
});
};
return LoadingSpinner;
})(_component2['default']);
_component2['default'].registerComponent('LoadingSpinner', LoadingSpinner);
exports['default'] = LoadingSpinner;
module.exports = exports['default'];
},{"./component":48}],83:[function(_dereq_,module,exports){
/**
* @file media-error.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/*
* Custom MediaError to mimic the HTML5 MediaError
*
* @param {Number} code The media error code
*/
var MediaError = function MediaError(code) {
if (typeof code === 'number') {
this.code = code;
} else if (typeof code === 'string') {
// default code is zero, so this is a custom error
this.message = code;
} else if (typeof code === 'object') {
// object
_objectAssign2['default'](this, code);
}
if (!this.message) {
this.message = MediaError.defaultMessages[this.code] || '';
}
};
/*
* The error code that refers two one of the defined
* MediaError types
*
* @type {Number}
*/
MediaError.prototype.code = 0;
/*
* An optional message to be shown with the error.
* Message is not part of the HTML5 video spec
* but allows for more informative custom errors.
*
* @type {String}
*/
MediaError.prototype.message = '';
/*
* An optional status code that can be set by plugins
* to allow even more detail about the error.
* For example the HLS plugin might provide the specific
* HTTP status code that was returned when the error
* occurred, then allowing a custom error overlay
* to display more information.
*
* @type {Array}
*/
MediaError.prototype.status = null;
MediaError.errorTypes = ['MEDIA_ERR_CUSTOM', // = 0
'MEDIA_ERR_ABORTED', // = 1
'MEDIA_ERR_NETWORK', // = 2
'MEDIA_ERR_DECODE', // = 3
'MEDIA_ERR_SRC_NOT_SUPPORTED', // = 4
'MEDIA_ERR_ENCRYPTED' // = 5
];
MediaError.defaultMessages = {
1: 'You aborted the media playback',
2: 'A network error caused the media download to fail part-way.',
3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',
4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.',
5: 'The media is encrypted and we do not have the keys to decrypt it.'
};
// Add types as properties on MediaError
// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {
MediaError[MediaError.errorTypes[errNum]] = errNum;
// values should be accessible on both the class and instance
MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;
}
exports['default'] = MediaError;
module.exports = exports['default'];
},{"object.assign":40}],84:[function(_dereq_,module,exports){
/**
* @file menu-button.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('../button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _menuJs = _dereq_('./menu.js');
var _menuJs2 = _interopRequireDefault(_menuJs);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsToTitleCaseJs = _dereq_('../utils/to-title-case.js');
var _utilsToTitleCaseJs2 = _interopRequireDefault(_utilsToTitleCaseJs);
/**
* A button class with a popup menu
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Button
* @class MenuButton
*/
var MenuButton = (function (_Button) {
_inherits(MenuButton, _Button);
function MenuButton(player) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, MenuButton);
_Button.call(this, player, options);
this.update();
this.on('keydown', this.handleKeyPress);
this.el_.setAttribute('aria-haspopup', true);
this.el_.setAttribute('role', 'button');
}
/**
* Update menu
*
* @method update
*/
MenuButton.prototype.update = function update() {
var menu = this.createMenu();
if (this.menu) {
this.removeChild(this.menu);
}
this.menu = menu;
this.addChild(menu);
/**
* Track the state of the menu button
*
* @type {Boolean}
* @private
*/
this.buttonPressed_ = false;
if (this.items && this.items.length === 0) {
this.hide();
} else if (this.items && this.items.length > 1) {
this.show();
}
};
/**
* Create menu
*
* @return {Menu} The constructed menu
* @method createMenu
*/
MenuButton.prototype.createMenu = function createMenu() {
var menu = new _menuJs2['default'](this.player_);
// Add a title list item to the top
if (this.options_.title) {
menu.contentEl().appendChild(Dom.createEl('li', {
className: 'vjs-menu-title',
innerHTML: _utilsToTitleCaseJs2['default'](this.options_.title),
tabIndex: -1
}));
}
this.items = this['createItems']();
if (this.items) {
// Add menu items to the menu
for (var i = 0; i < this.items.length; i++) {
menu.addItem(this.items[i]);
}
}
return menu;
};
/**
* Create the list of menu items. Specific to each subclass.
*
* @method createItems
*/
MenuButton.prototype.createItems = function createItems() {};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
MenuButton.prototype.createEl = function createEl() {
return _Button.prototype.createEl.call(this, 'div', {
className: this.buildCSSClass()
});
};
/**
* Allow sub components to stack CSS class names
*
* @return {String} The constructed class name
* @method buildCSSClass
*/
MenuButton.prototype.buildCSSClass = function buildCSSClass() {
var menuButtonClass = 'vjs-menu-button';
// If the inline option is passed, we want to use different styles altogether.
if (this.options_.inline === true) {
menuButtonClass += '-inline';
} else {
menuButtonClass += '-popup';
}
return 'vjs-menu-button ' + menuButtonClass + ' ' + _Button.prototype.buildCSSClass.call(this);
};
/**
* Focus - Add keyboard functionality to element
* This function is not needed anymore. Instead, the
* keyboard functionality is handled by
* treating the button as triggering a submenu.
* When the button is pressed, the submenu
* appears. Pressing the button again makes
* the submenu disappear.
*
* @method handleFocus
*/
MenuButton.prototype.handleFocus = function handleFocus() {};
/**
* Can't turn off list display that we turned
* on with focus, because list would go away.
*
* @method handleBlur
*/
MenuButton.prototype.handleBlur = function handleBlur() {};
/**
* When you click the button it adds focus, which
* will show the menu indefinitely.
* So we'll remove focus when the mouse leaves the button.
* Focus is needed for tab navigation.
* Allow sub components to stack CSS class names
*
* @method handleClick
*/
MenuButton.prototype.handleClick = function handleClick() {
this.one('mouseout', Fn.bind(this, function () {
this.menu.unlockShowing();
this.el_.blur();
}));
if (this.buttonPressed_) {
this.unpressButton();
} else {
this.pressButton();
}
};
/**
* Handle key press on menu
*
* @param {Object} Key press event
* @method handleKeyPress
*/
MenuButton.prototype.handleKeyPress = function handleKeyPress(event) {
// Check for space bar (32) or enter (13) keys
if (event.which === 32 || event.which === 13) {
if (this.buttonPressed_) {
this.unpressButton();
} else {
this.pressButton();
}
event.preventDefault();
// Check for escape (27) key
} else if (event.which === 27) {
if (this.buttonPressed_) {
this.unpressButton();
}
event.preventDefault();
}
};
/**
* Makes changes based on button pressed
*
* @method pressButton
*/
MenuButton.prototype.pressButton = function pressButton() {
this.buttonPressed_ = true;
this.menu.lockShowing();
this.el_.setAttribute('aria-pressed', true);
if (this.items && this.items.length > 0) {
this.items[0].el().focus(); // set the focus to the title of the submenu
}
};
/**
* Makes changes based on button unpressed
*
* @method unpressButton
*/
MenuButton.prototype.unpressButton = function unpressButton() {
this.buttonPressed_ = false;
this.menu.unlockShowing();
this.el_.setAttribute('aria-pressed', false);
};
return MenuButton;
})(_buttonJs2['default']);
_componentJs2['default'].registerComponent('MenuButton', MenuButton);
exports['default'] = MenuButton;
module.exports = exports['default'];
},{"../button.js":47,"../component.js":48,"../utils/dom.js":107,"../utils/fn.js":109,"../utils/to-title-case.js":116,"./menu.js":86}],85:[function(_dereq_,module,exports){
/**
* @file menu-item.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('../button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* The component for a menu item. `<li>`
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Button
* @class MenuItem
*/
var MenuItem = (function (_Button) {
_inherits(MenuItem, _Button);
function MenuItem(player, options) {
_classCallCheck(this, MenuItem);
_Button.call(this, player, options);
this.selected(options['selected']);
}
/**
* Create the component's DOM element
*
* @param {String=} type Desc
* @param {Object=} props Desc
* @return {Element}
* @method createEl
*/
MenuItem.prototype.createEl = function createEl(type, props) {
return _Button.prototype.createEl.call(this, 'li', _objectAssign2['default']({
className: 'vjs-menu-item',
innerHTML: this.localize(this.options_['label'])
}, props));
};
/**
* Handle a click on the menu item, and set it to selected
*
* @method handleClick
*/
MenuItem.prototype.handleClick = function handleClick() {
this.selected(true);
};
/**
* Set this menu item as selected or not
*
* @param {Boolean} selected
* @method selected
*/
MenuItem.prototype.selected = function selected(_selected) {
if (_selected) {
this.addClass('vjs-selected');
this.el_.setAttribute('aria-selected', true);
} else {
this.removeClass('vjs-selected');
this.el_.setAttribute('aria-selected', false);
}
};
return MenuItem;
})(_buttonJs2['default']);
_componentJs2['default'].registerComponent('MenuItem', MenuItem);
exports['default'] = MenuItem;
module.exports = exports['default'];
},{"../button.js":47,"../component.js":48,"object.assign":40}],86:[function(_dereq_,module,exports){
/**
* @file menu.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsEventsJs = _dereq_('../utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
/**
* The Menu component is used to build pop up menus, including subtitle and
* captions selection menus.
*
* @extends Component
* @class Menu
*/
var Menu = (function (_Component) {
_inherits(Menu, _Component);
function Menu() {
_classCallCheck(this, Menu);
_Component.apply(this, arguments);
}
/**
* Add a menu item to the menu
*
* @param {Object|String} component Component or component type to add
* @method addItem
*/
Menu.prototype.addItem = function addItem(component) {
this.addChild(component);
component.on('click', Fn.bind(this, function () {
this.unlockShowing();
}));
};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
Menu.prototype.createEl = function createEl() {
var contentElType = this.options_.contentElType || 'ul';
this.contentEl_ = Dom.createEl(contentElType, {
className: 'vjs-menu-content'
});
var el = _Component.prototype.createEl.call(this, 'div', {
append: this.contentEl_,
className: 'vjs-menu'
});
el.appendChild(this.contentEl_);
// Prevent clicks from bubbling up. Needed for Menu Buttons,
// where a click on the parent is significant
Events.on(el, 'click', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
});
return el;
};
return Menu;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('Menu', Menu);
exports['default'] = Menu;
module.exports = exports['default'];
},{"../component.js":48,"../utils/dom.js":107,"../utils/events.js":108,"../utils/fn.js":109}],87:[function(_dereq_,module,exports){
/**
* @file player.js
*/
// Subclasses Component
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('./component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _utilsEventsJs = _dereq_('./utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var _utilsDomJs = _dereq_('./utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsFnJs = _dereq_('./utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsGuidJs = _dereq_('./utils/guid.js');
var Guid = _interopRequireWildcard(_utilsGuidJs);
var _utilsBrowserJs = _dereq_('./utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _utilsLogJs = _dereq_('./utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _utilsToTitleCaseJs = _dereq_('./utils/to-title-case.js');
var _utilsToTitleCaseJs2 = _interopRequireDefault(_utilsToTitleCaseJs);
var _utilsTimeRangesJs = _dereq_('./utils/time-ranges.js');
var _utilsBufferJs = _dereq_('./utils/buffer.js');
var _utilsStylesheetJs = _dereq_('./utils/stylesheet.js');
var stylesheet = _interopRequireWildcard(_utilsStylesheetJs);
var _fullscreenApiJs = _dereq_('./fullscreen-api.js');
var _fullscreenApiJs2 = _interopRequireDefault(_fullscreenApiJs);
var _mediaErrorJs = _dereq_('./media-error.js');
var _mediaErrorJs2 = _interopRequireDefault(_mediaErrorJs);
var _safeJsonParseTuple = _dereq_('safe-json-parse/tuple');
var _safeJsonParseTuple2 = _interopRequireDefault(_safeJsonParseTuple);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _utilsMergeOptionsJs = _dereq_('./utils/merge-options.js');
var _utilsMergeOptionsJs2 = _interopRequireDefault(_utilsMergeOptionsJs);
var _tracksTextTrackListConverterJs = _dereq_('./tracks/text-track-list-converter.js');
var _tracksTextTrackListConverterJs2 = _interopRequireDefault(_tracksTextTrackListConverterJs);
// Include required child components (importing also registers them)
var _techLoaderJs = _dereq_('./tech/loader.js');
var _techLoaderJs2 = _interopRequireDefault(_techLoaderJs);
var _posterImageJs = _dereq_('./poster-image.js');
var _posterImageJs2 = _interopRequireDefault(_posterImageJs);
var _tracksTextTrackDisplayJs = _dereq_('./tracks/text-track-display.js');
var _tracksTextTrackDisplayJs2 = _interopRequireDefault(_tracksTextTrackDisplayJs);
var _loadingSpinnerJs = _dereq_('./loading-spinner.js');
var _loadingSpinnerJs2 = _interopRequireDefault(_loadingSpinnerJs);
var _bigPlayButtonJs = _dereq_('./big-play-button.js');
var _bigPlayButtonJs2 = _interopRequireDefault(_bigPlayButtonJs);
var _controlBarControlBarJs = _dereq_('./control-bar/control-bar.js');
var _controlBarControlBarJs2 = _interopRequireDefault(_controlBarControlBarJs);
var _errorDisplayJs = _dereq_('./error-display.js');
var _errorDisplayJs2 = _interopRequireDefault(_errorDisplayJs);
var _tracksTextTrackSettingsJs = _dereq_('./tracks/text-track-settings.js');
var _tracksTextTrackSettingsJs2 = _interopRequireDefault(_tracksTextTrackSettingsJs);
// Require html5 tech, at least for disposing the original video tag
var _techHtml5Js = _dereq_('./tech/html5.js');
var _techHtml5Js2 = _interopRequireDefault(_techHtml5Js);
/**
* An instance of the `Player` class is created when any of the Video.js setup methods are used to initialize a video.
* ```js
* var myPlayer = videojs('example_video_1');
* ```
* In the following example, the `data-setup` attribute tells the Video.js library to create a player instance when the library is ready.
* ```html
* <video id="example_video_1" data-setup='{}' controls>
* <source src="my-source.mp4" type="video/mp4">
* </video>
* ```
* After an instance has been created it can be accessed globally using `Video('example_video_1')`.
*
* @param {Element} tag The original video tag used for configuring options
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends Component
* @class Player
*/
var Player = (function (_Component) {
_inherits(Player, _Component);
/**
* player's constructor function
*
* @constructs
* @method init
* @param {Element} tag The original video tag used for configuring options
* @param {Object=} options Player options
* @param {Function=} ready Ready callback function
*/
function Player(tag, options, ready) {
var _this = this;
_classCallCheck(this, Player);
// Make sure tag ID exists
tag.id = tag.id || 'vjs_video_' + Guid.newGUID();
// Set Options
// The options argument overrides options set in the video tag
// which overrides globally set options.
// This latter part coincides with the load order
// (tag must exist before Player)
options = _objectAssign2['default'](Player.getTagSettings(tag), options);
// Delay the initialization of children because we need to set up
// player properties first, and can't use `this` before `super()`
options.initChildren = false;
// Same with creating the element
options.createEl = false;
// we don't want the player to report touch activity on itself
// see enableTouchActivity in Component
options.reportTouchActivity = false;
// Run base component initializing with new options
_Component.call(this, null, options, ready);
// if the global option object was accidentally blown away by
// someone, bail early with an informative error
if (!this.options_ || !this.options_.techOrder || !this.options_.techOrder.length) {
throw new Error('No techOrder specified. Did you overwrite ' + 'videojs.options instead of just changing the ' + 'properties you want to override?');
}
this.tag = tag; // Store the original tag used to set options
// Store the tag attributes used to restore html5 element
this.tagAttributes = tag && Dom.getElAttributes(tag);
// Update current language
this.language(this.options_.language);
// Update Supported Languages
if (options.languages) {
(function () {
// Normalise player option languages to lowercase
var languagesToLower = {};
Object.getOwnPropertyNames(options.languages).forEach(function (name) {
languagesToLower[name.toLowerCase()] = options.languages[name];
});
_this.languages_ = languagesToLower;
})();
} else {
this.languages_ = Player.prototype.options_.languages;
}
// Cache for video property values.
this.cache_ = {};
// Set poster
this.poster_ = options.poster || '';
// Set controls
this.controls_ = !!options.controls;
// Original tag settings stored in options
// now remove immediately so native controls don't flash.
// May be turned back on by HTML5 tech if nativeControlsForTouch is true
tag.controls = false;
/*
* Store the internal state of scrubbing
*
* @private
* @return {Boolean} True if the user is scrubbing
*/
this.scrubbing_ = false;
this.el_ = this.createEl();
// We also want to pass the original player options to each component and plugin
// as well so they don't need to reach back into the player for options later.
// We also need to do another copy of this.options_ so we don't end up with
// an infinite loop.
var playerOptionsCopy = _utilsMergeOptionsJs2['default'](this.options_);
// Load plugins
if (options.plugins) {
(function () {
var plugins = options.plugins;
Object.getOwnPropertyNames(plugins).forEach(function (name) {
if (typeof this[name] === 'function') {
this[name](plugins[name]);
} else {
_utilsLogJs2['default'].error('Unable to find plugin:', name);
}
}, _this);
})();
}
this.options_.playerOptions = playerOptionsCopy;
this.initChildren();
// Set isAudio based on whether or not an audio tag was used
this.isAudio(tag.nodeName.toLowerCase() === 'audio');
// Update controls className. Can't do this when the controls are initially
// set because the element doesn't exist yet.
if (this.controls()) {
this.addClass('vjs-controls-enabled');
} else {
this.addClass('vjs-controls-disabled');
}
if (this.isAudio()) {
this.addClass('vjs-audio');
}
if (this.flexNotSupported_()) {
this.addClass('vjs-no-flex');
}
// TODO: Make this smarter. Toggle user state between touching/mousing
// using events, since devices can have both touch and mouse events.
// if (browser.TOUCH_ENABLED) {
// this.addClass('vjs-touch-enabled');
// }
// Make player easily findable by ID
Player.players[this.id_] = this;
// When the player is first initialized, trigger activity so components
// like the control bar show themselves if needed
this.userActive(true);
this.reportUserActivity();
this.listenForUserActivity();
this.on('fullscreenchange', this.handleFullscreenChange);
this.on('stageclick', this.handleStageClick);
}
/*
* Global player list
*
* @type {Object}
*/
/**
* Destroys the video player and does any necessary cleanup
* ```js
* myPlayer.dispose();
* ```
* This is especially helpful if you are dynamically adding and removing videos
* to/from the DOM.
*
* @method dispose
*/
Player.prototype.dispose = function dispose() {
this.trigger('dispose');
// prevent dispose from being called twice
this.off('dispose');
if (this.styleEl_) {
this.styleEl_.parentNode.removeChild(this.styleEl_);
}
// Kill reference to this player
Player.players[this.id_] = null;
if (this.tag && this.tag.player) {
this.tag.player = null;
}
if (this.el_ && this.el_.player) {
this.el_.player = null;
}
if (this.tech) {
this.tech.dispose();
}
_Component.prototype.dispose.call(this);
};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
Player.prototype.createEl = function createEl() {
var el = this.el_ = _Component.prototype.createEl.call(this, 'div');
var tag = this.tag;
// Remove width/height attrs from tag so CSS can make it 100% width/height
tag.removeAttribute('width');
tag.removeAttribute('height');
// Copy over all the attributes from the tag, including ID and class
// ID will now reference player box, not the video tag
var attrs = Dom.getElAttributes(tag);
Object.getOwnPropertyNames(attrs).forEach(function (attr) {
// workaround so we don't totally break IE7
// http://stackoverflow.com/questions/3653444/css-styles-not-applied-on-dynamic-elements-in-internet-explorer-7
if (attr === 'class') {
el.className = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
});
// Update tag id/class for use as HTML5 playback tech
// Might think we should do this after embedding in container so .vjs-tech class
// doesn't flash 100% width/height, but class only applies with .video-js parent
tag.id += '_html5_api';
tag.className = 'vjs-tech';
// Make player findable on elements
tag.player = el.player = this;
// Default state of video is paused
this.addClass('vjs-paused');
// Add a style element in the player that we'll use to set the width/height
// of the player in a way that's still overrideable by CSS, just like the
// video element
this.styleEl_ = stylesheet.createStyleElement('vjs-styles-dimensions');
var defaultsStyleEl = _globalDocument2['default'].querySelector('.vjs-styles-defaults');
var head = _globalDocument2['default'].querySelector('head');
head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
// Pass in the width/height/aspectRatio options which will update the style el
this.width(this.options_.width);
this.height(this.options_.height);
this.fluid(this.options_.fluid);
this.aspectRatio(this.options_.aspectRatio);
// insertElFirst seems to cause the networkState to flicker from 3 to 2, so
// keep track of the original for later so we can know if the source originally failed
tag.initNetworkState_ = tag.networkState;
// Wrap video tag in div (el/box) container
if (tag.parentNode) {
tag.parentNode.insertBefore(el, tag);
}
Dom.insertElFirst(tag, el); // Breaks iPhone, fixed in HTML5 setup.
this.el_ = el;
return el;
};
/**
* Get/set player width
*
* @param {Number=} value Value for width
* @return {Number} Width when getting
* @method width
*/
Player.prototype.width = function width(value) {
return this.dimension('width', value);
};
/**
* Get/set player height
*
* @param {Number=} value Value for height
* @return {Number} Height when getting
* @method height
*/
Player.prototype.height = function height(value) {
return this.dimension('height', value);
};
/**
* Get/set dimension for player
*
* @param {String} dimension Either width or height
* @param {Number=} value Value for dimension
* @return {Component}
* @method dimension
*/
Player.prototype.dimension = function dimension(_dimension, value) {
var privDimension = _dimension + '_';
if (value === undefined) {
return this[privDimension] || 0;
}
if (value === '') {
// If an empty string is given, reset the dimension to be automatic
this[privDimension] = undefined;
} else {
var parsedVal = parseFloat(value);
if (isNaN(parsedVal)) {
_utilsLogJs2['default'].error('Improper value "' + value + '" supplied for for ' + _dimension);
return this;
}
this[privDimension] = parsedVal;
}
this.updateStyleEl_();
return this;
};
/**
* Add/remove the vjs-fluid class
*
* @param {Boolean} bool Value of true adds the class, value of false removes the class
* @method fluid
*/
Player.prototype.fluid = function fluid(bool) {
if (bool === undefined) {
return !!this.fluid_;
}
this.fluid_ = !!bool;
if (bool) {
this.addClass('vjs-fluid');
} else {
this.removeClass('vjs-fluid');
}
};
/**
* Get/Set the aspect ratio
*
* @param {String=} ratio Aspect ratio for player
* @return aspectRatio
* @method aspectRatio
*/
Player.prototype.aspectRatio = function aspectRatio(ratio) {
if (ratio === undefined) {
return this.aspectRatio_;
}
// Check for width:height format
if (!/^\d+\:\d+$/.test(ratio)) {
throw new Error('Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.');
}
this.aspectRatio_ = ratio;
// We're assuming if you set an aspect ratio you want fluid mode,
// because in fixed mode you could calculate width and height yourself.
this.fluid(true);
this.updateStyleEl_();
};
/**
* Update styles of the player element (height, width and aspect ratio)
*
* @method updateStyleEl_
*/
Player.prototype.updateStyleEl_ = function updateStyleEl_() {
var width = undefined;
var height = undefined;
var aspectRatio = undefined;
// The aspect ratio is either used directly or to calculate width and height.
if (this.aspectRatio_ !== undefined && this.aspectRatio_ !== 'auto') {
// Use any aspectRatio that's been specifically set
aspectRatio = this.aspectRatio_;
} else if (this.videoWidth()) {
// Otherwise try to get the aspect ratio from the video metadata
aspectRatio = this.videoWidth() + ':' + this.videoHeight();
} else {
// Or use a default. The video element's is 2:1, but 16:9 is more common.
aspectRatio = '16:9';
}
// Get the ratio as a decimal we can use to calculate dimensions
var ratioParts = aspectRatio.split(':');
var ratioMultiplier = ratioParts[1] / ratioParts[0];
if (this.width_ !== undefined) {
// Use any width that's been specifically set
width = this.width_;
} else if (this.height_ !== undefined) {
// Or calulate the width from the aspect ratio if a height has been set
width = this.height_ / ratioMultiplier;
} else {
// Or use the video's metadata, or use the video el's default of 300
width = this.videoWidth() || 300;
}
if (this.height_ !== undefined) {
// Use any height that's been specifically set
height = this.height_;
} else {
// Otherwise calculate the height from the ratio and the width
height = width * ratioMultiplier;
}
var idClass = this.id() + '-dimensions';
// Ensure the right class is still on the player for the style element
this.addClass(idClass);
stylesheet.setTextContent(this.styleEl_, '\n .' + idClass + ' {\n width: ' + width + 'px;\n height: ' + height + 'px;\n }\n\n .' + idClass + '.vjs-fluid {\n padding-top: ' + ratioMultiplier * 100 + '%;\n }\n ');
};
/**
* Load the Media Playback Technology (tech)
* Load/Create an instance of playback technology including element and API methods
* And append playback element in player div.
*
* @param {String} techName Name of the playback technology
* @param {String} source Video source
* @method loadTech
*/
Player.prototype.loadTech = function loadTech(techName, source) {
// Pause and remove current playback technology
if (this.tech) {
this.unloadTech();
}
// get rid of the HTML5 video tag as soon as we are using another tech
if (techName !== 'Html5' && this.tag) {
_componentJs2['default'].getComponent('Html5').disposeMediaElement(this.tag);
this.tag.player = null;
this.tag = null;
}
this.techName = techName;
// Turn off API access because we're loading a new tech that might load asynchronously
this.isReady_ = false;
var techReady = Fn.bind(this, function () {
this.triggerReady();
});
// Grab tech-specific options from player options and add source and parent element to use.
var techOptions = _objectAssign2['default']({
'nativeControlsForTouch': this.options_.nativeControlsForTouch,
'source': source,
'playerId': this.id(),
'techId': this.id() + '_' + techName + '_api',
'textTracks': this.textTracks_,
'autoplay': this.options_.autoplay,
'preload': this.options_.preload,
'loop': this.options_.loop,
'muted': this.options_.muted,
'poster': this.poster(),
'language': this.language(),
'vtt.js': this.options_['vtt.js']
}, this.options_[techName.toLowerCase()]);
if (this.tag) {
techOptions.tag = this.tag;
}
if (source) {
this.currentType_ = source.type;
if (source.src === this.cache_.src && this.cache_.currentTime > 0) {
techOptions.startTime = this.cache_.currentTime;
}
this.cache_.src = source.src;
}
// Initialize tech instance
var techComponent = _componentJs2['default'].getComponent(techName);
this.tech = new techComponent(techOptions);
_tracksTextTrackListConverterJs2['default'].jsonToTextTracks(this.textTracksJson_ || [], this.tech);
this.on(this.tech, 'ready', this.handleTechReady);
// Listen to every HTML5 events and trigger them back on the player for the plugins
this.on(this.tech, 'loadstart', this.handleTechLoadStart);
this.on(this.tech, 'waiting', this.handleTechWaiting);
this.on(this.tech, 'canplay', this.handleTechCanPlay);
this.on(this.tech, 'canplaythrough', this.handleTechCanPlayThrough);
this.on(this.tech, 'playing', this.handleTechPlaying);
this.on(this.tech, 'ended', this.handleTechEnded);
this.on(this.tech, 'seeking', this.handleTechSeeking);
this.on(this.tech, 'seeked', this.handleTechSeeked);
this.on(this.tech, 'play', this.handleTechPlay);
this.on(this.tech, 'firstplay', this.handleTechFirstPlay);
this.on(this.tech, 'pause', this.handleTechPause);
this.on(this.tech, 'progress', this.handleTechProgress);
this.on(this.tech, 'durationchange', this.handleTechDurationChange);
this.on(this.tech, 'fullscreenchange', this.handleTechFullscreenChange);
this.on(this.tech, 'error', this.handleTechError);
this.on(this.tech, 'suspend', this.handleTechSuspend);
this.on(this.tech, 'abort', this.handleTechAbort);
this.on(this.tech, 'emptied', this.handleTechEmptied);
this.on(this.tech, 'stalled', this.handleTechStalled);
this.on(this.tech, 'loadedmetadata', this.handleTechLoadedMetaData);
this.on(this.tech, 'loadeddata', this.handleTechLoadedData);
this.on(this.tech, 'timeupdate', this.handleTechTimeUpdate);
this.on(this.tech, 'ratechange', this.handleTechRateChange);
this.on(this.tech, 'volumechange', this.handleTechVolumeChange);
this.on(this.tech, 'texttrackchange', this.onTextTrackChange);
this.on(this.tech, 'loadedmetadata', this.updateStyleEl_);
this.usingNativeControls(this.techGet('controls'));
if (this.controls() && !this.usingNativeControls()) {
this.addTechControlsListeners();
}
// Add the tech element in the DOM if it was not already there
// Make sure to not insert the original video element if using Html5
if (this.tech.el().parentNode !== this.el() && (techName !== 'Html5' || !this.tag)) {
Dom.insertElFirst(this.tech.el(), this.el());
}
// Get rid of the original video tag reference after the first tech is loaded
if (this.tag) {
this.tag.player = null;
this.tag = null;
}
// player.triggerReady is always async, so don't need this to be async
this.tech.ready(techReady, true);
};
/**
* Unload playback technology
*
* @method unloadTech
*/
Player.prototype.unloadTech = function unloadTech() {
// Save the current text tracks so that we can reuse the same text tracks with the next tech
this.textTracks_ = this.textTracks();
this.textTracksJson_ = _tracksTextTrackListConverterJs2['default'].textTracksToJson(this);
this.isReady_ = false;
this.tech.dispose();
this.tech = false;
};
/**
* Add playback technology listeners
*
* @method addTechControlsListeners
*/
Player.prototype.addTechControlsListeners = function addTechControlsListeners() {
// Make sure to remove all the previous listeners in case we are called multiple times.
this.removeTechControlsListeners();
// Some browsers (Chrome & IE) don't trigger a click on a flash swf, but do
// trigger mousedown/up.
// http://stackoverflow.com/questions/1444562/javascript-onclick-event-over-flash-object
// Any touch events are set to block the mousedown event from happening
this.on(this.tech, 'mousedown', this.handleTechClick);
// If the controls were hidden we don't want that to change without a tap event
// so we'll check if the controls were already showing before reporting user
// activity
this.on(this.tech, 'touchstart', this.handleTechTouchStart);
this.on(this.tech, 'touchmove', this.handleTechTouchMove);
this.on(this.tech, 'touchend', this.handleTechTouchEnd);
// The tap listener needs to come after the touchend listener because the tap
// listener cancels out any reportedUserActivity when setting userActive(false)
this.on(this.tech, 'tap', this.handleTechTap);
};
/**
* Remove the listeners used for click and tap controls. This is needed for
* toggling to controls disabled, where a tap/touch should do nothing.
*
* @method removeTechControlsListeners
*/
Player.prototype.removeTechControlsListeners = function removeTechControlsListeners() {
// We don't want to just use `this.off()` because there might be other needed
// listeners added by techs that extend this.
this.off(this.tech, 'tap', this.handleTechTap);
this.off(this.tech, 'touchstart', this.handleTechTouchStart);
this.off(this.tech, 'touchmove', this.handleTechTouchMove);
this.off(this.tech, 'touchend', this.handleTechTouchEnd);
this.off(this.tech, 'mousedown', this.handleTechClick);
};
/**
* Player waits for the tech to be ready
*
* @private
* @method handleTechReady
*/
Player.prototype.handleTechReady = function handleTechReady() {
this.triggerReady();
// Keep the same volume as before
if (this.cache_.volume) {
this.techCall('setVolume', this.cache_.volume);
}
// Chrome and Safari both have issues with autoplay.
// In Safari (5.1.1), when we move the video element into the container div, autoplay doesn't work.
// In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays)
// This fixes both issues. Need to wait for API, so it updates displays correctly
if (this.tag && this.options_.autoplay && this.paused()) {
delete this.tag.poster; // Chrome Fix. Fixed in Chrome v16.
this.play();
}
};
/**
* Fired when the user agent begins looking for media data
*
* @event loadstart
*/
Player.prototype.handleTechLoadStart = function handleTechLoadStart() {
// TODO: Update to use `emptied` event instead. See #1277.
this.removeClass('vjs-ended');
// reset the error state
this.error(null);
// If it's already playing we want to trigger a firstplay event now.
// The firstplay event relies on both the play and loadstart events
// which can happen in any order for a new source
if (!this.paused()) {
this.trigger('loadstart');
this.trigger('firstplay');
} else {
// reset the hasStarted state
this.hasStarted(false);
this.trigger('loadstart');
}
};
/**
* Add/remove the vjs-has-started class
*
* @param {Boolean} hasStarted The value of true adds the class the value of false remove the class
* @return {Boolean} Boolean value if has started
* @method hasStarted
*/
Player.prototype.hasStarted = function hasStarted(_hasStarted) {
if (_hasStarted !== undefined) {
// only update if this is a new value
if (this.hasStarted_ !== _hasStarted) {
this.hasStarted_ = _hasStarted;
if (_hasStarted) {
this.addClass('vjs-has-started');
// trigger the firstplay event if this newly has played
this.trigger('firstplay');
} else {
this.removeClass('vjs-has-started');
}
}
return this;
}
return !!this.hasStarted_;
};
/**
* Fired whenever the media begins or resumes playback
*
* @event play
*/
Player.prototype.handleTechPlay = function handleTechPlay() {
this.removeClass('vjs-ended');
this.removeClass('vjs-paused');
this.addClass('vjs-playing');
// hide the poster when the user hits play
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-play
this.hasStarted(true);
this.trigger('play');
};
/**
* Fired whenever the media begins waiting
*
* @event waiting
*/
Player.prototype.handleTechWaiting = function handleTechWaiting() {
this.addClass('vjs-waiting');
this.trigger('waiting');
};
/**
* A handler for events that signal that waiting has ended
* which is not consistent between browsers. See #1351
*
* @event canplay
*/
Player.prototype.handleTechCanPlay = function handleTechCanPlay() {
this.removeClass('vjs-waiting');
this.trigger('canplay');
};
/**
* A handler for events that signal that waiting has ended
* which is not consistent between browsers. See #1351
*
* @event canplaythrough
*/
Player.prototype.handleTechCanPlayThrough = function handleTechCanPlayThrough() {
this.removeClass('vjs-waiting');
this.trigger('canplaythrough');
};
/**
* A handler for events that signal that waiting has ended
* which is not consistent between browsers. See #1351
*
* @event playing
*/
Player.prototype.handleTechPlaying = function handleTechPlaying() {
this.removeClass('vjs-waiting');
this.trigger('playing');
};
/**
* Fired whenever the player is jumping to a new time
*
* @event seeking
*/
Player.prototype.handleTechSeeking = function handleTechSeeking() {
this.addClass('vjs-seeking');
this.trigger('seeking');
};
/**
* Fired when the player has finished jumping to a new time
*
* @event seeked
*/
Player.prototype.handleTechSeeked = function handleTechSeeked() {
this.removeClass('vjs-seeking');
this.trigger('seeked');
};
/**
* Fired the first time a video is played
* Not part of the HLS spec, and we're not sure if this is the best
* implementation yet, so use sparingly. If you don't have a reason to
* prevent playback, use `myPlayer.one('play');` instead.
*
* @event firstplay
*/
Player.prototype.handleTechFirstPlay = function handleTechFirstPlay() {
//If the first starttime attribute is specified
//then we will start at the given offset in seconds
if (this.options_.starttime) {
this.currentTime(this.options_.starttime);
}
this.addClass('vjs-has-started');
this.trigger('firstplay');
};
/**
* Fired whenever the media has been paused
*
* @event pause
*/
Player.prototype.handleTechPause = function handleTechPause() {
this.removeClass('vjs-playing');
this.addClass('vjs-paused');
this.trigger('pause');
};
/**
* Fired while the user agent is downloading media data
*
* @event progress
*/
Player.prototype.handleTechProgress = function handleTechProgress() {
this.trigger('progress');
// Add custom event for when source is finished downloading.
if (this.bufferedPercent() === 1) {
this.trigger('loadedalldata');
}
};
/**
* Fired when the end of the media resource is reached (currentTime == duration)
*
* @event ended
*/
Player.prototype.handleTechEnded = function handleTechEnded() {
this.addClass('vjs-ended');
if (this.options_.loop) {
this.currentTime(0);
this.play();
} else if (!this.paused()) {
this.pause();
}
this.trigger('ended');
};
/**
* Fired when the duration of the media resource is first known or changed
*
* @event durationchange
*/
Player.prototype.handleTechDurationChange = function handleTechDurationChange() {
this.updateDuration();
this.trigger('durationchange');
};
/**
* Handle a click on the media element to play/pause
*
* @param {Object=} event Event object
* @method handleTechClick
*/
Player.prototype.handleTechClick = function handleTechClick(event) {
// We're using mousedown to detect clicks thanks to Flash, but mousedown
// will also be triggered with right-clicks, so we need to prevent that
if (event.button !== 0) return;
// When controls are disabled a click should not toggle playback because
// the click is considered a control
if (this.controls()) {
if (this.paused()) {
this.play();
} else {
this.pause();
}
}
};
/**
* Handle a tap on the media element. It will toggle the user
* activity state, which hides and shows the controls.
*
* @method handleTechTap
*/
Player.prototype.handleTechTap = function handleTechTap() {
this.userActive(!this.userActive());
};
/**
* Handle touch to start
*
* @method handleTechTouchStart
*/
Player.prototype.handleTechTouchStart = function handleTechTouchStart() {
this.userWasActive = this.userActive();
};
/**
* Handle touch to move
*
* @method handleTechTouchMove
*/
Player.prototype.handleTechTouchMove = function handleTechTouchMove() {
if (this.userWasActive) {
this.reportUserActivity();
}
};
/**
* Handle touch to end
*
* @method handleTechTouchEnd
*/
Player.prototype.handleTechTouchEnd = function handleTechTouchEnd(event) {
// Stop the mouse events from also happening
event.preventDefault();
};
/**
* Update the duration of the player using the tech
*
* @private
* @method updateDuration
*/
Player.prototype.updateDuration = function updateDuration() {
// Allows for caching value instead of asking player each time.
// We need to get the techGet response and check for a value so we don't
// accidentally cause the stack to blow up.
var duration = this.techGet('duration');
if (duration) {
if (duration < 0) {
duration = Infinity;
}
this.duration(duration);
// Determine if the stream is live and propagate styles down to UI.
if (duration === Infinity) {
this.addClass('vjs-live');
} else {
this.removeClass('vjs-live');
}
}
};
/**
* Fired when the player switches in or out of fullscreen mode
*
* @event fullscreenchange
*/
Player.prototype.handleFullscreenChange = function handleFullscreenChange() {
if (this.isFullscreen()) {
this.addClass('vjs-fullscreen');
} else {
this.removeClass('vjs-fullscreen');
}
};
/**
* native click events on the SWF aren't triggered on IE11, Win8.1RT
* use stageclick events triggered from inside the SWF instead
*
* @private
* @method handleStageClick
*/
Player.prototype.handleStageClick = function handleStageClick() {
this.reportUserActivity();
};
/**
* Handle Tech Fullscreen Change
*
* @method handleTechFullscreenChange
*/
Player.prototype.handleTechFullscreenChange = function handleTechFullscreenChange(event, data) {
if (data) {
this.isFullscreen(data.isFullscreen);
}
this.trigger('fullscreenchange');
};
/**
* Fires when an error occurred during the loading of an audio/video
*
* @event error
*/
Player.prototype.handleTechError = function handleTechError() {
var error = this.tech.error();
this.error(error && error.code);
};
/**
* Fires when the browser is intentionally not getting media data
*
* @event suspend
*/
Player.prototype.handleTechSuspend = function handleTechSuspend() {
this.trigger('suspend');
};
/**
* Fires when the loading of an audio/video is aborted
*
* @event abort
*/
Player.prototype.handleTechAbort = function handleTechAbort() {
this.trigger('abort');
};
/**
* Fires when the current playlist is empty
*
* @event emptied
*/
Player.prototype.handleTechEmptied = function handleTechEmptied() {
this.trigger('emptied');
};
/**
* Fires when the browser is trying to get media data, but data is not available
*
* @event stalled
*/
Player.prototype.handleTechStalled = function handleTechStalled() {
this.trigger('stalled');
};
/**
* Fires when the browser has loaded meta data for the audio/video
*
* @event loadedmetadata
*/
Player.prototype.handleTechLoadedMetaData = function handleTechLoadedMetaData() {
this.trigger('loadedmetadata');
};
/**
* Fires when the browser has loaded the current frame of the audio/video
*
* @event loaddata
*/
Player.prototype.handleTechLoadedData = function handleTechLoadedData() {
this.trigger('loadeddata');
};
/**
* Fires when the current playback position has changed
*
* @event timeupdate
*/
Player.prototype.handleTechTimeUpdate = function handleTechTimeUpdate() {
this.trigger('timeupdate');
};
/**
* Fires when the playing speed of the audio/video is changed
*
* @event ratechange
*/
Player.prototype.handleTechRateChange = function handleTechRateChange() {
this.trigger('ratechange');
};
/**
* Fires when the volume has been changed
*
* @event volumechange
*/
Player.prototype.handleTechVolumeChange = function handleTechVolumeChange() {
this.trigger('volumechange');
};
/**
* Fires when the text track has been changed
*
* @event texttrackchange
*/
Player.prototype.onTextTrackChange = function onTextTrackChange() {
this.trigger('texttrackchange');
};
/**
* Get object for cached values.
*
* @return {Object}
* @method getCache
*/
Player.prototype.getCache = function getCache() {
return this.cache_;
};
/**
* Pass values to the playback tech
*
* @param {String=} method Method
* @param {Object=} arg Argument
* @method techCall
*/
Player.prototype.techCall = function techCall(method, arg) {
// If it's not ready yet, call method when it is
if (this.tech && !this.tech.isReady_) {
this.tech.ready(function () {
this[method](arg);
}, true);
// Otherwise call method now
} else {
try {
this.tech[method](arg);
} catch (e) {
_utilsLogJs2['default'](e);
throw e;
}
}
};
/**
* Get calls can't wait for the tech, and sometimes don't need to.
*
* @param {String} method Tech method
* @return {Method}
* @method techGet
*/
Player.prototype.techGet = function techGet(method) {
if (this.tech && this.tech.isReady_) {
// Flash likes to die and reload when you hide or reposition it.
// In these cases the object methods go away and we get errors.
// When that happens we'll catch the errors and inform tech that it's not ready any more.
try {
return this.tech[method]();
} catch (e) {
// When building additional tech libs, an expected method may not be defined yet
if (this.tech[method] === undefined) {
_utilsLogJs2['default']('Video.js: ' + method + ' method not defined for ' + this.techName + ' playback technology.', e);
} else {
// When a method isn't available on the object it throws a TypeError
if (e.name === 'TypeError') {
_utilsLogJs2['default']('Video.js: ' + method + ' unavailable on ' + this.techName + ' playback technology element.', e);
this.tech.isReady_ = false;
} else {
_utilsLogJs2['default'](e);
}
}
throw e;
}
}
return;
};
/**
* start media playback
* ```js
* myPlayer.play();
* ```
*
* @return {Player} self
* @method play
*/
Player.prototype.play = function play() {
this.techCall('play');
return this;
};
/**
* Pause the video playback
* ```js
* myPlayer.pause();
* ```
*
* @return {Player} self
* @method pause
*/
Player.prototype.pause = function pause() {
this.techCall('pause');
return this;
};
/**
* Check if the player is paused
* ```js
* var isPaused = myPlayer.paused();
* var isPlaying = !myPlayer.paused();
* ```
*
* @return {Boolean} false if the media is currently playing, or true otherwise
* @method paused
*/
Player.prototype.paused = function paused() {
// The initial state of paused should be true (in Safari it's actually false)
return this.techGet('paused') === false ? false : true;
};
/**
* Returns whether or not the user is "scrubbing". Scrubbing is when the user
* has clicked the progress bar handle and is dragging it along the progress bar.
*
* @param {Boolean} isScrubbing True/false the user is scrubbing
* @return {Boolean} The scrubbing status when getting
* @return {Object} The player when setting
* @method scrubbing
*/
Player.prototype.scrubbing = function scrubbing(isScrubbing) {
if (isScrubbing !== undefined) {
this.scrubbing_ = !!isScrubbing;
if (isScrubbing) {
this.addClass('vjs-scrubbing');
} else {
this.removeClass('vjs-scrubbing');
}
return this;
}
return this.scrubbing_;
};
/**
* Get or set the current time (in seconds)
* ```js
* // get
* var whereYouAt = myPlayer.currentTime();
* // set
* myPlayer.currentTime(120); // 2 minutes into the video
* ```
*
* @param {Number|String=} seconds The time to seek to
* @return {Number} The time in seconds, when not setting
* @return {Player} self, when the current time is set
* @method currentTime
*/
Player.prototype.currentTime = function currentTime(seconds) {
if (seconds !== undefined) {
this.techCall('setCurrentTime', seconds);
return this;
}
// cache last currentTime and return. default to 0 seconds
//
// Caching the currentTime is meant to prevent a massive amount of reads on the tech's
// currentTime when scrubbing, but may not provide much performance benefit afterall.
// Should be tested. Also something has to read the actual current time or the cache will
// never get updated.
return this.cache_.currentTime = this.techGet('currentTime') || 0;
};
/**
* Get the length in time of the video in seconds
* ```js
* var lengthOfVideo = myPlayer.duration();
* ```
* **NOTE**: The video must have started loading before the duration can be
* known, and in the case of Flash, may not be known until the video starts
* playing.
*
* @param {Number} seconds Duration when setting
* @return {Number} The duration of the video in seconds when getting
* @method duration
*/
Player.prototype.duration = function duration(seconds) {
if (seconds !== undefined) {
// cache the last set value for optimized scrubbing (esp. Flash)
this.cache_.duration = parseFloat(seconds);
return this;
}
if (this.cache_.duration === undefined) {
this.updateDuration();
}
return this.cache_.duration || 0;
};
/**
* Calculates how much time is left.
* ```js
* var timeLeft = myPlayer.remainingTime();
* ```
* Not a native video element function, but useful
*
* @return {Number} The time remaining in seconds
* @method remainingTime
*/
Player.prototype.remainingTime = function remainingTime() {
return this.duration() - this.currentTime();
};
// http://dev.w3.org/html5/spec/video.html#dom-media-buffered
// Buffered returns a timerange object.
// Kind of like an array of portions of the video that have been downloaded.
/**
* Get a TimeRange object with the times of the video that have been downloaded
* If you just want the percent of the video that's been downloaded,
* use bufferedPercent.
* ```js
* // Number of different ranges of time have been buffered. Usually 1.
* numberOfRanges = bufferedTimeRange.length,
* // Time in seconds when the first range starts. Usually 0.
* firstRangeStart = bufferedTimeRange.start(0),
* // Time in seconds when the first range ends
* firstRangeEnd = bufferedTimeRange.end(0),
* // Length in seconds of the first time range
* firstRangeLength = firstRangeEnd - firstRangeStart;
* ```
*
* @return {Object} A mock TimeRange object (following HTML spec)
* @method buffered
*/
Player.prototype.buffered = function buffered() {
var buffered = this.techGet('buffered');
if (!buffered || !buffered.length) {
buffered = _utilsTimeRangesJs.createTimeRange(0, 0);
}
return buffered;
};
/**
* Get the percent (as a decimal) of the video that's been downloaded
* ```js
* var howMuchIsDownloaded = myPlayer.bufferedPercent();
* ```
* 0 means none, 1 means all.
* (This method isn't in the HTML5 spec, but it's very convenient)
*
* @return {Number} A decimal between 0 and 1 representing the percent
* @method bufferedPercent
*/
Player.prototype.bufferedPercent = function bufferedPercent() {
return _utilsBufferJs.bufferedPercent(this.buffered(), this.duration());
};
/**
* Get the ending time of the last buffered time range
* This is used in the progress bar to encapsulate all time ranges.
*
* @return {Number} The end of the last buffered time range
* @method bufferedEnd
*/
Player.prototype.bufferedEnd = function bufferedEnd() {
var buffered = this.buffered(),
duration = this.duration(),
end = buffered.end(buffered.length - 1);
if (end > duration) {
end = duration;
}
return end;
};
/**
* Get or set the current volume of the media
* ```js
* // get
* var howLoudIsIt = myPlayer.volume();
* // set
* myPlayer.volume(0.5); // Set volume to half
* ```
* 0 is off (muted), 1.0 is all the way up, 0.5 is half way.
*
* @param {Number} percentAsDecimal The new volume as a decimal percent
* @return {Number} The current volume when getting
* @return {Player} self when setting
* @method volume
*/
Player.prototype.volume = function volume(percentAsDecimal) {
var vol = undefined;
if (percentAsDecimal !== undefined) {
vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); // Force value to between 0 and 1
this.cache_.volume = vol;
this.techCall('setVolume', vol);
return this;
}
// Default to 1 when returning current volume.
vol = parseFloat(this.techGet('volume'));
return isNaN(vol) ? 1 : vol;
};
/**
* Get the current muted state, or turn mute on or off
* ```js
* // get
* var isVolumeMuted = myPlayer.muted();
* // set
* myPlayer.muted(true); // mute the volume
* ```
*
* @param {Boolean=} muted True to mute, false to unmute
* @return {Boolean} True if mute is on, false if not when getting
* @return {Player} self when setting mute
* @method muted
*/
Player.prototype.muted = function muted(_muted) {
if (_muted !== undefined) {
this.techCall('setMuted', _muted);
return this;
}
return this.techGet('muted') || false; // Default to false
};
// Check if current tech can support native fullscreen
// (e.g. with built in controls like iOS, so not our flash swf)
/**
* Check to see if fullscreen is supported
*
* @return {Boolean}
* @method supportsFullScreen
*/
Player.prototype.supportsFullScreen = function supportsFullScreen() {
return this.techGet('supportsFullScreen') || false;
};
/**
* Check if the player is in fullscreen mode
* ```js
* // get
* var fullscreenOrNot = myPlayer.isFullscreen();
* // set
* myPlayer.isFullscreen(true); // tell the player it's in fullscreen
* ```
* NOTE: As of the latest HTML5 spec, isFullscreen is no longer an official
* property and instead document.fullscreenElement is used. But isFullscreen is
* still a valuable property for internal player workings.
*
* @param {Boolean=} isFS Update the player's fullscreen state
* @return {Boolean} true if fullscreen false if not when getting
* @return {Player} self when setting
* @method isFullscreen
*/
Player.prototype.isFullscreen = function isFullscreen(isFS) {
if (isFS !== undefined) {
this.isFullscreen_ = !!isFS;
return this;
}
return !!this.isFullscreen_;
};
/**
* Increase the size of the video to full screen
* ```js
* myPlayer.requestFullscreen();
* ```
* In some browsers, full screen is not supported natively, so it enters
* "full window mode", where the video fills the browser window.
* In browsers and devices that support native full screen, sometimes the
* browser's default controls will be shown, and not the Video.js custom skin.
* This includes most mobile devices (iOS, Android) and older versions of
* Safari.
*
* @return {Player} self
* @method requestFullscreen
*/
Player.prototype.requestFullscreen = function requestFullscreen() {
var fsApi = _fullscreenApiJs2['default'];
this.isFullscreen(true);
if (fsApi.requestFullscreen) {
// the browser supports going fullscreen at the element level so we can
// take the controls fullscreen as well as the video
// Trigger fullscreenchange event after change
// We have to specifically add this each time, and remove
// when canceling fullscreen. Otherwise if there's multiple
// players on a page, they would all be reacting to the same fullscreen
// events
Events.on(_globalDocument2['default'], fsApi.fullscreenchange, Fn.bind(this, function documentFullscreenChange(e) {
this.isFullscreen(_globalDocument2['default'][fsApi.fullscreenElement]);
// If cancelling fullscreen, remove event listener.
if (this.isFullscreen() === false) {
Events.off(_globalDocument2['default'], fsApi.fullscreenchange, documentFullscreenChange);
}
this.trigger('fullscreenchange');
}));
this.el_[fsApi.requestFullscreen]();
} else if (this.tech.supportsFullScreen()) {
// we can't take the video.js controls fullscreen but we can go fullscreen
// with native controls
this.techCall('enterFullScreen');
} else {
// fullscreen isn't supported so we'll just stretch the video element to
// fill the viewport
this.enterFullWindow();
this.trigger('fullscreenchange');
}
return this;
};
/**
* Return the video to its normal size after having been in full screen mode
* ```js
* myPlayer.exitFullscreen();
* ```
*
* @return {Player} self
* @method exitFullscreen
*/
Player.prototype.exitFullscreen = function exitFullscreen() {
var fsApi = _fullscreenApiJs2['default'];
this.isFullscreen(false);
// Check for browser element fullscreen support
if (fsApi.requestFullscreen) {
_globalDocument2['default'][fsApi.exitFullscreen]();
} else if (this.tech.supportsFullScreen()) {
this.techCall('exitFullScreen');
} else {
this.exitFullWindow();
this.trigger('fullscreenchange');
}
return this;
};
/**
* When fullscreen isn't supported we can stretch the video container to as wide as the browser will let us.
*
* @method enterFullWindow
*/
Player.prototype.enterFullWindow = function enterFullWindow() {
this.isFullWindow = true;
// Storing original doc overflow value to return to when fullscreen is off
this.docOrigOverflow = _globalDocument2['default'].documentElement.style.overflow;
// Add listener for esc key to exit fullscreen
Events.on(_globalDocument2['default'], 'keydown', Fn.bind(this, this.fullWindowOnEscKey));
// Hide any scroll bars
_globalDocument2['default'].documentElement.style.overflow = 'hidden';
// Apply fullscreen styles
Dom.addElClass(_globalDocument2['default'].body, 'vjs-full-window');
this.trigger('enterFullWindow');
};
/**
* Check for call to either exit full window or full screen on ESC key
*
* @param {String} event Event to check for key press
* @method fullWindowOnEscKey
*/
Player.prototype.fullWindowOnEscKey = function fullWindowOnEscKey(event) {
if (event.keyCode === 27) {
if (this.isFullscreen() === true) {
this.exitFullscreen();
} else {
this.exitFullWindow();
}
}
};
/**
* Exit full window
*
* @method exitFullWindow
*/
Player.prototype.exitFullWindow = function exitFullWindow() {
this.isFullWindow = false;
Events.off(_globalDocument2['default'], 'keydown', this.fullWindowOnEscKey);
// Unhide scroll bars.
_globalDocument2['default'].documentElement.style.overflow = this.docOrigOverflow;
// Remove fullscreen styles
Dom.removeElClass(_globalDocument2['default'].body, 'vjs-full-window');
// Resize the box, controller, and poster to original sizes
// this.positionAll();
this.trigger('exitFullWindow');
};
/**
* Select source based on tech order
*
* @param {Array} sources The sources for a media asset
* @return {Object|Boolean} Object of source and tech order, otherwise false
* @method selectSource
*/
Player.prototype.selectSource = function selectSource(sources) {
// Loop through each playback technology in the options order
for (var i = 0, j = this.options_.techOrder; i < j.length; i++) {
var techName = _utilsToTitleCaseJs2['default'](j[i]);
var tech = _componentJs2['default'].getComponent(techName);
// Check if the current tech is defined before continuing
if (!tech) {
_utilsLogJs2['default'].error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
continue;
}
// Check if the browser supports this technology
if (tech.isSupported()) {
// Loop through each source object
for (var a = 0, b = sources; a < b.length; a++) {
var source = b[a];
// Check if source can be played with this technology
if (tech.canPlaySource(source)) {
return { source: source, tech: techName };
}
}
}
}
return false;
};
/**
* The source function updates the video source
* There are three types of variables you can pass as the argument.
* **URL String**: A URL to the the video file. Use this method if you are sure
* the current playback technology (HTML5/Flash) can support the source you
* provide. Currently only MP4 files can be used in both HTML5 and Flash.
* ```js
* myPlayer.src("http://www.example.com/path/to/video.mp4");
* ```
* **Source Object (or element):* * A javascript object containing information
* about the source file. Use this method if you want the player to determine if
* it can support the file using the type information.
* ```js
* myPlayer.src({ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4" });
* ```
* **Array of Source Objects:* * To provide multiple versions of the source so
* that it can be played using HTML5 across browsers you can use an array of
* source objects. Video.js will detect which version is supported and load that
* file.
* ```js
* myPlayer.src([
* { type: "video/mp4", src: "http://www.example.com/path/to/video.mp4" },
* { type: "video/webm", src: "http://www.example.com/path/to/video.webm" },
* { type: "video/ogg", src: "http://www.example.com/path/to/video.ogv" }
* ]);
* ```
*
* @param {String|Object|Array=} source The source URL, object, or array of sources
* @return {String} The current video source when getting
* @return {String} The player when setting
* @method src
*/
Player.prototype.src = function src(source) {
if (source === undefined) {
return this.techGet('src');
}
var currentTech = _componentJs2['default'].getComponent(this.techName);
// case: Array of source objects to choose from and pick the best to play
if (Array.isArray(source)) {
this.sourceList_(source);
// case: URL String (http://myvideo...)
} else if (typeof source === 'string') {
// create a source object from the string
this.src({ src: source });
// case: Source object { src: '', type: '' ... }
} else if (source instanceof Object) {
// check if the source has a type and the loaded tech cannot play the source
// if there's no type we'll just try the current tech
if (source.type && !currentTech.canPlaySource(source)) {
// create a source list with the current source and send through
// the tech loop to check for a compatible technology
this.sourceList_([source]);
} else {
this.cache_.src = source.src;
this.currentType_ = source.type || '';
// wait until the tech is ready to set the source
this.ready(function () {
// The setSource tech method was added with source handlers
// so older techs won't support it
// We need to check the direct prototype for the case where subclasses
// of the tech do not support source handlers
if (currentTech.prototype.hasOwnProperty('setSource')) {
this.techCall('setSource', source);
} else {
this.techCall('src', source.src);
}
if (this.options_.preload === 'auto') {
this.load();
}
if (this.options_.autoplay) {
this.play();
}
// Set the source synchronously if possible (#2326)
}, true);
}
}
return this;
};
/**
* Handle an array of source objects
*
* @param {Array} sources Array of source objects
* @private
* @method sourceList_
*/
Player.prototype.sourceList_ = function sourceList_(sources) {
var sourceTech = this.selectSource(sources);
if (sourceTech) {
if (sourceTech.tech === this.techName) {
// if this technology is already loaded, set the source
this.src(sourceTech.source);
} else {
// load this technology with the chosen source
this.loadTech(sourceTech.tech, sourceTech.source);
}
} else {
// We need to wrap this in a timeout to give folks a chance to add error event handlers
this.setTimeout(function () {
this.error({ code: 4, message: this.localize(this.options_.notSupportedMessage) });
}, 0);
// we could not find an appropriate tech, but let's still notify the delegate that this is it
// this needs a better comment about why this is needed
this.triggerReady();
}
};
/**
* Begin loading the src data.
*
* @return {Player} Returns the player
* @method load
*/
Player.prototype.load = function load() {
this.techCall('load');
return this;
};
/**
* Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4
* Can be used in conjuction with `currentType` to assist in rebuilding the current source object.
*
* @return {String} The current source
* @method currentSrc
*/
Player.prototype.currentSrc = function currentSrc() {
return this.techGet('currentSrc') || this.cache_.src || '';
};
/**
* Get the current source type e.g. video/mp4
* This can allow you rebuild the current source object so that you could load the same
* source and tech later
*
* @return {String} The source MIME type
* @method currentType
*/
Player.prototype.currentType = function currentType() {
return this.currentType_ || '';
};
/**
* Get or set the preload attribute
*
* @param {Boolean} value Boolean to determine if preload should be used
* @return {String} The preload attribute value when getting
* @return {Player} Returns the player when setting
* @method preload
*/
Player.prototype.preload = function preload(value) {
if (value !== undefined) {
this.techCall('setPreload', value);
this.options_.preload = value;
return this;
}
return this.techGet('preload');
};
/**
* Get or set the autoplay attribute.
*
* @param {Boolean} value Boolean to determine if preload should be used
* @return {String} The autoplay attribute value when getting
* @return {Player} Returns the player when setting
* @method autoplay
*/
Player.prototype.autoplay = function autoplay(value) {
if (value !== undefined) {
this.techCall('setAutoplay', value);
this.options_.autoplay = value;
return this;
}
return this.techGet('autoplay', value);
};
/**
* Get or set the loop attribute on the video element.
*
* @param {Boolean} value Boolean to determine if preload should be used
* @return {String} The loop attribute value when getting
* @return {Player} Returns the player when setting
* @method loop
*/
Player.prototype.loop = function loop(value) {
if (value !== undefined) {
this.techCall('setLoop', value);
this.options_['loop'] = value;
return this;
}
return this.techGet('loop');
};
/**
* get or set the poster image source url
* ##### EXAMPLE:
* ```js
* // get
* var currentPoster = myPlayer.poster();
* // set
* myPlayer.poster('http://example.com/myImage.jpg');
* ```
*
* @param {String=} src Poster image source URL
* @return {String} poster URL when getting
* @return {Player} self when setting
* @method poster
*/
Player.prototype.poster = function poster(src) {
if (src === undefined) {
return this.poster_;
}
// The correct way to remove a poster is to set as an empty string
// other falsey values will throw errors
if (!src) {
src = '';
}
// update the internal poster variable
this.poster_ = src;
// update the tech's poster
this.techCall('setPoster', src);
// alert components that the poster has been set
this.trigger('posterchange');
return this;
};
/**
* Get or set whether or not the controls are showing.
*
* @param {Boolean} bool Set controls to showing or not
* @return {Boolean} Controls are showing
* @method controls
*/
Player.prototype.controls = function controls(bool) {
if (bool !== undefined) {
bool = !!bool; // force boolean
// Don't trigger a change event unless it actually changed
if (this.controls_ !== bool) {
this.controls_ = bool;
if (this.usingNativeControls()) {
this.techCall('setControls', bool);
}
if (bool) {
this.removeClass('vjs-controls-disabled');
this.addClass('vjs-controls-enabled');
this.trigger('controlsenabled');
if (!this.usingNativeControls()) {
this.addTechControlsListeners();
}
} else {
this.removeClass('vjs-controls-enabled');
this.addClass('vjs-controls-disabled');
this.trigger('controlsdisabled');
if (!this.usingNativeControls()) {
this.removeTechControlsListeners();
}
}
}
return this;
}
return !!this.controls_;
};
/**
* Toggle native controls on/off. Native controls are the controls built into
* devices (e.g. default iPhone controls), Flash, or other techs
* (e.g. Vimeo Controls)
* **This should only be set by the current tech, because only the tech knows
* if it can support native controls**
*
* @param {Boolean} bool True signals that native controls are on
* @return {Player} Returns the player
* @private
* @method usingNativeControls
*/
Player.prototype.usingNativeControls = function usingNativeControls(bool) {
if (bool !== undefined) {
bool = !!bool; // force boolean
// Don't trigger a change event unless it actually changed
if (this.usingNativeControls_ !== bool) {
this.usingNativeControls_ = bool;
if (bool) {
this.addClass('vjs-using-native-controls');
/**
* player is using the native device controls
*
* @event usingnativecontrols
* @memberof Player
* @instance
* @private
*/
this.trigger('usingnativecontrols');
} else {
this.removeClass('vjs-using-native-controls');
/**
* player is using the custom HTML controls
*
* @event usingcustomcontrols
* @memberof Player
* @instance
* @private
*/
this.trigger('usingcustomcontrols');
}
}
return this;
}
return !!this.usingNativeControls_;
};
/**
* Set or get the current MediaError
*
* @param {*} err A MediaError or a String/Number to be turned into a MediaError
* @return {MediaError|null} when getting
* @return {Player} when setting
* @method error
*/
Player.prototype.error = function error(err) {
if (err === undefined) {
return this.error_ || null;
}
// restoring to default
if (err === null) {
this.error_ = err;
this.removeClass('vjs-error');
return this;
}
// error instance
if (err instanceof _mediaErrorJs2['default']) {
this.error_ = err;
} else {
this.error_ = new _mediaErrorJs2['default'](err);
}
// fire an error event on the player
this.trigger('error');
// add the vjs-error classname to the player
this.addClass('vjs-error');
// log the name of the error type and any message
// ie8 just logs "[object object]" if you just log the error object
_utilsLogJs2['default'].error('(CODE:' + this.error_.code + ' ' + _mediaErrorJs2['default'].errorTypes[this.error_.code] + ')', this.error_.message, this.error_);
return this;
};
/**
* Returns whether or not the player is in the "ended" state.
*
* @return {Boolean} True if the player is in the ended state, false if not.
* @method ended
*/
Player.prototype.ended = function ended() {
return this.techGet('ended');
};
/**
* Returns whether or not the player is in the "seeking" state.
*
* @return {Boolean} True if the player is in the seeking state, false if not.
* @method seeking
*/
Player.prototype.seeking = function seeking() {
return this.techGet('seeking');
};
/**
* Returns the TimeRanges of the media that are currently available
* for seeking to.
*
* @return {TimeRanges} the seekable intervals of the media timeline
* @method seekable
*/
Player.prototype.seekable = function seekable() {
return this.techGet('seekable');
};
/**
* Report user activity
*
* @param {Object} event Event object
* @method reportUserActivity
*/
Player.prototype.reportUserActivity = function reportUserActivity(event) {
this.userActivity_ = true;
};
/**
* Get/set if user is active
*
* @param {Boolean} bool Value when setting
* @return {Boolean} Value if user is active user when getting
* @method userActive
*/
Player.prototype.userActive = function userActive(bool) {
if (bool !== undefined) {
bool = !!bool;
if (bool !== this.userActive_) {
this.userActive_ = bool;
if (bool) {
// If the user was inactive and is now active we want to reset the
// inactivity timer
this.userActivity_ = true;
this.removeClass('vjs-user-inactive');
this.addClass('vjs-user-active');
this.trigger('useractive');
} else {
// We're switching the state to inactive manually, so erase any other
// activity
this.userActivity_ = false;
// Chrome/Safari/IE have bugs where when you change the cursor it can
// trigger a mousemove event. This causes an issue when you're hiding
// the cursor when the user is inactive, and a mousemove signals user
// activity. Making it impossible to go into inactive mode. Specifically
// this happens in fullscreen when we really need to hide the cursor.
//
// When this gets resolved in ALL browsers it can be removed
// https://code.google.com/p/chromium/issues/detail?id=103041
if (this.tech) {
this.tech.one('mousemove', function (e) {
e.stopPropagation();
e.preventDefault();
});
}
this.removeClass('vjs-user-active');
this.addClass('vjs-user-inactive');
this.trigger('userinactive');
}
}
return this;
}
return this.userActive_;
};
/**
* Listen for user activity based on timeout value
*
* @method listenForUserActivity
*/
Player.prototype.listenForUserActivity = function listenForUserActivity() {
var mouseInProgress = undefined,
lastMoveX = undefined,
lastMoveY = undefined;
var handleActivity = Fn.bind(this, this.reportUserActivity);
var handleMouseMove = function handleMouseMove(e) {
// #1068 - Prevent mousemove spamming
// Chrome Bug: https://code.google.com/p/chromium/issues/detail?id=366970
if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
lastMoveX = e.screenX;
lastMoveY = e.screenY;
handleActivity();
}
};
var handleMouseDown = function handleMouseDown() {
handleActivity();
// For as long as the they are touching the device or have their mouse down,
// we consider them active even if they're not moving their finger or mouse.
// So we want to continue to update that they are active
this.clearInterval(mouseInProgress);
// Setting userActivity=true now and setting the interval to the same time
// as the activityCheck interval (250) should ensure we never miss the
// next activityCheck
mouseInProgress = this.setInterval(handleActivity, 250);
};
var handleMouseUp = function handleMouseUp(event) {
handleActivity();
// Stop the interval that maintains activity if the mouse/touch is down
this.clearInterval(mouseInProgress);
};
// Any mouse movement will be considered user activity
this.on('mousedown', handleMouseDown);
this.on('mousemove', handleMouseMove);
this.on('mouseup', handleMouseUp);
// Listen for keyboard navigation
// Shouldn't need to use inProgress interval because of key repeat
this.on('keydown', handleActivity);
this.on('keyup', handleActivity);
// Run an interval every 250 milliseconds instead of stuffing everything into
// the mousemove/touchmove function itself, to prevent performance degradation.
// `this.reportUserActivity` simply sets this.userActivity_ to true, which
// then gets picked up by this loop
// http://ejohn.org/blog/learning-from-twitter/
var inactivityTimeout = undefined;
var activityCheck = this.setInterval(function () {
// Check to see if mouse/touch activity has happened
if (this.userActivity_) {
// Reset the activity tracker
this.userActivity_ = false;
// If the user state was inactive, set the state to active
this.userActive(true);
// Clear any existing inactivity timeout to start the timer over
this.clearTimeout(inactivityTimeout);
var timeout = this.options_['inactivityTimeout'];
if (timeout > 0) {
// In <timeout> milliseconds, if no more activity has occurred the
// user will be considered inactive
inactivityTimeout = this.setTimeout(function () {
// Protect against the case where the inactivityTimeout can trigger just
// before the next user activity is picked up by the activityCheck loop
// causing a flicker
if (!this.userActivity_) {
this.userActive(false);
}
}, timeout);
}
}
}, 250);
};
/**
* Gets or sets the current playback rate. A playback rate of
* 1.0 represents normal speed and 0.5 would indicate half-speed
* playback, for instance.
* @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-playbackrate
*
* @param {Number} rate New playback rate to set.
* @return {Number} Returns the new playback rate when setting
* @return {Number} Returns the current playback rate when getting
* @method playbackRate
*/
Player.prototype.playbackRate = function playbackRate(rate) {
if (rate !== undefined) {
this.techCall('setPlaybackRate', rate);
return this;
}
if (this.tech && this.tech['featuresPlaybackRate']) {
return this.techGet('playbackRate');
} else {
return 1.0;
}
};
/**
* Gets or sets the audio flag
*
* @param {Boolean} bool True signals that this is an audio player.
* @return {Boolean} Returns true if player is audio, false if not when getting
* @return {Player} Returns the player if setting
* @private
* @method isAudio
*/
Player.prototype.isAudio = function isAudio(bool) {
if (bool !== undefined) {
this.isAudio_ = !!bool;
return this;
}
return !!this.isAudio_;
};
/**
* Returns the current state of network activity for the element, from
* the codes in the list below.
* - NETWORK_EMPTY (numeric value 0)
* The element has not yet been initialised. All attributes are in
* their initial states.
* - NETWORK_IDLE (numeric value 1)
* The element's resource selection algorithm is active and has
* selected a resource, but it is not actually using the network at
* this time.
* - NETWORK_LOADING (numeric value 2)
* The user agent is actively trying to download data.
* - NETWORK_NO_SOURCE (numeric value 3)
* The element's resource selection algorithm is active, but it has
* not yet found a resource to use.
*
* @see https://html.spec.whatwg.org/multipage/embedded-content.html#network-states
* @return {Number} the current network activity state
* @method networkState
*/
Player.prototype.networkState = function networkState() {
return this.techGet('networkState');
};
/**
* Returns a value that expresses the current state of the element
* with respect to rendering the current playback position, from the
* codes in the list below.
* - HAVE_NOTHING (numeric value 0)
* No information regarding the media resource is available.
* - HAVE_METADATA (numeric value 1)
* Enough of the resource has been obtained that the duration of the
* resource is available.
* - HAVE_CURRENT_DATA (numeric value 2)
* Data for the immediate current playback position is available.
* - HAVE_FUTURE_DATA (numeric value 3)
* Data for the immediate current playback position is available, as
* well as enough data for the user agent to advance the current
* playback position in the direction of playback.
* - HAVE_ENOUGH_DATA (numeric value 4)
* The user agent estimates that enough data is available for
* playback to proceed uninterrupted.
*
* @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-readystate
* @return {Number} the current playback rendering state
* @method readyState
*/
Player.prototype.readyState = function readyState() {
return this.techGet('readyState');
};
/*
* Text tracks are tracks of timed text events.
* Captions - text displayed over the video for the hearing impaired
* Subtitles - text displayed over the video for those who don't understand language in the video
* Chapters - text displayed in a menu allowing the user to jump to particular points (chapters) in the video
* Descriptions (not supported yet) - audio descriptions that are read back to the user by a screen reading device
*/
/**
* Get an array of associated text tracks. captions, subtitles, chapters, descriptions
* http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks
*
* @return {Array} Array of track objects
* @method textTracks
*/
Player.prototype.textTracks = function textTracks() {
// cannot use techGet directly because it checks to see whether the tech is ready.
// Flash is unlikely to be ready in time but textTracks should still work.
return this.tech && this.tech['textTracks']();
};
/**
* Get an array of remote text tracks
*
* @return {Array}
* @method remoteTextTracks
*/
Player.prototype.remoteTextTracks = function remoteTextTracks() {
return this.tech && this.tech['remoteTextTracks']();
};
/**
* Add a text track
* In addition to the W3C settings we allow adding additional info through options.
* http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack
*
* @param {String} kind Captions, subtitles, chapters, descriptions, or metadata
* @param {String=} label Optional label
* @param {String=} language Optional language
* @method addTextTrack
*/
Player.prototype.addTextTrack = function addTextTrack(kind, label, language) {
return this.tech && this.tech['addTextTrack'](kind, label, language);
};
/**
* Add a remote text track
*
* @param {Object} options Options for remote text track
* @method addRemoteTextTrack
*/
Player.prototype.addRemoteTextTrack = function addRemoteTextTrack(options) {
return this.tech && this.tech['addRemoteTextTrack'](options);
};
/**
* Remove a remote text track
*
* @param {Object} track Remote text track to remove
* @method removeRemoteTextTrack
*/
Player.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
this.tech && this.tech['removeRemoteTextTrack'](track);
};
/**
* Get video width
*
* @return {Number} Video width
* @method videoWidth
*/
Player.prototype.videoWidth = function videoWidth() {
return this.tech && this.tech.videoWidth && this.tech.videoWidth() || 0;
};
/**
* Get video height
*
* @return {Number} Video height
* @method videoHeight
*/
Player.prototype.videoHeight = function videoHeight() {
return this.tech && this.tech.videoHeight && this.tech.videoHeight() || 0;
};
// Methods to add support for
// initialTime: function(){ return this.techCall('initialTime'); },
// startOffsetTime: function(){ return this.techCall('startOffsetTime'); },
// played: function(){ return this.techCall('played'); },
// seekable: function(){ return this.techCall('seekable'); },
// videoTracks: function(){ return this.techCall('videoTracks'); },
// audioTracks: function(){ return this.techCall('audioTracks'); },
// defaultPlaybackRate: function(){ return this.techCall('defaultPlaybackRate'); },
// mediaGroup: function(){ return this.techCall('mediaGroup'); },
// controller: function(){ return this.techCall('controller'); },
// defaultMuted: function(){ return this.techCall('defaultMuted'); }
// TODO
// currentSrcList: the array of sources including other formats and bitrates
// playList: array of source lists in order of playback
/**
* The player's language code
* NOTE: The language should be set in the player options if you want the
* the controls to be built with a specific language. Changing the lanugage
* later will not update controls text.
*
* @param {String} code The locale string
* @return {String} The locale string when getting
* @return {Player} self when setting
* @method language
*/
Player.prototype.language = function language(code) {
if (code === undefined) {
return this.language_;
}
this.language_ = ('' + code).toLowerCase();
return this;
};
/**
* Get the player's language dictionary
* Merge every time, because a newly added plugin might call videojs.addLanguage() at any time
* Languages specified directly in the player options have precedence
*
* @return {Array} Array of languages
* @method languages
*/
Player.prototype.languages = function languages() {
return _utilsMergeOptionsJs2['default'](Player.prototype.options_.languages, this.languages_);
};
/**
* Converts track info to JSON
*
* @return {Object} JSON object of options
* @method toJSON
*/
Player.prototype.toJSON = function toJSON() {
var options = _utilsMergeOptionsJs2['default'](this.options_);
var tracks = options.tracks;
options.tracks = [];
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
// deep merge tracks and null out player so no circular references
track = _utilsMergeOptionsJs2['default'](track);
track.player = undefined;
options.tracks[i] = track;
}
return options;
};
/**
* Gets tag settings
*
* @param {Element} tag The player tag
* @return {Array} An array of sources and track objects
* @static
* @method getTagSettings
*/
Player.getTagSettings = function getTagSettings(tag) {
var baseOptions = {
'sources': [],
'tracks': []
};
var tagOptions = Dom.getElAttributes(tag);
var dataSetup = tagOptions['data-setup'];
// Check if data-setup attr exists.
if (dataSetup !== null) {
// Parse options JSON
var _safeParseTuple = _safeJsonParseTuple2['default'](dataSetup || '{}');
var err = _safeParseTuple[0];
var data = _safeParseTuple[1];
if (err) {
_utilsLogJs2['default'].error(err);
}
_objectAssign2['default'](tagOptions, data);
}
_objectAssign2['default'](baseOptions, tagOptions);
// Get tag children settings
if (tag.hasChildNodes()) {
var children = tag.childNodes;
for (var i = 0, j = children.length; i < j; i++) {
var child = children[i];
// Change case needed: http://ejohn.org/blog/nodename-case-sensitivity/
var childName = child.nodeName.toLowerCase();
if (childName === 'source') {
baseOptions.sources.push(Dom.getElAttributes(child));
} else if (childName === 'track') {
baseOptions.tracks.push(Dom.getElAttributes(child));
}
}
}
return baseOptions;
};
return Player;
})(_componentJs2['default']);
Player.players = {};
var navigator = _globalWindow2['default'].navigator;
/*
* Player instance options, surfaced using options
* options = Player.prototype.options_
* Make changes in options, not here.
*
* @type {Object}
* @private
*/
Player.prototype.options_ = {
// Default order of fallback technology
techOrder: ['html5', 'flash'],
// techOrder: ['flash','html5'],
html5: {},
flash: {},
// defaultVolume: 0.85,
defaultVolume: 0.00, // The freakin seaguls are driving me crazy!
// default inactivity timeout
inactivityTimeout: 2000,
// default playback rates
playbackRates: [],
// Add playback rate selection by adding rates
// 'playbackRates': [0.5, 1, 1.5, 2],
// Included control sets
children: {
mediaLoader: {},
posterImage: {},
textTrackDisplay: {},
loadingSpinner: {},
bigPlayButton: {},
controlBar: {},
errorDisplay: {},
textTrackSettings: {}
},
language: _globalDocument2['default'].getElementsByTagName('html')[0].getAttribute('lang') || navigator.languages && navigator.languages[0] || navigator.userLanguage || navigator.language || 'en',
// locales and their language translations
languages: {},
// Default message to show when a video cannot be played.
notSupportedMessage: 'No compatible source was found for this video.'
};
/**
* Fired when the player has initial duration and dimension information
*
* @event loadedmetadata
*/
Player.prototype.handleLoadedMetaData;
/**
* Fired when the player has downloaded data at the current playback position
*
* @event loadeddata
*/
Player.prototype.handleLoadedData;
/**
* Fired when the player has finished downloading the source data
*
* @event loadedalldata
*/
Player.prototype.handleLoadedAllData;
/**
* Fired when the user is active, e.g. moves the mouse over the player
*
* @event useractive
*/
Player.prototype.handleUserActive;
/**
* Fired when the user is inactive, e.g. a short delay after the last mouse move or control interaction
*
* @event userinactive
*/
Player.prototype.handleUserInactive;
/**
* Fired when the current playback position has changed *
* During playback this is fired every 15-250 milliseconds, depending on the
* playback technology in use.
*
* @event timeupdate
*/
Player.prototype.handleTimeUpdate;
/**
* Fired when the volume changes
*
* @event volumechange
*/
Player.prototype.handleVolumeChange;
/**
* Fired when an error occurs
*
* @event error
*/
Player.prototype.handleError;
Player.prototype.flexNotSupported_ = function () {
var elem = _globalDocument2['default'].createElement('i');
// Note: We don't actually use flexBasis (or flexOrder), but it's one of the more
// common flex features that we can rely on when checking for flex support.
return !('flexBasis' in elem.style || 'webkitFlexBasis' in elem.style || 'mozFlexBasis' in elem.style || 'msFlexBasis' in elem.style || 'msFlexOrder' in elem.style) /* IE10-specific (2012 flex spec) */;
};
_componentJs2['default'].registerComponent('Player', Player);
exports['default'] = Player;
module.exports = exports['default'];
// If empty string, make it a parsable json object.
},{"./big-play-button.js":46,"./component.js":48,"./control-bar/control-bar.js":49,"./error-display.js":78,"./fullscreen-api.js":81,"./loading-spinner.js":82,"./media-error.js":83,"./poster-image.js":89,"./tech/html5.js":94,"./tech/loader.js":95,"./tracks/text-track-display.js":98,"./tracks/text-track-list-converter.js":100,"./tracks/text-track-settings.js":102,"./utils/browser.js":104,"./utils/buffer.js":105,"./utils/dom.js":107,"./utils/events.js":108,"./utils/fn.js":109,"./utils/guid.js":111,"./utils/log.js":112,"./utils/merge-options.js":113,"./utils/stylesheet.js":114,"./utils/time-ranges.js":115,"./utils/to-title-case.js":116,"global/document":1,"global/window":2,"object.assign":40,"safe-json-parse/tuple":45}],88:[function(_dereq_,module,exports){
/**
* @file plugins.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _playerJs = _dereq_('./player.js');
var _playerJs2 = _interopRequireDefault(_playerJs);
/**
* The method for registering a video.js plugin
*
* @param {String} name The name of the plugin
* @param {Function} init The function that is run when the player inits
* @method plugin
*/
var plugin = function plugin(name, init) {
_playerJs2['default'].prototype[name] = init;
};
exports['default'] = plugin;
module.exports = exports['default'];
},{"./player.js":87}],89:[function(_dereq_,module,exports){
/**
* @file poster-image.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _buttonJs = _dereq_('./button.js');
var _buttonJs2 = _interopRequireDefault(_buttonJs);
var _componentJs = _dereq_('./component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsFnJs = _dereq_('./utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsDomJs = _dereq_('./utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsBrowserJs = _dereq_('./utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
/**
* The component that handles showing the poster image.
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Button
* @class PosterImage
*/
var PosterImage = (function (_Button) {
_inherits(PosterImage, _Button);
function PosterImage(player, options) {
_classCallCheck(this, PosterImage);
_Button.call(this, player, options);
this.update();
player.on('posterchange', Fn.bind(this, this.update));
}
/**
* Clean up the poster image
*
* @method dispose
*/
PosterImage.prototype.dispose = function dispose() {
this.player().off('posterchange', this.update);
_Button.prototype.dispose.call(this);
};
/**
* Create the poster's image element
*
* @return {Element}
* @method createEl
*/
PosterImage.prototype.createEl = function createEl() {
var el = Dom.createEl('div', {
className: 'vjs-poster',
// Don't want poster to be tabbable.
tabIndex: -1
});
// To ensure the poster image resizes while maintaining its original aspect
// ratio, use a div with `background-size` when available. For browsers that
// do not support `background-size` (e.g. IE8), fall back on using a regular
// img element.
if (!browser.BACKGROUND_SIZE_SUPPORTED) {
this.fallbackImg_ = Dom.createEl('img');
el.appendChild(this.fallbackImg_);
}
return el;
};
/**
* Event handler for updates to the player's poster source
*
* @method update
*/
PosterImage.prototype.update = function update() {
var url = this.player().poster();
this.setSrc(url);
// If there's no poster source we should display:none on this component
// so it's not still clickable or right-clickable
if (url) {
this.show();
} else {
this.hide();
}
};
/**
* Set the poster source depending on the display method
*
* @param {String} url The URL to the poster source
* @method setSrc
*/
PosterImage.prototype.setSrc = function setSrc(url) {
if (this.fallbackImg_) {
this.fallbackImg_.src = url;
} else {
var backgroundImage = '';
// Any falsey values should stay as an empty string, otherwise
// this will throw an extra error
if (url) {
backgroundImage = 'url("' + url + '")';
}
this.el_.style.backgroundImage = backgroundImage;
}
};
/**
* Event handler for clicks on the poster image
*
* @method handleClick
*/
PosterImage.prototype.handleClick = function handleClick() {
// We don't want a click to trigger playback when controls are disabled
// but CSS should be hiding the poster to prevent that from happening
if (this.player_.paused()) {
this.player_.play();
} else {
this.player_.pause();
}
};
return PosterImage;
})(_buttonJs2['default']);
_componentJs2['default'].registerComponent('PosterImage', PosterImage);
exports['default'] = PosterImage;
module.exports = exports['default'];
},{"./button.js":47,"./component.js":48,"./utils/browser.js":104,"./utils/dom.js":107,"./utils/fn.js":109}],90:[function(_dereq_,module,exports){
/**
* @file setup.js
*
* Functions for automatically setting up a player
* based on the data-setup attribute of the video tag
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _utilsEventsJs = _dereq_('./utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _windowLoaded = false;
var videojs = undefined;
// Automatically set up any tags that have a data-setup attribute
var autoSetup = function autoSetup() {
// One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*
// var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));
// var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));
// var mediaEls = vids.concat(audios);
// Because IE8 doesn't support calling slice on a node list, we need to loop through each list of elements
// to build up a new, combined list of elements.
var vids = _globalDocument2['default'].getElementsByTagName('video');
var audios = _globalDocument2['default'].getElementsByTagName('audio');
var mediaEls = [];
if (vids && vids.length > 0) {
for (var i = 0, e = vids.length; i < e; i++) {
mediaEls.push(vids[i]);
}
}
if (audios && audios.length > 0) {
for (var i = 0, e = audios.length; i < e; i++) {
mediaEls.push(audios[i]);
}
}
// Check if any media elements exist
if (mediaEls && mediaEls.length > 0) {
for (var i = 0, e = mediaEls.length; i < e; i++) {
var mediaEl = mediaEls[i];
// Check if element exists, has getAttribute func.
// IE seems to consider typeof el.getAttribute == 'object' instead of 'function' like expected, at least when loading the player immediately.
if (mediaEl && mediaEl.getAttribute) {
// Make sure this player hasn't already been set up.
if (mediaEl['player'] === undefined) {
var options = mediaEl.getAttribute('data-setup');
// Check if data-setup attr exists.
// We only auto-setup if they've added the data-setup attr.
if (options !== null) {
// Create new video.js instance.
var player = videojs(mediaEl);
}
}
// If getAttribute isn't defined, we need to wait for the DOM.
} else {
autoSetupTimeout(1);
break;
}
}
// No videos were found, so keep looping unless page is finished loading.
} else if (!_windowLoaded) {
autoSetupTimeout(1);
}
};
// Pause to let the DOM keep processing
var autoSetupTimeout = function autoSetupTimeout(wait, vjs) {
videojs = vjs;
setTimeout(autoSetup, wait);
};
if (_globalDocument2['default'].readyState === 'complete') {
_windowLoaded = true;
} else {
Events.one(_globalWindow2['default'], 'load', function () {
_windowLoaded = true;
});
}
var hasLoaded = function hasLoaded() {
return _windowLoaded;
};
exports.autoSetup = autoSetup;
exports.autoSetupTimeout = autoSetupTimeout;
exports.hasLoaded = hasLoaded;
},{"./utils/events.js":108,"global/document":1,"global/window":2}],91:[function(_dereq_,module,exports){
/**
* @file slider.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _componentJs = _dereq_('../component.js');
var _componentJs2 = _interopRequireDefault(_componentJs);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* The base functionality for sliders like the volume bar and seek bar
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Component
* @class Slider
*/
var Slider = (function (_Component) {
_inherits(Slider, _Component);
function Slider(player, options) {
_classCallCheck(this, Slider);
_Component.call(this, player, options);
// Set property names to bar to match with the child Slider class is looking for
this.bar = this.getChild(this.options_.barName);
// Set a horizontal or vertical class on the slider depending on the slider type
this.vertical(!!this.options_.vertical);
this.on('mousedown', this.handleMouseDown);
this.on('touchstart', this.handleMouseDown);
this.on('focus', this.handleFocus);
this.on('blur', this.handleBlur);
this.on('click', this.handleClick);
this.on(player, 'controlsvisible', this.update);
this.on(player, this.playerEvent, this.update);
}
/**
* Create the component's DOM element
*
* @param {String} type Type of element to create
* @param {Object=} props List of properties in Object form
* @return {Element}
* @method createEl
*/
Slider.prototype.createEl = function createEl(type) {
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
// Add the slider element class to all sub classes
props.className = props.className + ' vjs-slider';
props = _objectAssign2['default']({
'role': 'slider',
'aria-valuenow': 0,
'aria-valuemin': 0,
'aria-valuemax': 100,
tabIndex: 0
}, props);
return _Component.prototype.createEl.call(this, type, props);
};
/**
* Handle mouse down on slider
*
* @param {Object} event Mouse down event object
* @method handleMouseDown
*/
Slider.prototype.handleMouseDown = function handleMouseDown(event) {
event.preventDefault();
Dom.blockTextSelection();
this.addClass('vjs-sliding');
this.on(_globalDocument2['default'], 'mousemove', this.handleMouseMove);
this.on(_globalDocument2['default'], 'mouseup', this.handleMouseUp);
this.on(_globalDocument2['default'], 'touchmove', this.handleMouseMove);
this.on(_globalDocument2['default'], 'touchend', this.handleMouseUp);
this.handleMouseMove(event);
};
/**
* To be overridden by a subclass
*
* @method handleMouseMove
*/
Slider.prototype.handleMouseMove = function handleMouseMove() {};
/**
* Handle mouse up on Slider
*
* @method handleMouseUp
*/
Slider.prototype.handleMouseUp = function handleMouseUp() {
Dom.unblockTextSelection();
this.removeClass('vjs-sliding');
this.off(_globalDocument2['default'], 'mousemove', this.handleMouseMove);
this.off(_globalDocument2['default'], 'mouseup', this.handleMouseUp);
this.off(_globalDocument2['default'], 'touchmove', this.handleMouseMove);
this.off(_globalDocument2['default'], 'touchend', this.handleMouseUp);
this.update();
};
/**
* Update slider
*
* @method update
*/
Slider.prototype.update = function update() {
// In VolumeBar init we have a setTimeout for update that pops and update to the end of the
// execution stack. The player is destroyed before then update will cause an error
if (!this.el_) return;
// If scrubbing, we could use a cached value to make the handle keep up with the user's mouse.
// On HTML5 browsers scrubbing is really smooth, but some flash players are slow, so we might want to utilize this later.
// var progress = (this.player_.scrubbing()) ? this.player_.getCache().currentTime / this.player_.duration() : this.player_.currentTime() / this.player_.duration();
var progress = this.getPercent();
var bar = this.bar;
// If there's no bar...
if (!bar) return;
// Protect against no duration and other division issues
if (typeof progress !== 'number' || progress !== progress || progress < 0 || progress === Infinity) {
progress = 0;
}
// Convert to a percentage for setting
var percentage = (progress * 100).toFixed(2) + '%';
// Set the new bar width or height
if (this.vertical()) {
bar.el().style.height = percentage;
} else {
bar.el().style.width = percentage;
}
};
/**
* Calculate distance for slider
*
* @param {Object} event Event object
* @method calculateDistance
*/
Slider.prototype.calculateDistance = function calculateDistance(event) {
var el = this.el_;
var box = Dom.findElPosition(el);
var boxW = el.offsetWidth;
var boxH = el.offsetHeight;
if (this.vertical()) {
var boxY = box.top;
var pageY = undefined;
if (event.changedTouches) {
pageY = event.changedTouches[0].pageY;
} else {
pageY = event.pageY;
}
// Percent that the click is through the adjusted area
return Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH));
} else {
var boxX = box.left;
var pageX = undefined;
if (event.changedTouches) {
pageX = event.changedTouches[0].pageX;
} else {
pageX = event.pageX;
}
// Percent that the click is through the adjusted area
return Math.max(0, Math.min(1, (pageX - boxX) / boxW));
}
};
/**
* Handle on focus for slider
*
* @method handleFocus
*/
Slider.prototype.handleFocus = function handleFocus() {
this.on(_globalDocument2['default'], 'keydown', this.handleKeyPress);
};
/**
* Handle key press for slider
*
* @param {Object} event Event object
* @method handleKeyPress
*/
Slider.prototype.handleKeyPress = function handleKeyPress(event) {
if (event.which === 37 || event.which === 40) {
// Left and Down Arrows
event.preventDefault();
this.stepBack();
} else if (event.which === 38 || event.which === 39) {
// Up and Right Arrows
event.preventDefault();
this.stepForward();
}
};
/**
* Handle on blur for slider
*
* @method handleBlur
*/
Slider.prototype.handleBlur = function handleBlur() {
this.off(_globalDocument2['default'], 'keydown', this.handleKeyPress);
};
/**
* Listener for click events on slider, used to prevent clicks
* from bubbling up to parent elements like button menus.
*
* @param {Object} event Event object
* @method handleClick
*/
Slider.prototype.handleClick = function handleClick(event) {
event.stopImmediatePropagation();
event.preventDefault();
};
/**
* Get/set if slider is horizontal for vertical
*
* @param {Boolean} bool True if slider is vertical, false is horizontal
* @return {Boolean} True if slider is vertical, false is horizontal
* @method vertical
*/
Slider.prototype.vertical = function vertical(bool) {
if (bool === undefined) {
return this.vertical_ || false;
}
this.vertical_ = !!bool;
if (this.vertical_) {
this.addClass('vjs-slider-vertical');
} else {
this.addClass('vjs-slider-horizontal');
}
return this;
};
return Slider;
})(_componentJs2['default']);
_componentJs2['default'].registerComponent('Slider', Slider);
exports['default'] = Slider;
module.exports = exports['default'];
},{"../component.js":48,"../utils/dom.js":107,"global/document":1,"object.assign":40}],92:[function(_dereq_,module,exports){
/**
* @file flash-rtmp.js
*/
'use strict';
exports.__esModule = true;
function FlashRtmpDecorator(Flash) {
Flash.streamingFormats = {
'rtmp/mp4': 'MP4',
'rtmp/flv': 'FLV'
};
Flash.streamFromParts = function (connection, stream) {
return connection + '&' + stream;
};
Flash.streamToParts = function (src) {
var parts = {
connection: '',
stream: ''
};
if (!src) return parts;
// Look for the normal URL separator we expect, '&'.
// If found, we split the URL into two pieces around the
// first '&'.
var connEnd = src.indexOf('&');
var streamBegin = undefined;
if (connEnd !== -1) {
streamBegin = connEnd + 1;
} else {
// If there's not a '&', we use the last '/' as the delimiter.
connEnd = streamBegin = src.lastIndexOf('/') + 1;
if (connEnd === 0) {
// really, there's not a '/'?
connEnd = streamBegin = src.length;
}
}
parts.connection = src.substring(0, connEnd);
parts.stream = src.substring(streamBegin, src.length);
return parts;
};
Flash.isStreamingType = function (srcType) {
return srcType in Flash.streamingFormats;
};
// RTMP has four variations, any string starting
// with one of these protocols should be valid
Flash.RTMP_RE = /^rtmp[set]?:\/\//i;
Flash.isStreamingSrc = function (src) {
return Flash.RTMP_RE.test(src);
};
/**
* A source handler for RTMP urls
* @type {Object}
*/
Flash.rtmpSourceHandler = {};
/**
* Check Flash can handle the source natively
* @param {Object} source The source object
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Flash.rtmpSourceHandler.canHandleSource = function (source) {
if (Flash.isStreamingType(source.type) || Flash.isStreamingSrc(source.src)) {
return 'maybe';
}
return '';
};
/**
* Pass the source to the flash object
* Adaptive source handlers will have more complicated workflows before passing
* video data to the video element
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
*/
Flash.rtmpSourceHandler.handleSource = function (source, tech) {
var srcParts = Flash.streamToParts(source.src);
tech['setRtmpConnection'](srcParts.connection);
tech['setRtmpStream'](srcParts.stream);
};
// Register the native source handler
Flash.registerSourceHandler(Flash.rtmpSourceHandler);
return Flash;
}
exports['default'] = FlashRtmpDecorator;
module.exports = exports['default'];
},{}],93:[function(_dereq_,module,exports){
/**
* @file flash.js
* VideoJS-SWF - Custom Flash Player with HTML5-ish API
* https://github.com/zencoder/video-js-swf
* Not using setupTriggers. Using global onEvent func to distribute events
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _tech = _dereq_('./tech');
var _tech2 = _interopRequireDefault(_tech);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsUrlJs = _dereq_('../utils/url.js');
var Url = _interopRequireWildcard(_utilsUrlJs);
var _utilsTimeRangesJs = _dereq_('../utils/time-ranges.js');
var _flashRtmp = _dereq_('./flash-rtmp');
var _flashRtmp2 = _interopRequireDefault(_flashRtmp);
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var navigator = _globalWindow2['default'].navigator;
/**
* Flash Media Controller - Wrapper for fallback SWF API
*
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends Tech
* @class Flash
*/
var Flash = (function (_Tech) {
_inherits(Flash, _Tech);
function Flash(options, ready) {
_classCallCheck(this, Flash);
_Tech.call(this, options, ready);
// Set the source when ready
if (options.source) {
this.ready(function () {
this.setSource(options.source);
}, true);
}
// Having issues with Flash reloading on certain page actions (hide/resize/fullscreen) in certain browsers
// This allows resetting the playhead when we catch the reload
if (options.startTime) {
this.ready(function () {
this.load();
this.play();
this.currentTime(options.startTime);
}, true);
}
// Add global window functions that the swf expects
// A 4.x workflow we weren't able to solve for in 5.0
// because of the need to hard code these functions
// into the swf for security reasons
_globalWindow2['default'].videojs = _globalWindow2['default'].videojs || {};
_globalWindow2['default'].videojs.Flash = _globalWindow2['default'].videojs.Flash || {};
_globalWindow2['default'].videojs.Flash.onReady = Flash.onReady;
_globalWindow2['default'].videojs.Flash.onEvent = Flash.onEvent;
_globalWindow2['default'].videojs.Flash.onError = Flash.onError;
this.on('seeked', function () {
this.lastSeekTarget_ = undefined;
});
}
// Create setters and getters for attributes
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
Flash.prototype.createEl = function createEl() {
var options = this.options_;
// If video.js is hosted locally you should also set the location
// for the hosted swf, which should be relative to the page (not video.js)
// Otherwise this adds a CDN url.
// The CDN also auto-adds a swf URL for that specific version.
if (!options.swf) {
options.swf = '//vjs.zencdn.net/swf/5.0.0-rc1/video-js.swf';
}
// Generate ID for swf object
var objId = options.techId;
// Merge default flashvars with ones passed in to init
var flashVars = _objectAssign2['default']({
// SWF Callback Functions
'readyFunction': 'videojs.Flash.onReady',
'eventProxyFunction': 'videojs.Flash.onEvent',
'errorEventProxyFunction': 'videojs.Flash.onError',
// Player Settings
'autoplay': options.autoplay,
'preload': options.preload,
'loop': options.loop,
'muted': options.muted
}, options.flashVars);
// Merge default parames with ones passed in
var params = _objectAssign2['default']({
'wmode': 'opaque', // Opaque is needed to overlay controls, but can affect playback performance
'bgcolor': '#000000' // Using bgcolor prevents a white flash when the object is loading
}, options.params);
// Merge default attributes with ones passed in
var attributes = _objectAssign2['default']({
'id': objId,
'name': objId, // Both ID and Name needed or swf to identify itself
'class': 'vjs-tech'
}, options.attributes);
this.el_ = Flash.embed(options.swf, flashVars, params, attributes);
this.el_.tech = this;
return this.el_;
};
/**
* Play for flash tech
*
* @method play
*/
Flash.prototype.play = function play() {
if (this.ended()) {
this.setCurrentTime(0);
}
this.el_.vjs_play();
};
/**
* Pause for flash tech
*
* @method pause
*/
Flash.prototype.pause = function pause() {
this.el_.vjs_pause();
};
/**
* Get/set video
*
* @param {Object=} src Source object
* @return {Object}
* @method src
*/
Flash.prototype.src = function src(_src) {
if (_src === undefined) {
return this.currentSrc();
}
// Setting src through `src` not `setSrc` will be deprecated
return this.setSrc(_src);
};
/**
* Set video
*
* @param {Object=} src Source object
* @deprecated
* @method setSrc
*/
Flash.prototype.setSrc = function setSrc(src) {
// Make sure source URL is absolute.
src = Url.getAbsoluteURL(src);
this.el_.vjs_src(src);
// Currently the SWF doesn't autoplay if you load a source later.
// e.g. Load player w/ no source, wait 2s, set src.
if (this.autoplay()) {
var tech = this;
this.setTimeout(function () {
tech.play();
}, 0);
}
};
/**
* Returns true if the tech is currently seeking.
* @return {boolean} true if seeking
*/
Flash.prototype.seeking = function seeking() {
return this.lastSeekTarget_ !== undefined;
};
/**
* Set current time
*
* @param {Number} time Current time of video
* @method setCurrentTime
*/
Flash.prototype.setCurrentTime = function setCurrentTime(time) {
var seekable = this.seekable();
if (seekable.length) {
// clamp to the current seekable range
time = time > seekable.start(0) ? time : seekable.start(0);
time = time < seekable.end(seekable.length - 1) ? time : seekable.end(seekable.length - 1);
this.lastSeekTarget_ = time;
this.trigger('seeking');
this.el_.vjs_setProperty('currentTime', time);
_Tech.prototype.setCurrentTime.call(this);
}
};
/**
* Get current time
*
* @param {Number=} time Current time of video
* @return {Number} Current time
* @method currentTime
*/
Flash.prototype.currentTime = function currentTime(time) {
// when seeking make the reported time keep up with the requested time
// by reading the time we're seeking to
if (this.seeking()) {
return this.lastSeekTarget_ || 0;
}
return this.el_.vjs_getProperty('currentTime');
};
/**
* Get current source
*
* @method currentSrc
*/
Flash.prototype.currentSrc = function currentSrc() {
if (this.currentSource_) {
return this.currentSource_.src;
} else {
return this.el_.vjs_getProperty('currentSrc');
}
};
/**
* Load media into player
*
* @method load
*/
Flash.prototype.load = function load() {
this.el_.vjs_load();
};
/**
* Get poster
*
* @method poster
*/
Flash.prototype.poster = function poster() {
this.el_.vjs_getProperty('poster');
};
/**
* Poster images are not handled by the Flash tech so make this a no-op
*
* @method setPoster
*/
Flash.prototype.setPoster = function setPoster() {};
/**
* Determine if can seek in media
*
* @return {TimeRangeObject}
* @method seekable
*/
Flash.prototype.seekable = function seekable() {
var duration = this.duration();
if (duration === 0) {
return _utilsTimeRangesJs.createTimeRange();
}
return _utilsTimeRangesJs.createTimeRange(0, duration);
};
/**
* Get buffered time range
*
* @return {TimeRangeObject}
* @method buffered
*/
Flash.prototype.buffered = function buffered() {
var ranges = this.el_.vjs_getProperty('buffered');
if (ranges.length === 0) {
return _utilsTimeRangesJs.createTimeRange();
}
return _utilsTimeRangesJs.createTimeRange(ranges[0][0], ranges[0][1]);
};
/**
* Get fullscreen support -
* Flash does not allow fullscreen through javascript
* so always returns false
*
* @return {Boolean} false
* @method supportsFullScreen
*/
Flash.prototype.supportsFullScreen = function supportsFullScreen() {
return false; // Flash does not allow fullscreen through javascript
};
/**
* Request to enter fullscreen
* Flash does not allow fullscreen through javascript
* so always returns false
*
* @return {Boolean} false
* @method enterFullScreen
*/
Flash.prototype.enterFullScreen = function enterFullScreen() {
return false;
};
return Flash;
})(_tech2['default']);
var _api = Flash.prototype;
var _readWrite = 'rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(',');
var _readOnly = 'networkState,readyState,initialTime,duration,startOffsetTime,paused,ended,videoTracks,audioTracks,videoWidth,videoHeight'.split(',');
function _createSetter(attr) {
var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
_api['set' + attrUpper] = function (val) {
return this.el_.vjs_setProperty(attr, val);
};
}
function _createGetter(attr) {
_api[attr] = function () {
return this.el_.vjs_getProperty(attr);
};
}
// Create getter and setters for all read/write attributes
for (var i = 0; i < _readWrite.length; i++) {
_createGetter(_readWrite[i]);
_createSetter(_readWrite[i]);
}
// Create getters for read-only attributes
for (var i = 0; i < _readOnly.length; i++) {
_createGetter(_readOnly[i]);
}
/* Flash Support Testing -------------------------------------------------------- */
Flash.isSupported = function () {
return Flash.version()[0] >= 10;
// return swfobject.hasFlashPlayerVersion('10');
};
// Add Source Handler pattern functions to this tech
_tech2['default'].withSourceHandlers(Flash);
/*
* The default native source handler.
* This simply passes the source to the video element. Nothing fancy.
*
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
*/
Flash.nativeSourceHandler = {};
/*
* Check Flash can handle the source natively
*
* @param {Object} source The source object
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Flash.nativeSourceHandler.canHandleSource = function (source) {
var type;
function guessMimeType(src) {
var ext = Url.getFileExtension(src);
if (ext) {
return 'video/' + ext;
}
return '';
}
if (!source.type) {
type = guessMimeType(source.src);
} else {
// Strip code information from the type because we don't get that specific
type = source.type.replace(/;.*/, '').toLowerCase();
}
if (type in Flash.formats) {
return 'maybe';
}
return '';
};
/*
* Pass the source to the flash object
* Adaptive source handlers will have more complicated workflows before passing
* video data to the video element
*
* @param {Object} source The source object
* @param {Flash} tech The instance of the Flash tech
*/
Flash.nativeSourceHandler.handleSource = function (source, tech) {
tech.setSrc(source.src);
};
/*
* Clean up the source handler when disposing the player or switching sources..
* (no cleanup is needed when supporting the format natively)
*/
Flash.nativeSourceHandler.dispose = function () {};
// Register the native source handler
Flash.registerSourceHandler(Flash.nativeSourceHandler);
Flash.formats = {
'video/flv': 'FLV',
'video/x-flv': 'FLV',
'video/mp4': 'MP4',
'video/m4v': 'MP4'
};
Flash.onReady = function (currSwf) {
var el = Dom.getEl(currSwf);
var tech = el && el.tech;
// if there is no el then the tech has been disposed
// and the tech element was removed from the player div
if (tech && tech.el()) {
// check that the flash object is really ready
Flash.checkReady(tech);
}
};
// The SWF isn't always ready when it says it is. Sometimes the API functions still need to be added to the object.
// If it's not ready, we set a timeout to check again shortly.
Flash.checkReady = function (tech) {
// stop worrying if the tech has been disposed
if (!tech.el()) {
return;
}
// check if API property exists
if (tech.el().vjs_getProperty) {
// tell tech it's ready
tech.triggerReady();
} else {
// wait longer
this.setTimeout(function () {
Flash['checkReady'](tech);
}, 50);
}
};
// Trigger events from the swf on the player
Flash.onEvent = function (swfID, eventName) {
var tech = Dom.getEl(swfID).tech;
tech.trigger(eventName);
};
// Log errors from the swf
Flash.onError = function (swfID, err) {
var tech = Dom.getEl(swfID).tech;
// trigger MEDIA_ERR_SRC_NOT_SUPPORTED
if (err === 'srcnotfound') {
return tech.error(4);
}
// trigger a custom error
tech.error('FLASH: ' + err);
};
// Flash Version Check
Flash.version = function () {
var version = '0,0,0';
// IE
try {
version = new _globalWindow2['default'].ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
// other browsers
} catch (e) {
try {
if (navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
version = (navigator.plugins['Shockwave Flash 2.0'] || navigator.plugins['Shockwave Flash']).description.replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
}
} catch (err) {}
}
return version.split(',');
};
// Flash embedding method. Only used in non-iframe mode
Flash.embed = function (swf, flashVars, params, attributes) {
var code = Flash.getEmbedCode(swf, flashVars, params, attributes);
// Get element by embedding code and retrieving created element
var obj = Dom.createEl('div', { innerHTML: code }).childNodes[0];
return obj;
};
Flash.getEmbedCode = function (swf, flashVars, params, attributes) {
var objTag = '<object type="application/x-shockwave-flash" ';
var flashVarsString = '';
var paramsString = '';
var attrsString = '';
// Convert flash vars to string
if (flashVars) {
Object.getOwnPropertyNames(flashVars).forEach(function (key) {
flashVarsString += key + '=' + flashVars[key] + '&';
});
}
// Add swf, flashVars, and other default params
params = _objectAssign2['default']({
'movie': swf,
'flashvars': flashVarsString,
'allowScriptAccess': 'always', // Required to talk to swf
'allowNetworking': 'all' // All should be default, but having security issues.
}, params);
// Create param tags string
Object.getOwnPropertyNames(params).forEach(function (key) {
paramsString += '<param name="' + key + '" value="' + params[key] + '" />';
});
attributes = _objectAssign2['default']({
// Add swf to attributes (need both for IE and Others to work)
'data': swf,
// Default to 100% width/height
'width': '100%',
'height': '100%'
}, attributes);
// Create Attributes string
Object.getOwnPropertyNames(attributes).forEach(function (key) {
attrsString += key + '="' + attributes[key] + '" ';
});
return '' + objTag + attrsString + '>' + paramsString + '</object>';
};
// Run Flash through the RTMP decorator
_flashRtmp2['default'](Flash);
_component2['default'].registerComponent('Flash', Flash);
exports['default'] = Flash;
module.exports = exports['default'];
},{"../component":48,"../utils/dom.js":107,"../utils/time-ranges.js":115,"../utils/url.js":117,"./flash-rtmp":92,"./tech":96,"global/window":2,"object.assign":40}],94:[function(_dereq_,module,exports){
/**
* @file html5.js
* HTML5 Media Controller - Wrapper for HTML5 Media API
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _techJs = _dereq_('./tech.js');
var _techJs2 = _interopRequireDefault(_techJs);
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _utilsDomJs = _dereq_('../utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsUrlJs = _dereq_('../utils/url.js');
var Url = _interopRequireWildcard(_utilsUrlJs);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsLogJs = _dereq_('../utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _utilsMergeOptionsJs = _dereq_('../utils/merge-options.js');
var _utilsMergeOptionsJs2 = _interopRequireDefault(_utilsMergeOptionsJs);
/**
* HTML5 Media Controller - Wrapper for HTML5 Media API
*
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends Tech
* @class Html5
*/
var Html5 = (function (_Tech) {
_inherits(Html5, _Tech);
function Html5(options, ready) {
_classCallCheck(this, Html5);
_Tech.call(this, options, ready);
var source = options.source;
// Set the source if one is provided
// 1) Check if the source is new (if not, we want to keep the original so playback isn't interrupted)
// 2) Check to see if the network state of the tag was failed at init, and if so, reset the source
// anyway so the error gets fired.
if (source && (this.el_.currentSrc !== source.src || options.tag && options.tag.initNetworkState_ === 3)) {
this.setSource(source);
}
if (this.el_.hasChildNodes()) {
var nodes = this.el_.childNodes;
var nodesLength = nodes.length;
var removeNodes = [];
while (nodesLength--) {
var node = nodes[nodesLength];
var nodeName = node.nodeName.toLowerCase();
if (nodeName === 'track') {
if (!this.featuresNativeTextTracks) {
// Empty video tag tracks so the built-in player doesn't use them also.
// This may not be fast enough to stop HTML5 browsers from reading the tags
// so we'll need to turn off any default tracks if we're manually doing
// captions and subtitles. videoElement.textTracks
removeNodes.push(node);
} else {
this.remoteTextTracks().addTrack_(node.track);
}
}
}
for (var i = 0; i < removeNodes.length; i++) {
this.el_.removeChild(removeNodes[i]);
}
}
if (this.featuresNativeTextTracks) {
this.handleTextTrackChange_ = Fn.bind(this, this.handleTextTrackChange);
this.handleTextTrackAdd_ = Fn.bind(this, this.handleTextTrackAdd);
this.handleTextTrackRemove_ = Fn.bind(this, this.handleTextTrackRemove);
this.proxyNativeTextTracks_();
}
// Determine if native controls should be used
// Our goal should be to get the custom controls on mobile solid everywhere
// so we can remove this all together. Right now this will block custom
// controls on touch enabled laptops like the Chrome Pixel
if (browser.TOUCH_ENABLED && options.nativeControlsForTouch === true || browser.IS_IPHONE || browser.IS_NATIVE_ANDROID) {
this.setControls(true);
}
this.triggerReady();
}
/* HTML5 Support Testing ---------------------------------------------------- */
/*
* Element for testing browser HTML5 video capabilities
*
* @type {Element}
* @constant
* @private
*/
/**
* Dispose of html5 media element
*
* @method dispose
*/
Html5.prototype.dispose = function dispose() {
var tt = this.el().textTracks;
var emulatedTt = this.textTracks();
// remove native event listeners
if (tt && tt.removeEventListener) {
tt.removeEventListener('change', this.handleTextTrackChange_);
tt.removeEventListener('addtrack', this.handleTextTrackAdd_);
tt.removeEventListener('removetrack', this.handleTextTrackRemove_);
}
// clearout the emulated text track list.
var i = emulatedTt.length;
while (i--) {
emulatedTt.removeTrack_(emulatedTt[i]);
}
Html5.disposeMediaElement(this.el_);
_Tech.prototype.dispose.call(this);
};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
Html5.prototype.createEl = function createEl() {
var el = this.options_.tag;
// Check if this browser supports moving the element into the box.
// On the iPhone video will break if you move the element,
// So we have to create a brand new element.
if (!el || this['movingMediaElementInDOM'] === false) {
// If the original tag is still there, clone and remove it.
if (el) {
var clone = el.cloneNode(true);
el.parentNode.insertBefore(clone, el);
Html5.disposeMediaElement(el);
el = clone;
} else {
el = _globalDocument2['default'].createElement('video');
// determine if native controls should be used
var tagAttributes = this.options_.tag && Dom.getElAttributes(this.options_.tag);
var attributes = _utilsMergeOptionsJs2['default']({}, tagAttributes);
if (!browser.TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) {
delete attributes.controls;
}
Dom.setElAttributes(el, _objectAssign2['default'](attributes, {
id: this.options_.techId,
'class': 'vjs-tech'
}));
}
}
// Update specific tag settings, in case they were overridden
var settingsAttrs = ['autoplay', 'preload', 'loop', 'muted'];
for (var i = settingsAttrs.length - 1; i >= 0; i--) {
var attr = settingsAttrs[i];
var overwriteAttrs = {};
if (typeof this.options_[attr] !== 'undefined') {
overwriteAttrs[attr] = this.options_[attr];
}
Dom.setElAttributes(el, overwriteAttrs);
}
return el;
// jenniisawesome = true;
};
Html5.prototype.proxyNativeTextTracks_ = function proxyNativeTextTracks_() {
var tt = this.el().textTracks;
if (tt && tt.addEventListener) {
tt.addEventListener('change', this.handleTextTrackChange_);
tt.addEventListener('addtrack', this.handleTextTrackAdd_);
tt.addEventListener('removetrack', this.handleTextTrackRemove_);
}
};
Html5.prototype.handleTextTrackChange = function handleTextTrackChange(e) {
var tt = this.textTracks();
this.textTracks().trigger({
type: 'change',
target: tt,
currentTarget: tt,
srcElement: tt
});
};
Html5.prototype.handleTextTrackAdd = function handleTextTrackAdd(e) {
this.textTracks().addTrack_(e.track);
};
Html5.prototype.handleTextTrackRemove = function handleTextTrackRemove(e) {
this.textTracks().removeTrack_(e.track);
};
/**
* Play for html5 tech
*
* @method play
*/
Html5.prototype.play = function play() {
this.el_.play();
};
/**
* Pause for html5 tech
*
* @method pause
*/
Html5.prototype.pause = function pause() {
this.el_.pause();
};
/**
* Paused for html5 tech
*
* @return {Boolean}
* @method paused
*/
Html5.prototype.paused = function paused() {
return this.el_.paused;
};
/**
* Get current time
*
* @return {Number}
* @method currentTime
*/
Html5.prototype.currentTime = function currentTime() {
return this.el_.currentTime;
};
/**
* Set current time
*
* @param {Number} seconds Current time of video
* @method setCurrentTime
*/
Html5.prototype.setCurrentTime = function setCurrentTime(seconds) {
try {
this.el_.currentTime = seconds;
} catch (e) {
_utilsLogJs2['default'](e, 'Video is not ready. (Video.js)');
// this.warning(VideoJS.warnings.videoNotReady);
}
};
/**
* Get duration
*
* @return {Number}
* @method duration
*/
Html5.prototype.duration = function duration() {
return this.el_.duration || 0;
};
/**
* Get a TimeRange object that represents the intersection
* of the time ranges for which the user agent has all
* relevant media
*
* @return {TimeRangeObject}
* @method buffered
*/
Html5.prototype.buffered = function buffered() {
return this.el_.buffered;
};
/**
* Get volume level
*
* @return {Number}
* @method volume
*/
Html5.prototype.volume = function volume() {
return this.el_.volume;
};
/**
* Set volume level
*
* @param {Number} percentAsDecimal Volume percent as a decimal
* @method setVolume
*/
Html5.prototype.setVolume = function setVolume(percentAsDecimal) {
this.el_.volume = percentAsDecimal;
};
/**
* Get if muted
*
* @return {Boolean}
* @method muted
*/
Html5.prototype.muted = function muted() {
return this.el_.muted;
};
/**
* Set muted
*
* @param {Boolean} If player is to be muted or note
* @method setMuted
*/
Html5.prototype.setMuted = function setMuted(muted) {
this.el_.muted = muted;
};
/**
* Get player width
*
* @return {Number}
* @method width
*/
Html5.prototype.width = function width() {
return this.el_.offsetWidth;
};
/**
* Get player height
*
* @return {Number}
* @method height
*/
Html5.prototype.height = function height() {
return this.el_.offsetHeight;
};
/**
* Get if there is fullscreen support
*
* @return {Boolean}
* @method supportsFullScreen
*/
Html5.prototype.supportsFullScreen = function supportsFullScreen() {
if (typeof this.el_.webkitEnterFullScreen === 'function') {
var userAgent = _globalWindow2['default'].navigator.userAgent;
// Seems to be broken in Chromium/Chrome && Safari in Leopard
if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) {
return true;
}
}
return false;
};
/**
* Request to enter fullscreen
*
* @method enterFullScreen
*/
Html5.prototype.enterFullScreen = function enterFullScreen() {
var video = this.el_;
if ('webkitDisplayingFullscreen' in video) {
this.one('webkitbeginfullscreen', function () {
this.one('webkitendfullscreen', function () {
this.trigger('fullscreenchange', { isFullscreen: false });
});
this.trigger('fullscreenchange', { isFullscreen: true });
});
}
if (video.paused && video.networkState <= video.HAVE_METADATA) {
// attempt to prime the video element for programmatic access
// this isn't necessary on the desktop but shouldn't hurt
this.el_.play();
// playing and pausing synchronously during the transition to fullscreen
// can get iOS ~6.1 devices into a play/pause loop
this.setTimeout(function () {
video.pause();
video.webkitEnterFullScreen();
}, 0);
} else {
video.webkitEnterFullScreen();
}
};
/**
* Request to exit fullscreen
*
* @method exitFullScreen
*/
Html5.prototype.exitFullScreen = function exitFullScreen() {
this.el_.webkitExitFullScreen();
};
/**
* Get/set video
*
* @param {Object=} src Source object
* @return {Object}
* @method src
*/
Html5.prototype.src = function src(_src) {
if (_src === undefined) {
return this.el_.src;
} else {
// Setting src through `src` instead of `setSrc` will be deprecated
this.setSrc(_src);
}
};
/**
* Set video
*
* @param {Object} src Source object
* @deprecated
* @method setSrc
*/
Html5.prototype.setSrc = function setSrc(src) {
this.el_.src = src;
};
/**
* Load media into player
*
* @method load
*/
Html5.prototype.load = function load() {
this.el_.load();
};
/**
* Get current source
*
* @return {Object}
* @method currentSrc
*/
Html5.prototype.currentSrc = function currentSrc() {
return this.el_.currentSrc;
};
/**
* Get poster
*
* @return {String}
* @method poster
*/
Html5.prototype.poster = function poster() {
return this.el_.poster;
};
/**
* Set poster
*
* @param {String} val URL to poster image
* @method
*/
Html5.prototype.setPoster = function setPoster(val) {
this.el_.poster = val;
};
/**
* Get preload attribute
*
* @return {String}
* @method preload
*/
Html5.prototype.preload = function preload() {
return this.el_.preload;
};
/**
* Set preload attribute
*
* @param {String} val Value for preload attribute
* @method setPreload
*/
Html5.prototype.setPreload = function setPreload(val) {
this.el_.preload = val;
};
/**
* Get autoplay attribute
*
* @return {String}
* @method autoplay
*/
Html5.prototype.autoplay = function autoplay() {
return this.el_.autoplay;
};
/**
* Set autoplay attribute
*
* @param {String} val Value for preload attribute
* @method setAutoplay
*/
Html5.prototype.setAutoplay = function setAutoplay(val) {
this.el_.autoplay = val;
};
/**
* Get controls attribute
*
* @return {String}
* @method controls
*/
Html5.prototype.controls = function controls() {
return this.el_.controls;
};
/**
* Set controls attribute
*
* @param {String} val Value for controls attribute
* @method setControls
*/
Html5.prototype.setControls = function setControls(val) {
this.el_.controls = !!val;
};
/**
* Get loop attribute
*
* @return {String}
* @method loop
*/
Html5.prototype.loop = function loop() {
return this.el_.loop;
};
/**
* Set loop attribute
*
* @param {String} val Value for loop attribute
* @method setLoop
*/
Html5.prototype.setLoop = function setLoop(val) {
this.el_.loop = val;
};
/**
* Get error value
*
* @return {String}
* @method error
*/
Html5.prototype.error = function error() {
return this.el_.error;
};
/**
* Get whether or not the player is in the "seeking" state
*
* @return {Boolean}
* @method seeking
*/
Html5.prototype.seeking = function seeking() {
return this.el_.seeking;
};
/**
* Get a TimeRanges object that represents the
* ranges of the media resource to which it is possible
* for the user agent to seek.
*
* @return {TimeRangeObject}
* @method seekable
*/
Html5.prototype.seekable = function seekable() {
return this.el_.seekable;
};
/**
* Get if video ended
*
* @return {Boolean}
* @method ended
*/
Html5.prototype.ended = function ended() {
return this.el_.ended;
};
/**
* Get the value of the muted content attribute
* This attribute has no dynamic effect, it only
* controls the default state of the element
*
* @return {Boolean}
* @method defaultMuted
*/
Html5.prototype.defaultMuted = function defaultMuted() {
return this.el_.defaultMuted;
};
/**
* Get desired speed at which the media resource is to play
*
* @return {Number}
* @method playbackRate
*/
Html5.prototype.playbackRate = function playbackRate() {
return this.el_.playbackRate;
};
/**
* Returns a TimeRanges object that represents the ranges of the
* media resource that the user agent has played.
* @return {TimeRangeObject} the range of points on the media
* timeline that has been reached through normal playback
* @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-played
*/
Html5.prototype.played = function played() {
return this.el_.played;
};
/**
* Set desired speed at which the media resource is to play
*
* @param {Number} val Speed at which the media resource is to play
* @method setPlaybackRate
*/
Html5.prototype.setPlaybackRate = function setPlaybackRate(val) {
this.el_.playbackRate = val;
};
/**
* Get the current state of network activity for the element, from
* the list below
* NETWORK_EMPTY (numeric value 0)
* NETWORK_IDLE (numeric value 1)
* NETWORK_LOADING (numeric value 2)
* NETWORK_NO_SOURCE (numeric value 3)
*
* @return {Number}
* @method networkState
*/
Html5.prototype.networkState = function networkState() {
return this.el_.networkState;
};
/**
* Get a value that expresses the current state of the element
* with respect to rendering the current playback position, from
* the codes in the list below
* HAVE_NOTHING (numeric value 0)
* HAVE_METADATA (numeric value 1)
* HAVE_CURRENT_DATA (numeric value 2)
* HAVE_FUTURE_DATA (numeric value 3)
* HAVE_ENOUGH_DATA (numeric value 4)
*
* @return {Number}
* @method readyState
*/
Html5.prototype.readyState = function readyState() {
return this.el_.readyState;
};
/**
* Get width of video
*
* @return {Number}
* @method videoWidth
*/
Html5.prototype.videoWidth = function videoWidth() {
return this.el_.videoWidth;
};
/**
* Get height of video
*
* @return {Number}
* @method videoHeight
*/
Html5.prototype.videoHeight = function videoHeight() {
return this.el_.videoHeight;
};
/**
* Get text tracks
*
* @return {TextTrackList}
* @method textTracks
*/
Html5.prototype.textTracks = function textTracks() {
return _Tech.prototype.textTracks.call(this);
};
/**
* Creates and returns a text track object
*
* @param {String} kind Text track kind (subtitles, captions, descriptions
* chapters and metadata)
* @param {String=} label Label to identify the text track
* @param {String=} language Two letter language abbreviation
* @return {TextTrackObject}
* @method addTextTrack
*/
Html5.prototype.addTextTrack = function addTextTrack(kind, label, language) {
if (!this['featuresNativeTextTracks']) {
return _Tech.prototype.addTextTrack.call(this, kind, label, language);
}
return this.el_.addTextTrack(kind, label, language);
};
/**
* Creates and returns a remote text track object
*
* @param {Object} options The object should contain values for
* kind, language, label and src (location of the WebVTT file)
* @return {TextTrackObject}
* @method addRemoteTextTrack
*/
Html5.prototype.addRemoteTextTrack = function addRemoteTextTrack() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
if (!this['featuresNativeTextTracks']) {
return _Tech.prototype.addRemoteTextTrack.call(this, options);
}
var track = _globalDocument2['default'].createElement('track');
if (options['kind']) {
track['kind'] = options['kind'];
}
if (options['label']) {
track['label'] = options['label'];
}
if (options['language'] || options['srclang']) {
track['srclang'] = options['language'] || options['srclang'];
}
if (options['default']) {
track['default'] = options['default'];
}
if (options['id']) {
track['id'] = options['id'];
}
if (options['src']) {
track['src'] = options['src'];
}
this.el().appendChild(track);
this.remoteTextTracks().addTrack_(track.track);
return track;
};
/**
* Remove remote text track from TextTrackList object
*
* @param {TextTrackObject} track Texttrack object to remove
* @method removeRemoteTextTrack
*/
Html5.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
if (!this['featuresNativeTextTracks']) {
return _Tech.prototype.removeRemoteTextTrack.call(this, track);
}
var tracks, i;
this.remoteTextTracks().removeTrack_(track);
tracks = this.el().querySelectorAll('track');
i = tracks.length;
while (i--) {
if (track === tracks[i] || track === tracks[i].track) {
this.el().removeChild(tracks[i]);
}
}
};
return Html5;
})(_techJs2['default']);
Html5.TEST_VID = _globalDocument2['default'].createElement('video');
var track = _globalDocument2['default'].createElement('track');
track.kind = 'captions';
track.srclang = 'en';
track.label = 'English';
Html5.TEST_VID.appendChild(track);
/*
* Check if HTML5 video is supported by this browser/device
*
* @return {Boolean}
*/
Html5.isSupported = function () {
// IE9 with no Media Player is a LIAR! (#984)
try {
Html5.TEST_VID['volume'] = 0.5;
} catch (e) {
return false;
}
return !!Html5.TEST_VID.canPlayType;
};
// Add Source Handler pattern functions to this tech
_techJs2['default'].withSourceHandlers(Html5);
/*
* The default native source handler.
* This simply passes the source to the video element. Nothing fancy.
*
* @param {Object} source The source object
* @param {Html5} tech The instance of the HTML5 tech
*/
Html5.nativeSourceHandler = {};
/*
* Check if the video element can handle the source natively
*
* @param {Object} source The source object
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
Html5.nativeSourceHandler.canHandleSource = function (source) {
var match, ext;
function canPlayType(type) {
// IE9 on Windows 7 without MediaPlayer throws an error here
// https://github.com/videojs/video.js/issues/519
try {
return Html5.TEST_VID.canPlayType(type);
} catch (e) {
return '';
}
}
// If a type was provided we should rely on that
if (source.type) {
return canPlayType(source.type);
} else if (source.src) {
// If no type, fall back to checking 'video/[EXTENSION]'
ext = Url.getFileExtension(source.src);
return canPlayType('video/' + ext);
}
return '';
};
/*
* Pass the source to the video element
* Adaptive source handlers will have more complicated workflows before passing
* video data to the video element
*
* @param {Object} source The source object
* @param {Html5} tech The instance of the Html5 tech
*/
Html5.nativeSourceHandler.handleSource = function (source, tech) {
tech.setSrc(source.src);
};
/*
* Clean up the source handler when disposing the player or switching sources..
* (no cleanup is needed when supporting the format natively)
*/
Html5.nativeSourceHandler.dispose = function () {};
// Register the native source handler
Html5.registerSourceHandler(Html5.nativeSourceHandler);
/*
* Check if the volume can be changed in this browser/device.
* Volume cannot be changed in a lot of mobile devices.
* Specifically, it can't be changed from 1 on iOS.
*
* @return {Boolean}
*/
Html5.canControlVolume = function () {
var volume = Html5.TEST_VID.volume;
Html5.TEST_VID.volume = volume / 2 + 0.1;
return volume !== Html5.TEST_VID.volume;
};
/*
* Check if playbackRate is supported in this browser/device.
*
* @return {Number} [description]
*/
Html5.canControlPlaybackRate = function () {
var playbackRate = Html5.TEST_VID.playbackRate;
Html5.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
return playbackRate !== Html5.TEST_VID.playbackRate;
};
/*
* Check to see if native text tracks are supported by this browser/device
*
* @return {Boolean}
*/
Html5.supportsNativeTextTracks = function () {
var supportsTextTracks;
// Figure out native text track support
// If mode is a number, we cannot change it because it'll disappear from view.
// Browsers with numeric modes include IE10 and older (<=2013) samsung android models.
// Firefox isn't playing nice either with modifying the mode
// TODO: Investigate firefox: https://github.com/videojs/video.js/issues/1862
supportsTextTracks = !!Html5.TEST_VID.textTracks;
if (supportsTextTracks && Html5.TEST_VID.textTracks.length > 0) {
supportsTextTracks = typeof Html5.TEST_VID.textTracks[0]['mode'] !== 'number';
}
if (supportsTextTracks && browser.IS_FIREFOX) {
supportsTextTracks = false;
}
if (supportsTextTracks && !('onremovetrack' in Html5.TEST_VID.textTracks)) {
supportsTextTracks = false;
}
return supportsTextTracks;
};
/**
* An array of events available on the Html5 tech.
*
* @private
* @type {Array}
*/
Html5.Events = ['loadstart', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'durationchange', 'timeupdate', 'progress', 'play', 'pause', 'ratechange', 'volumechange'];
/*
* Set the tech's volume control support status
*
* @type {Boolean}
*/
Html5.prototype['featuresVolumeControl'] = Html5.canControlVolume();
/*
* Set the tech's playbackRate support status
*
* @type {Boolean}
*/
Html5.prototype['featuresPlaybackRate'] = Html5.canControlPlaybackRate();
/*
* Set the tech's status on moving the video element.
* In iOS, if you move a video element in the DOM, it breaks video playback.
*
* @type {Boolean}
*/
Html5.prototype['movingMediaElementInDOM'] = !browser.IS_IOS;
/*
* Set the the tech's fullscreen resize support status.
* HTML video is able to automatically resize when going to fullscreen.
* (No longer appears to be used. Can probably be removed.)
*/
Html5.prototype['featuresFullscreenResize'] = true;
/*
* Set the tech's progress event support status
* (this disables the manual progress events of the Tech)
*/
Html5.prototype['featuresProgressEvents'] = true;
/*
* Sets the tech's status on native text track support
*
* @type {Boolean}
*/
Html5.prototype['featuresNativeTextTracks'] = Html5.supportsNativeTextTracks();
// HTML5 Feature detection and Device Fixes --------------------------------- //
var canPlayType = undefined;
var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i;
var mp4RE = /^video\/mp4/i;
Html5.patchCanPlayType = function () {
// Android 4.0 and above can play HLS to some extent but it reports being unable to do so
if (browser.ANDROID_VERSION >= 4.0) {
if (!canPlayType) {
canPlayType = Html5.TEST_VID.constructor.prototype.canPlayType;
}
Html5.TEST_VID.constructor.prototype.canPlayType = function (type) {
if (type && mpegurlRE.test(type)) {
return 'maybe';
}
return canPlayType.call(this, type);
};
}
// Override Android 2.2 and less canPlayType method which is broken
if (browser.IS_OLD_ANDROID) {
if (!canPlayType) {
canPlayType = Html5.TEST_VID.constructor.prototype.canPlayType;
}
Html5.TEST_VID.constructor.prototype.canPlayType = function (type) {
if (type && mp4RE.test(type)) {
return 'maybe';
}
return canPlayType.call(this, type);
};
}
};
Html5.unpatchCanPlayType = function () {
var r = Html5.TEST_VID.constructor.prototype.canPlayType;
Html5.TEST_VID.constructor.prototype.canPlayType = canPlayType;
canPlayType = null;
return r;
};
// by default, patch the video element
Html5.patchCanPlayType();
Html5.disposeMediaElement = function (el) {
if (!el) {
return;
}
if (el.parentNode) {
el.parentNode.removeChild(el);
}
// remove any child track or source nodes to prevent their loading
while (el.hasChildNodes()) {
el.removeChild(el.firstChild);
}
// remove any src reference. not setting `src=''` because that causes a warning
// in firefox
el.removeAttribute('src');
// force the media element to update its loading state by calling load()
// however IE on Windows 7N has a bug that throws an error so need a try/catch (#793)
if (typeof el.load === 'function') {
// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)
(function () {
try {
el.load();
} catch (e) {
// not supported
}
})();
}
};
_component2['default'].registerComponent('Html5', Html5);
exports['default'] = Html5;
module.exports = exports['default'];
},{"../component":48,"../utils/browser.js":104,"../utils/dom.js":107,"../utils/fn.js":109,"../utils/log.js":112,"../utils/merge-options.js":113,"../utils/url.js":117,"./tech.js":96,"global/document":1,"global/window":2,"object.assign":40}],95:[function(_dereq_,module,exports){
/**
* @file loader.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _utilsToTitleCaseJs = _dereq_('../utils/to-title-case.js');
var _utilsToTitleCaseJs2 = _interopRequireDefault(_utilsToTitleCaseJs);
/**
* The Media Loader is the component that decides which playback technology to load
* when the player is initialized.
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends Component
* @class MediaLoader
*/
var MediaLoader = (function (_Component) {
_inherits(MediaLoader, _Component);
function MediaLoader(player, options, ready) {
_classCallCheck(this, MediaLoader);
_Component.call(this, player, options, ready);
// If there are no sources when the player is initialized,
// load the first supported playback technology.
if (!options.playerOptions['sources'] || options.playerOptions['sources'].length === 0) {
for (var i = 0, j = options.playerOptions['techOrder']; i < j.length; i++) {
var techName = _utilsToTitleCaseJs2['default'](j[i]);
var tech = _component2['default'].getComponent(techName);
// Check if the browser supports this technology
if (tech && tech.isSupported()) {
player.loadTech(techName);
break;
}
}
} else {
// // Loop through playback technologies (HTML5, Flash) and check for support.
// // Then load the best source.
// // A few assumptions here:
// // All playback technologies respect preload false.
player.src(options.playerOptions['sources']);
}
}
return MediaLoader;
})(_component2['default']);
_component2['default'].registerComponent('MediaLoader', MediaLoader);
exports['default'] = MediaLoader;
module.exports = exports['default'];
},{"../component":48,"../utils/to-title-case.js":116,"global/window":2}],96:[function(_dereq_,module,exports){
/**
* @file tech.js
* Media Technology Controller - Base class for media playback
* technology controllers like Flash and HTML5
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _tracksTextTrack = _dereq_('../tracks/text-track');
var _tracksTextTrack2 = _interopRequireDefault(_tracksTextTrack);
var _tracksTextTrackList = _dereq_('../tracks/text-track-list');
var _tracksTextTrackList2 = _interopRequireDefault(_tracksTextTrackList);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsLogJs = _dereq_('../utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _utilsTimeRangesJs = _dereq_('../utils/time-ranges.js');
var _utilsBufferJs = _dereq_('../utils/buffer.js');
var _mediaErrorJs = _dereq_('../media-error.js');
var _mediaErrorJs2 = _interopRequireDefault(_mediaErrorJs);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* Base class for media (HTML5 Video, Flash) controllers
*
* @param {Object=} options Options object
* @param {Function=} ready Ready callback function
* @extends Component
* @class Tech
*/
var Tech = (function (_Component) {
_inherits(Tech, _Component);
function Tech() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var ready = arguments.length <= 1 || arguments[1] === undefined ? function () {} : arguments[1];
_classCallCheck(this, Tech);
// we don't want the tech to report user activity automatically.
// This is done manually in addControlsListeners
options.reportTouchActivity = false;
_Component.call(this, null, options, ready);
// keep track of whether the current source has played at all to
// implement a very limited played()
this.hasStarted_ = false;
this.on('playing', function () {
this.hasStarted_ = true;
});
this.on('loadstart', function () {
this.hasStarted_ = false;
});
this.textTracks_ = options.textTracks;
// Manually track progress in cases where the browser/flash player doesn't report it.
if (!this.featuresProgressEvents) {
this.manualProgressOn();
}
// Manually track timeupdates in cases where the browser/flash player doesn't report it.
if (!this.featuresTimeupdateEvents) {
this.manualTimeUpdatesOn();
}
this.initControlsListeners();
if (options.nativeCaptions === false || options.nativeTextTracks === false) {
this.featuresNativeTextTracks = false;
}
if (!this.featuresNativeTextTracks) {
this.emulateTextTracks();
}
this.initTextTrackListeners();
// Turn on component tap events
this.emitTapEvents();
}
/*
* List of associated text tracks
*
* @type {Array}
* @private
*/
/**
* Set up click and touch listeners for the playback element
* On desktops, a click on the video itself will toggle playback,
* on a mobile device a click on the video toggles controls.
* (toggling controls is done by toggling the user state between active and
* inactive)
* A tap can signal that a user has become active, or has become inactive
* e.g. a quick tap on an iPhone movie should reveal the controls. Another
* quick tap should hide them again (signaling the user is in an inactive
* viewing state)
* In addition to this, we still want the user to be considered inactive after
* a few seconds of inactivity.
* Note: the only part of iOS interaction we can't mimic with this setup
* is a touch and hold on the video element counting as activity in order to
* keep the controls showing, but that shouldn't be an issue. A touch and hold on
* any controls will still keep the user active
*
* @method initControlsListeners
*/
Tech.prototype.initControlsListeners = function initControlsListeners() {
// if we're loading the playback object after it has started loading or playing the
// video (often with autoplay on) then the loadstart event has already fired and we
// need to fire it manually because many things rely on it.
// Long term we might consider how we would do this for other events like 'canplay'
// that may also have fired.
this.ready(function () {
if (this.networkState && this.networkState() > 0) {
this.trigger('loadstart');
}
// Allow the tech ready event to handle synchronisity
}, true);
};
/* Fallbacks for unsupported event types
================================================================================ */
// Manually trigger progress events based on changes to the buffered amount
// Many flash players and older HTML5 browsers don't send progress or progress-like events
/**
* Turn on progress events
*
* @method manualProgressOn
*/
Tech.prototype.manualProgressOn = function manualProgressOn() {
this.on('durationchange', this.onDurationChange);
this.manualProgress = true;
// Trigger progress watching when a source begins loading
this.one('ready', this.trackProgress);
};
/**
* Turn off progress events
*
* @method manualProgressOff
*/
Tech.prototype.manualProgressOff = function manualProgressOff() {
this.manualProgress = false;
this.stopTrackingProgress();
this.off('durationchange', this.onDurationChange);
};
/**
* Track progress
*
* @method trackProgress
*/
Tech.prototype.trackProgress = function trackProgress() {
this.stopTrackingProgress();
this.progressInterval = this.setInterval(Fn.bind(this, function () {
// Don't trigger unless buffered amount is greater than last time
var numBufferedPercent = this.bufferedPercent();
if (this.bufferedPercent_ !== numBufferedPercent) {
this.trigger('progress');
}
this.bufferedPercent_ = numBufferedPercent;
if (numBufferedPercent === 1) {
this.stopTrackingProgress();
}
}), 500);
};
/**
* Update duration
*
* @method onDurationChange
*/
Tech.prototype.onDurationChange = function onDurationChange() {
this.duration_ = this.duration();
};
/**
* Create and get TimeRange object for buffering
*
* @return {TimeRangeObject}
* @method buffered
*/
Tech.prototype.buffered = function buffered() {
return _utilsTimeRangesJs.createTimeRange(0, 0);
};
/**
* Get buffered percent
*
* @return {Number}
* @method bufferedPercent
*/
Tech.prototype.bufferedPercent = function bufferedPercent() {
return _utilsBufferJs.bufferedPercent(this.buffered(), this.duration_);
};
/**
* Stops tracking progress by clearing progress interval
*
* @method stopTrackingProgress
*/
Tech.prototype.stopTrackingProgress = function stopTrackingProgress() {
this.clearInterval(this.progressInterval);
};
/*! Time Tracking -------------------------------------------------------------- */
/**
* Set event listeners for on play and pause and tracking current time
*
* @method manualTimeUpdatesOn
*/
Tech.prototype.manualTimeUpdatesOn = function manualTimeUpdatesOn() {
this.manualTimeUpdates = true;
this.on('play', this.trackCurrentTime);
this.on('pause', this.stopTrackingCurrentTime);
};
/**
* Remove event listeners for on play and pause and tracking current time
*
* @method manualTimeUpdatesOff
*/
Tech.prototype.manualTimeUpdatesOff = function manualTimeUpdatesOff() {
this.manualTimeUpdates = false;
this.stopTrackingCurrentTime();
this.off('play', this.trackCurrentTime);
this.off('pause', this.stopTrackingCurrentTime);
};
/**
* Tracks current time
*
* @method trackCurrentTime
*/
Tech.prototype.trackCurrentTime = function trackCurrentTime() {
if (this.currentTimeInterval) {
this.stopTrackingCurrentTime();
}
this.currentTimeInterval = this.setInterval(function () {
this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });
}, 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
};
/**
* Turn off play progress tracking (when paused or dragging)
*
* @method stopTrackingCurrentTime
*/
Tech.prototype.stopTrackingCurrentTime = function stopTrackingCurrentTime() {
this.clearInterval(this.currentTimeInterval);
// #1002 - if the video ends right before the next timeupdate would happen,
// the progress bar won't make it all the way to the end
this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });
};
/**
* Turn off any manual progress or timeupdate tracking
*
* @method dispose
*/
Tech.prototype.dispose = function dispose() {
// clear out text tracks because we can't reuse them between techs
var textTracks = this.textTracks();
if (textTracks) {
var i = textTracks.length;
while (i--) {
this.removeRemoteTextTrack(textTracks[i]);
}
}
// Turn off any manual progress or timeupdate tracking
if (this.manualProgress) {
this.manualProgressOff();
}
if (this.manualTimeUpdates) {
this.manualTimeUpdatesOff();
}
_Component.prototype.dispose.call(this);
};
/**
* When invoked without an argument, returns a MediaError object
* representing the current error state of the player or null if
* there is no error. When invoked with an argument, set the current
* error state of the player.
* @param {MediaError=} err Optional an error object
* @return {MediaError} the current error object or null
* @method error
*/
Tech.prototype.error = function error(err) {
if (err !== undefined) {
if (err instanceof _mediaErrorJs2['default']) {
this.error_ = err;
} else {
this.error_ = new _mediaErrorJs2['default'](err);
}
this.trigger('error');
}
return this.error_;
};
/**
* Return the time ranges that have been played through for the
* current source. This implementation is incomplete. It does not
* track the played time ranges, only whether the source has played
* at all or not.
* @return {TimeRangeObject} a single time range if this video has
* played or an empty set of ranges if not.
* @method played
*/
Tech.prototype.played = function played() {
if (this.hasStarted_) {
return _utilsTimeRangesJs.createTimeRange(0, 0);
}
return _utilsTimeRangesJs.createTimeRange();
};
/**
* Set current time
*
* @method setCurrentTime
*/
Tech.prototype.setCurrentTime = function setCurrentTime() {
// improve the accuracy of manual timeupdates
if (this.manualTimeUpdates) {
this.trigger({ type: 'timeupdate', target: this, manuallyTriggered: true });
}
};
/**
* Initialize texttrack listeners
*
* @method initTextTrackListeners
*/
Tech.prototype.initTextTrackListeners = function initTextTrackListeners() {
var textTrackListChanges = Fn.bind(this, function () {
this.trigger('texttrackchange');
});
var tracks = this.textTracks();
if (!tracks) return;
tracks.addEventListener('removetrack', textTrackListChanges);
tracks.addEventListener('addtrack', textTrackListChanges);
this.on('dispose', Fn.bind(this, function () {
tracks.removeEventListener('removetrack', textTrackListChanges);
tracks.removeEventListener('addtrack', textTrackListChanges);
}));
};
/**
* Emulate texttracks
*
* @method emulateTextTracks
*/
Tech.prototype.emulateTextTracks = function emulateTextTracks() {
if (!_globalWindow2['default']['WebVTT'] && this.el().parentNode != null) {
var script = _globalDocument2['default'].createElement('script');
script.src = this.options_['vtt.js'] || '../node_modules/vtt.js/dist/vtt.js';
this.el().parentNode.appendChild(script);
_globalWindow2['default']['WebVTT'] = true;
}
var tracks = this.textTracks();
if (!tracks) {
return;
}
var textTracksChanges = Fn.bind(this, function () {
var _this = this;
var updateDisplay = function updateDisplay() {
return _this.trigger('texttrackchange');
};
updateDisplay();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
track.removeEventListener('cuechange', updateDisplay);
if (track.mode === 'showing') {
track.addEventListener('cuechange', updateDisplay);
}
}
});
tracks.addEventListener('change', textTracksChanges);
this.on('dispose', function () {
tracks.removeEventListener('change', textTracksChanges);
});
};
/*
* Provide default methods for text tracks.
*
* Html5 tech overrides these.
*/
/**
* Get texttracks
*
* @returns {TextTrackList}
* @method textTracks
*/
Tech.prototype.textTracks = function textTracks() {
this.textTracks_ = this.textTracks_ || new _tracksTextTrackList2['default']();
return this.textTracks_;
};
/**
* Get remote texttracks
*
* @returns {TextTrackList}
* @method remoteTextTracks
*/
Tech.prototype.remoteTextTracks = function remoteTextTracks() {
this.remoteTextTracks_ = this.remoteTextTracks_ || new _tracksTextTrackList2['default']();
return this.remoteTextTracks_;
};
/**
* Creates and returns a remote text track object
*
* @param {String} kind Text track kind (subtitles, captions, descriptions
* chapters and metadata)
* @param {String=} label Label to identify the text track
* @param {String=} language Two letter language abbreviation
* @return {TextTrackObject}
* @method addTextTrack
*/
Tech.prototype.addTextTrack = function addTextTrack(kind, label, language) {
if (!kind) {
throw new Error('TextTrack kind is required but was not provided');
}
return createTrackHelper(this, kind, label, language);
};
/**
* Creates and returns a remote text track object
*
* @param {Object} options The object should contain values for
* kind, language, label and src (location of the WebVTT file)
* @return {TextTrackObject}
* @method addRemoteTextTrack
*/
Tech.prototype.addRemoteTextTrack = function addRemoteTextTrack(options) {
var track = createTrackHelper(this, options.kind, options.label, options.language, options);
this.remoteTextTracks().addTrack_(track);
return {
track: track
};
};
/**
* Remove remote texttrack
*
* @param {TextTrackObject} track Texttrack to remove
* @method removeRemoteTextTrack
*/
Tech.prototype.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
this.textTracks().removeTrack_(track);
this.remoteTextTracks().removeTrack_(track);
};
/**
* Provide a default setPoster method for techs
* Poster support for techs should be optional, so we don't want techs to
* break if they don't have a way to set a poster.
*
* @method setPoster
*/
Tech.prototype.setPoster = function setPoster() {};
return Tech;
})(_component2['default']);
Tech.prototype.textTracks_;
var createTrackHelper = function createTrackHelper(self, kind, label, language) {
var options = arguments.length <= 4 || arguments[4] === undefined ? {} : arguments[4];
var tracks = self.textTracks();
options.kind = kind;
if (label) {
options.label = label;
}
if (language) {
options.language = language;
}
options.tech = self;
var track = new _tracksTextTrack2['default'](options);
tracks.addTrack_(track);
return track;
};
Tech.prototype.featuresVolumeControl = true;
// Resizing plugins using request fullscreen reloads the plugin
Tech.prototype.featuresFullscreenResize = false;
Tech.prototype.featuresPlaybackRate = false;
// Optional events that we can manually mimic with timers
// currently not triggered by video-js-swf
Tech.prototype.featuresProgressEvents = false;
Tech.prototype.featuresTimeupdateEvents = false;
Tech.prototype.featuresNativeTextTracks = false;
/*
* A functional mixin for techs that want to use the Source Handler pattern.
*
* ##### EXAMPLE:
*
* Tech.withSourceHandlers.call(MyTech);
*
*/
Tech.withSourceHandlers = function (_Tech) {
/*
* Register a source handler
* Source handlers are scripts for handling specific formats.
* The source handler pattern is used for adaptive formats (HLS, DASH) that
* manually load video data and feed it into a Source Buffer (Media Source Extensions)
* @param {Function} handler The source handler
* @param {Boolean} first Register it before any existing handlers
*/
_Tech.registerSourceHandler = function (handler, index) {
var handlers = _Tech.sourceHandlers;
if (!handlers) {
handlers = _Tech.sourceHandlers = [];
}
if (index === undefined) {
// add to the end of the list
index = handlers.length;
}
handlers.splice(index, 0, handler);
};
/*
* Return the first source handler that supports the source
* TODO: Answer question: should 'probably' be prioritized over 'maybe'
* @param {Object} source The source object
* @returns {Object} The first source handler that supports the source
* @returns {null} Null if no source handler is found
*/
_Tech.selectSourceHandler = function (source) {
var handlers = _Tech.sourceHandlers || [];
var can = undefined;
for (var i = 0; i < handlers.length; i++) {
can = handlers[i].canHandleSource(source);
if (can) {
return handlers[i];
}
}
return null;
};
/*
* Check if the tech can support the given source
* @param {Object} srcObj The source object
* @return {String} 'probably', 'maybe', or '' (empty string)
*/
_Tech.canPlaySource = function (srcObj) {
var sh = _Tech.selectSourceHandler(srcObj);
if (sh) {
return sh.canHandleSource(srcObj);
}
return '';
};
var originalSeekable = _Tech.prototype.seekable;
// when a source handler is registered, prefer its implementation of
// seekable when present.
_Tech.prototype.seekable = function () {
if (this.sourceHandler_ && this.sourceHandler_.seekable) {
return this.sourceHandler_.seekable();
}
return originalSeekable.call(this);
};
/*
* Create a function for setting the source using a source object
* and source handlers.
* Should never be called unless a source handler was found.
* @param {Object} source A source object with src and type keys
* @return {Tech} self
*/
_Tech.prototype.setSource = function (source) {
var sh = _Tech.selectSourceHandler(source);
if (!sh) {
// Fall back to a native source hander when unsupported sources are
// deliberately set
if (_Tech.nativeSourceHandler) {
sh = _Tech.nativeSourceHandler;
} else {
_utilsLogJs2['default'].error('No source hander found for the current source.');
}
}
// Dispose any existing source handler
this.disposeSourceHandler();
this.off('dispose', this.disposeSourceHandler);
this.currentSource_ = source;
this.sourceHandler_ = sh.handleSource(source, this);
this.on('dispose', this.disposeSourceHandler);
return this;
};
/*
* Clean up any existing source handler
*/
_Tech.prototype.disposeSourceHandler = function () {
if (this.sourceHandler_ && this.sourceHandler_.dispose) {
this.sourceHandler_.dispose();
}
};
};
_component2['default'].registerComponent('Tech', Tech);
// Old name for Tech
_component2['default'].registerComponent('MediaTechController', Tech);
exports['default'] = Tech;
module.exports = exports['default'];
},{"../component":48,"../media-error.js":83,"../tracks/text-track":103,"../tracks/text-track-list":101,"../utils/buffer.js":105,"../utils/fn.js":109,"../utils/log.js":112,"../utils/time-ranges.js":115,"global/document":1,"global/window":2}],97:[function(_dereq_,module,exports){
/**
* @file text-track-cue-list.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/*
* https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist
*
* interface TextTrackCueList {
* readonly attribute unsigned long length;
* getter TextTrackCue (unsigned long index);
* TextTrackCue? getCueById(DOMString id);
* };
*/
var TextTrackCueList = function TextTrackCueList(cues) {
var list = this;
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in TextTrackCueList.prototype) {
list[prop] = TextTrackCueList.prototype[prop];
}
}
TextTrackCueList.prototype.setCues_.call(list, cues);
Object.defineProperty(list, 'length', {
get: function get() {
return this.length_;
}
});
if (browser.IS_IE8) {
return list;
}
};
TextTrackCueList.prototype.setCues_ = function (cues) {
var oldLength = this.length || 0;
var i = 0;
var l = cues.length;
this.cues_ = cues;
this.length_ = cues.length;
var defineProp = function defineProp(i) {
if (!('' + i in this)) {
Object.defineProperty(this, '' + i, {
get: function get() {
return this.cues_[i];
}
});
}
};
if (oldLength < l) {
i = oldLength;
for (; i < l; i++) {
defineProp.call(this, i);
}
}
};
TextTrackCueList.prototype.getCueById = function (id) {
var result = null;
for (var i = 0, l = this.length; i < l; i++) {
var cue = this[i];
if (cue.id === id) {
result = cue;
break;
}
}
return result;
};
exports['default'] = TextTrackCueList;
module.exports = exports['default'];
},{"../utils/browser.js":104,"global/document":1}],98:[function(_dereq_,module,exports){
/**
* @file text-track-display.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _menuMenuJs = _dereq_('../menu/menu.js');
var _menuMenuJs2 = _interopRequireDefault(_menuMenuJs);
var _menuMenuItemJs = _dereq_('../menu/menu-item.js');
var _menuMenuItemJs2 = _interopRequireDefault(_menuMenuItemJs);
var _menuMenuButtonJs = _dereq_('../menu/menu-button.js');
var _menuMenuButtonJs2 = _interopRequireDefault(_menuMenuButtonJs);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var darkGray = '#222';
var lightGray = '#ccc';
var fontMap = {
monospace: 'monospace',
sansSerif: 'sans-serif',
serif: 'serif',
monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
monospaceSerif: '"Courier New", monospace',
proportionalSansSerif: 'sans-serif',
proportionalSerif: 'serif',
casual: '"Comic Sans MS", Impact, fantasy',
script: '"Monotype Corsiva", cursive',
smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
};
/**
* The component for displaying text track cues
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @param {Function=} ready Ready callback function
* @extends Component
* @class TextTrackDisplay
*/
var TextTrackDisplay = (function (_Component) {
_inherits(TextTrackDisplay, _Component);
function TextTrackDisplay(player, options, ready) {
_classCallCheck(this, TextTrackDisplay);
_Component.call(this, player, options, ready);
player.on('loadstart', Fn.bind(this, this.toggleDisplay));
player.on('texttrackchange', Fn.bind(this, this.updateDisplay));
// This used to be called during player init, but was causing an error
// if a track should show by default and the display hadn't loaded yet.
// Should probably be moved to an external track loader when we support
// tracks that don't need a display.
player.ready(Fn.bind(this, function () {
if (player.tech && player.tech['featuresNativeTextTracks']) {
this.hide();
return;
}
player.on('fullscreenchange', Fn.bind(this, this.updateDisplay));
var tracks = this.options_.playerOptions['tracks'] || [];
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
this.player_.addRemoteTextTrack(track);
}
}));
}
/**
* Add cue HTML to display
*
* @param {Number} color Hex number for color, like #f0e
* @param {Number} opacity Value for opacity,0.0 - 1.0
* @return {RGBAColor} In the form 'rgba(255, 0, 0, 0.3)'
* @method constructColor
*/
/**
* Toggle display texttracks
*
* @method toggleDisplay
*/
TextTrackDisplay.prototype.toggleDisplay = function toggleDisplay() {
if (this.player_.tech && this.player_.tech['featuresNativeTextTracks']) {
this.hide();
} else {
this.show();
}
};
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
TextTrackDisplay.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-text-track-display'
});
};
/**
* Clear display texttracks
*
* @method clearDisplay
*/
TextTrackDisplay.prototype.clearDisplay = function clearDisplay() {
if (typeof _globalWindow2['default']['WebVTT'] === 'function') {
_globalWindow2['default']['WebVTT']['processCues'](_globalWindow2['default'], [], this.el_);
}
};
/**
* Update display texttracks
*
* @method updateDisplay
*/
TextTrackDisplay.prototype.updateDisplay = function updateDisplay() {
var tracks = this.player_.textTracks();
this.clearDisplay();
if (!tracks) {
return;
}
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
if (track['mode'] === 'showing') {
this.updateForTrack(track);
}
}
};
/**
* Add texttrack to texttrack list
*
* @param {TextTrackObject} track Texttrack object to be added to list
* @method updateForTrack
*/
TextTrackDisplay.prototype.updateForTrack = function updateForTrack(track) {
if (typeof _globalWindow2['default']['WebVTT'] !== 'function' || !track['activeCues']) {
return;
}
var overrides = this.player_['textTrackSettings'].getValues();
var cues = [];
for (var _i = 0; _i < track['activeCues'].length; _i++) {
cues.push(track['activeCues'][_i]);
}
_globalWindow2['default']['WebVTT']['processCues'](_globalWindow2['default'], track['activeCues'], this.el_);
var i = cues.length;
while (i--) {
var cueDiv = cues[i].displayState;
if (overrides.color) {
cueDiv.firstChild.style.color = overrides.color;
}
if (overrides.textOpacity) {
tryUpdateStyle(cueDiv.firstChild, 'color', constructColor(overrides.color || '#fff', overrides.textOpacity));
}
if (overrides.backgroundColor) {
cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
}
if (overrides.backgroundOpacity) {
tryUpdateStyle(cueDiv.firstChild, 'backgroundColor', constructColor(overrides.backgroundColor || '#000', overrides.backgroundOpacity));
}
if (overrides.windowColor) {
if (overrides.windowOpacity) {
tryUpdateStyle(cueDiv, 'backgroundColor', constructColor(overrides.windowColor, overrides.windowOpacity));
} else {
cueDiv.style.backgroundColor = overrides.windowColor;
}
}
if (overrides.edgeStyle) {
if (overrides.edgeStyle === 'dropshadow') {
cueDiv.firstChild.style.textShadow = '2px 2px 3px ' + darkGray + ', 2px 2px 4px ' + darkGray + ', 2px 2px 5px ' + darkGray;
} else if (overrides.edgeStyle === 'raised') {
cueDiv.firstChild.style.textShadow = '1px 1px ' + darkGray + ', 2px 2px ' + darkGray + ', 3px 3px ' + darkGray;
} else if (overrides.edgeStyle === 'depressed') {
cueDiv.firstChild.style.textShadow = '1px 1px ' + lightGray + ', 0 1px ' + lightGray + ', -1px -1px ' + darkGray + ', 0 -1px ' + darkGray;
} else if (overrides.edgeStyle === 'uniform') {
cueDiv.firstChild.style.textShadow = '0 0 4px ' + darkGray + ', 0 0 4px ' + darkGray + ', 0 0 4px ' + darkGray + ', 0 0 4px ' + darkGray;
}
}
if (overrides.fontPercent && overrides.fontPercent !== 1) {
var fontSize = _globalWindow2['default'].parseFloat(cueDiv.style.fontSize);
cueDiv.style.fontSize = fontSize * overrides.fontPercent + 'px';
cueDiv.style.height = 'auto';
cueDiv.style.top = 'auto';
cueDiv.style.bottom = '2px';
}
if (overrides.fontFamily && overrides.fontFamily !== 'default') {
if (overrides.fontFamily === 'small-caps') {
cueDiv.firstChild.style.fontVariant = 'small-caps';
} else {
cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily];
}
}
}
};
return TextTrackDisplay;
})(_component2['default']);
function constructColor(color, opacity) {
return 'rgba(' +
// color looks like "#f0e"
parseInt(color[1] + color[1], 16) + ',' + parseInt(color[2] + color[2], 16) + ',' + parseInt(color[3] + color[3], 16) + ',' + opacity + ')';
}
/**
* Try to update style
* Some style changes will throw an error, particularly in IE8. Those should be noops.
*
* @param {Element} el The element to be styles
* @param {CSSProperty} style The CSS property to be styled
* @param {CSSStyle} rule The actual style to be applied to the property
* @method tryUpdateStyle
*/
function tryUpdateStyle(el, style, rule) {
//
try {
el.style[style] = rule;
} catch (e) {}
}
_component2['default'].registerComponent('TextTrackDisplay', TextTrackDisplay);
exports['default'] = TextTrackDisplay;
module.exports = exports['default'];
},{"../component":48,"../menu/menu-button.js":84,"../menu/menu-item.js":85,"../menu/menu.js":86,"../utils/fn.js":109,"global/document":1,"global/window":2}],99:[function(_dereq_,module,exports){
/**
* @file text-track-enums.js
*
* https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode
*
* enum TextTrackMode { "disabled", "hidden", "showing" };
*/
'use strict';
exports.__esModule = true;
var TextTrackMode = {
'disabled': 'disabled',
'hidden': 'hidden',
'showing': 'showing'
};
/*
* https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackkind
*
* enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" };
*/
var TextTrackKind = {
'subtitles': 'subtitles',
'captions': 'captions',
'descriptions': 'descriptions',
'chapters': 'chapters',
'metadata': 'metadata'
};
exports.TextTrackMode = TextTrackMode;
exports.TextTrackKind = TextTrackKind;
},{}],100:[function(_dereq_,module,exports){
/**
* Utilities for capturing text track state and re-creating tracks
* based on a capture.
*
* @file text-track-list-converter.js
*/
/**
* Examine a single text track and return a JSON-compatible javascript
* object that represents the text track's state.
* @param track {TextTrackObject} the text track to query
* @return {Object} a serializable javascript representation of the
* @private
*/
'use strict';
exports.__esModule = true;
var trackToJson_ = function trackToJson_(track) {
return {
kind: track.kind,
label: track.label,
language: track.language,
id: track.id,
inBandMetadataTrackDispatchType: track.inBandMetadataTrackDispatchType,
mode: track.mode,
cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {
return {
startTime: cue.startTime,
endTime: cue.endTime,
text: cue.text,
id: cue.id
};
}),
src: track.src
};
};
/**
* Examine a tech and return a JSON-compatible javascript array that
* represents the state of all text tracks currently configured. The
* return array is compatible with `jsonToTextTracks`.
* @param tech {tech} the tech object to query
* @return {Array} a serializable javascript representation of the
* @function textTracksToJson
*/
var textTracksToJson = function textTracksToJson(tech) {
var trackEls = tech.el().querySelectorAll('track');
var trackObjs = Array.prototype.map.call(trackEls, function (t) {
return t.track;
});
var tracks = Array.prototype.map.call(trackEls, function (trackEl) {
var json = trackToJson_(trackEl.track);
json.src = trackEl.src;
return json;
});
return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) {
return trackObjs.indexOf(track) === -1;
}).map(trackToJson_));
};
/**
* Creates a set of remote text tracks on a tech based on an array of
* javascript text track representations.
* @param json {Array} an array of text track representation objects,
* like those that would be produced by `textTracksToJson`
* @param tech {tech} the tech to create text tracks on
* @function jsonToTextTracks
*/
var jsonToTextTracks = function jsonToTextTracks(json, tech) {
json.forEach(function (track) {
var addedTrack = tech.addRemoteTextTrack(track).track;
if (!track.src && track.cues) {
track.cues.forEach(function (cue) {
return addedTrack.addCue(cue);
});
}
});
return tech.textTracks();
};
exports['default'] = { textTracksToJson: textTracksToJson, jsonToTextTracks: jsonToTextTracks, trackToJson_: trackToJson_ };
module.exports = exports['default'];
},{}],101:[function(_dereq_,module,exports){
/**
* @file text-track-list.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _eventTarget = _dereq_('../event-target');
var _eventTarget2 = _interopRequireDefault(_eventTarget);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/*
* https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist
*
* interface TextTrackList : EventTarget {
* readonly attribute unsigned long length;
* getter TextTrack (unsigned long index);
* TextTrack? getTrackById(DOMString id);
*
* attribute EventHandler onchange;
* attribute EventHandler onaddtrack;
* attribute EventHandler onremovetrack;
* };
*/
var TextTrackList = function TextTrackList(tracks) {
var list = this;
if (browser.IS_IE8) {
list = _globalDocument2['default'].createElement('custom');
for (var prop in TextTrackList.prototype) {
list[prop] = TextTrackList.prototype[prop];
}
}
tracks = tracks || [];
list.tracks_ = [];
Object.defineProperty(list, 'length', {
get: function get() {
return this.tracks_.length;
}
});
for (var i = 0; i < tracks.length; i++) {
list.addTrack_(tracks[i]);
}
if (browser.IS_IE8) {
return list;
}
};
TextTrackList.prototype = Object.create(_eventTarget2['default'].prototype);
TextTrackList.prototype.constructor = TextTrackList;
/*
* change - One or more tracks in the track list have been enabled or disabled.
* addtrack - A track has been added to the track list.
* removetrack - A track has been removed from the track list.
*/
TextTrackList.prototype.allowedEvents_ = {
'change': 'change',
'addtrack': 'addtrack',
'removetrack': 'removetrack'
};
// emulate attribute EventHandler support to allow for feature detection
for (var _event in TextTrackList.prototype.allowedEvents_) {
TextTrackList.prototype['on' + _event] = null;
}
TextTrackList.prototype.addTrack_ = function (track) {
var index = this.tracks_.length;
if (!('' + index in this)) {
Object.defineProperty(this, index, {
get: function get() {
return this.tracks_[index];
}
});
}
track.addEventListener('modechange', Fn.bind(this, function () {
this.trigger('change');
}));
this.tracks_.push(track);
this.trigger({
type: 'addtrack',
track: track
});
};
TextTrackList.prototype.removeTrack_ = function (rtrack) {
var result = null;
var track = undefined;
for (var i = 0, l = this.length; i < l; i++) {
track = this[i];
if (track === rtrack) {
this.tracks_.splice(i, 1);
break;
}
}
this.trigger({
type: 'removetrack',
track: track
});
};
TextTrackList.prototype.getTrackById = function (id) {
var result = null;
for (var i = 0, l = this.length; i < l; i++) {
var track = this[i];
if (track.id === id) {
result = track;
break;
}
}
return result;
};
exports['default'] = TextTrackList;
module.exports = exports['default'];
},{"../event-target":79,"../utils/browser.js":104,"../utils/fn.js":109,"global/document":1}],102:[function(_dereq_,module,exports){
/**
* @file text-track-settings.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _component = _dereq_('../component');
var _component2 = _interopRequireDefault(_component);
var _utilsEventsJs = _dereq_('../utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsLogJs = _dereq_('../utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _safeJsonParseTuple = _dereq_('safe-json-parse/tuple');
var _safeJsonParseTuple2 = _interopRequireDefault(_safeJsonParseTuple);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
/**
* Manipulate settings of texttracks
*
* @param {Object} player Main Player
* @param {Object=} options Object of option names and values
* @extends Component
* @class TextTrackSettings
*/
var TextTrackSettings = (function (_Component) {
_inherits(TextTrackSettings, _Component);
function TextTrackSettings(player, options) {
_classCallCheck(this, TextTrackSettings);
_Component.call(this, player, options);
this.hide();
// Grab `persistTextTrackSettings` from the player options if not passed in child options
if (options.persistTextTrackSettings === undefined) {
this.options_.persistTextTrackSettings = this.options_.playerOptions.persistTextTrackSettings;
}
Events.on(this.el().querySelector('.vjs-done-button'), 'click', Fn.bind(this, function () {
this.saveSettings();
this.hide();
}));
Events.on(this.el().querySelector('.vjs-default-button'), 'click', Fn.bind(this, function () {
this.el().querySelector('.vjs-fg-color > select').selectedIndex = 0;
this.el().querySelector('.vjs-bg-color > select').selectedIndex = 0;
this.el().querySelector('.window-color > select').selectedIndex = 0;
this.el().querySelector('.vjs-text-opacity > select').selectedIndex = 0;
this.el().querySelector('.vjs-bg-opacity > select').selectedIndex = 0;
this.el().querySelector('.vjs-window-opacity > select').selectedIndex = 0;
this.el().querySelector('.vjs-edge-style select').selectedIndex = 0;
this.el().querySelector('.vjs-font-family select').selectedIndex = 0;
this.el().querySelector('.vjs-font-percent select').selectedIndex = 2;
this.updateDisplay();
}));
Events.on(this.el().querySelector('.vjs-fg-color > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-bg-color > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.window-color > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-text-opacity > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-bg-opacity > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-window-opacity > select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-font-percent select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-edge-style select'), 'change', Fn.bind(this, this.updateDisplay));
Events.on(this.el().querySelector('.vjs-font-family select'), 'change', Fn.bind(this, this.updateDisplay));
if (this.options_.persistTextTrackSettings) {
this.restoreSettings();
}
}
/**
* Create the component's DOM element
*
* @return {Element}
* @method createEl
*/
TextTrackSettings.prototype.createEl = function createEl() {
return _Component.prototype.createEl.call(this, 'div', {
className: 'vjs-caption-settings vjs-modal-overlay',
innerHTML: captionOptionsMenuTemplate()
});
};
/**
* Get texttrack settings
* Settings are
* .vjs-edge-style
* .vjs-font-family
* .vjs-fg-color
* .vjs-text-opacity
* .vjs-bg-color
* .vjs-bg-opacity
* .window-color
* .vjs-window-opacity
*
* @return {Object}
* @method getValues
*/
TextTrackSettings.prototype.getValues = function getValues() {
var el = this.el();
var textEdge = getSelectedOptionValue(el.querySelector('.vjs-edge-style select'));
var fontFamily = getSelectedOptionValue(el.querySelector('.vjs-font-family select'));
var fgColor = getSelectedOptionValue(el.querySelector('.vjs-fg-color > select'));
var textOpacity = getSelectedOptionValue(el.querySelector('.vjs-text-opacity > select'));
var bgColor = getSelectedOptionValue(el.querySelector('.vjs-bg-color > select'));
var bgOpacity = getSelectedOptionValue(el.querySelector('.vjs-bg-opacity > select'));
var windowColor = getSelectedOptionValue(el.querySelector('.window-color > select'));
var windowOpacity = getSelectedOptionValue(el.querySelector('.vjs-window-opacity > select'));
var fontPercent = _globalWindow2['default']['parseFloat'](getSelectedOptionValue(el.querySelector('.vjs-font-percent > select')));
var result = {
'backgroundOpacity': bgOpacity,
'textOpacity': textOpacity,
'windowOpacity': windowOpacity,
'edgeStyle': textEdge,
'fontFamily': fontFamily,
'color': fgColor,
'backgroundColor': bgColor,
'windowColor': windowColor,
'fontPercent': fontPercent
};
for (var _name in result) {
if (result[_name] === '' || result[_name] === 'none' || _name === 'fontPercent' && result[_name] === 1.00) {
delete result[_name];
}
}
return result;
};
/**
* Set texttrack settings
* Settings are
* .vjs-edge-style
* .vjs-font-family
* .vjs-fg-color
* .vjs-text-opacity
* .vjs-bg-color
* .vjs-bg-opacity
* .window-color
* .vjs-window-opacity
*
* @param {Object} values Object with texttrack setting values
* @method setValues
*/
TextTrackSettings.prototype.setValues = function setValues(values) {
var el = this.el();
setSelectedOption(el.querySelector('.vjs-edge-style select'), values.edgeStyle);
setSelectedOption(el.querySelector('.vjs-font-family select'), values.fontFamily);
setSelectedOption(el.querySelector('.vjs-fg-color > select'), values.color);
setSelectedOption(el.querySelector('.vjs-text-opacity > select'), values.textOpacity);
setSelectedOption(el.querySelector('.vjs-bg-color > select'), values.backgroundColor);
setSelectedOption(el.querySelector('.vjs-bg-opacity > select'), values.backgroundOpacity);
setSelectedOption(el.querySelector('.window-color > select'), values.windowColor);
setSelectedOption(el.querySelector('.vjs-window-opacity > select'), values.windowOpacity);
var fontPercent = values.fontPercent;
if (fontPercent) {
fontPercent = fontPercent.toFixed(2);
}
setSelectedOption(el.querySelector('.vjs-font-percent > select'), fontPercent);
};
/**
* Restore texttrack settings
*
* @method restoreSettings
*/
TextTrackSettings.prototype.restoreSettings = function restoreSettings() {
var _safeParseTuple = _safeJsonParseTuple2['default'](_globalWindow2['default'].localStorage.getItem('vjs-text-track-settings'));
var err = _safeParseTuple[0];
var values = _safeParseTuple[1];
if (err) {
_utilsLogJs2['default'].error(err);
}
if (values) {
this.setValues(values);
}
};
/**
* Save texttrack settings to local storage
*
* @method saveSettings
*/
TextTrackSettings.prototype.saveSettings = function saveSettings() {
if (!this.options_.persistTextTrackSettings) {
return;
}
var values = this.getValues();
try {
if (Object.getOwnPropertyNames(values).length > 0) {
_globalWindow2['default'].localStorage.setItem('vjs-text-track-settings', JSON.stringify(values));
} else {
_globalWindow2['default'].localStorage.removeItem('vjs-text-track-settings');
}
} catch (e) {}
};
/**
* Update display of texttrack settings
*
* @method updateDisplay
*/
TextTrackSettings.prototype.updateDisplay = function updateDisplay() {
var ttDisplay = this.player_.getChild('textTrackDisplay');
if (ttDisplay) {
ttDisplay.updateDisplay();
}
};
return TextTrackSettings;
})(_component2['default']);
_component2['default'].registerComponent('TextTrackSettings', TextTrackSettings);
function getSelectedOptionValue(target) {
var selectedOption = undefined;
// not all browsers support selectedOptions, so, fallback to options
if (target.selectedOptions) {
selectedOption = target.selectedOptions[0];
} else if (target.options) {
selectedOption = target.options[target.options.selectedIndex];
}
return selectedOption.value;
}
function setSelectedOption(target, value) {
if (!value) {
return;
}
var i = undefined;
for (i = 0; i < target.options.length; i++) {
var option = target.options[i];
if (option.value === value) {
break;
}
}
target.selectedIndex = i;
}
function captionOptionsMenuTemplate() {
var template = '<div class="vjs-tracksettings">\n <div class="vjs-tracksettings-colors">\n <div class="vjs-fg-color vjs-tracksetting">\n <label class="vjs-label">Foreground</label>\n <select>\n <option value="">---</option>\n <option value="#FFF">White</option>\n <option value="#000">Black</option>\n <option value="#F00">Red</option>\n <option value="#0F0">Green</option>\n <option value="#00F">Blue</option>\n <option value="#FF0">Yellow</option>\n <option value="#F0F">Magenta</option>\n <option value="#0FF">Cyan</option>\n </select>\n <span class="vjs-text-opacity vjs-opacity">\n <select>\n <option value="">---</option>\n <option value="1">Opaque</option>\n <option value="0.5">Semi-Opaque</option>\n </select>\n </span>\n </div> <!-- vjs-fg-color -->\n <div class="vjs-bg-color vjs-tracksetting">\n <label class="vjs-label">Background</label>\n <select>\n <option value="">---</option>\n <option value="#FFF">White</option>\n <option value="#000">Black</option>\n <option value="#F00">Red</option>\n <option value="#0F0">Green</option>\n <option value="#00F">Blue</option>\n <option value="#FF0">Yellow</option>\n <option value="#F0F">Magenta</option>\n <option value="#0FF">Cyan</option>\n </select>\n <span class="vjs-bg-opacity vjs-opacity">\n <select>\n <option value="">---</option>\n <option value="1">Opaque</option>\n <option value="0.5">Semi-Transparent</option>\n <option value="0">Transparent</option>\n </select>\n </span>\n </div> <!-- vjs-bg-color -->\n <div class="window-color vjs-tracksetting">\n <label class="vjs-label">Window</label>\n <select>\n <option value="">---</option>\n <option value="#FFF">White</option>\n <option value="#000">Black</option>\n <option value="#F00">Red</option>\n <option value="#0F0">Green</option>\n <option value="#00F">Blue</option>\n <option value="#FF0">Yellow</option>\n <option value="#F0F">Magenta</option>\n <option value="#0FF">Cyan</option>\n </select>\n <span class="vjs-window-opacity vjs-opacity">\n <select>\n <option value="">---</option>\n <option value="1">Opaque</option>\n <option value="0.5">Semi-Transparent</option>\n <option value="0">Transparent</option>\n </select>\n </span>\n </div> <!-- vjs-window-color -->\n </div> <!-- vjs-tracksettings -->\n <div class="vjs-tracksettings-font">\n <div class="vjs-font-percent vjs-tracksetting">\n <label class="vjs-label">Font Size</label>\n <select>\n <option value="0.50">50%</option>\n <option value="0.75">75%</option>\n <option value="1.00" selected>100%</option>\n <option value="1.25">125%</option>\n <option value="1.50">150%</option>\n <option value="1.75">175%</option>\n <option value="2.00">200%</option>\n <option value="3.00">300%</option>\n <option value="4.00">400%</option>\n </select>\n </div> <!-- vjs-font-percent -->\n <div class="vjs-edge-style vjs-tracksetting">\n <label class="vjs-label">Text Edge Style</label>\n <select>\n <option value="none">None</option>\n <option value="raised">Raised</option>\n <option value="depressed">Depressed</option>\n <option value="uniform">Uniform</option>\n <option value="dropshadow">Dropshadow</option>\n </select>\n </div> <!-- vjs-edge-style -->\n <div class="vjs-font-family vjs-tracksetting">\n <label class="vjs-label">Font Family</label>\n <select>\n <option value="">Default</option>\n <option value="monospaceSerif">Monospace Serif</option>\n <option value="proportionalSerif">Proportional Serif</option>\n <option value="monospaceSansSerif">Monospace Sans-Serif</option>\n <option value="proportionalSansSerif">Proportional Sans-Serif</option>\n <option value="casual">Casual</option>\n <option value="script">Script</option>\n <option value="small-caps">Small Caps</option>\n </select>\n </div> <!-- vjs-font-family -->\n </div>\n </div>\n <div class="vjs-tracksettings-controls">\n <button class="vjs-default-button">Defaults</button>\n <button class="vjs-done-button">Done</button>\n </div>';
return template;
}
exports['default'] = TextTrackSettings;
module.exports = exports['default'];
},{"../component":48,"../utils/events.js":108,"../utils/fn.js":109,"../utils/log.js":112,"global/window":2,"safe-json-parse/tuple":45}],103:[function(_dereq_,module,exports){
/**
* @file text-track.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _textTrackCueList = _dereq_('./text-track-cue-list');
var _textTrackCueList2 = _interopRequireDefault(_textTrackCueList);
var _utilsFnJs = _dereq_('../utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _utilsGuidJs = _dereq_('../utils/guid.js');
var Guid = _interopRequireWildcard(_utilsGuidJs);
var _utilsBrowserJs = _dereq_('../utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _textTrackEnums = _dereq_('./text-track-enums');
var TextTrackEnum = _interopRequireWildcard(_textTrackEnums);
var _utilsLogJs = _dereq_('../utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _eventTarget = _dereq_('../event-target');
var _eventTarget2 = _interopRequireDefault(_eventTarget);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _xhrJs = _dereq_('../xhr.js');
var _xhrJs2 = _interopRequireDefault(_xhrJs);
/*
* https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack
*
* interface TextTrack : EventTarget {
* readonly attribute TextTrackKind kind;
* readonly attribute DOMString label;
* readonly attribute DOMString language;
*
* readonly attribute DOMString id;
* readonly attribute DOMString inBandMetadataTrackDispatchType;
*
* attribute TextTrackMode mode;
*
* readonly attribute TextTrackCueList? cues;
* readonly attribute TextTrackCueList? activeCues;
*
* void addCue(TextTrackCue cue);
* void removeCue(TextTrackCue cue);
*
* attribute EventHandler oncuechange;
* };
*/
var TextTrack = function TextTrack() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
if (!options.tech) {
throw new Error('A tech was not provided.');
}
var tt = this;
if (browser.IS_IE8) {
tt = _globalDocument2['default'].createElement('custom');
for (var prop in TextTrack.prototype) {
tt[prop] = TextTrack.prototype[prop];
}
}
tt.tech_ = options.tech;
var mode = TextTrackEnum.TextTrackMode[options['mode']] || 'disabled';
var kind = TextTrackEnum.TextTrackKind[options['kind']] || 'subtitles';
var label = options['label'] || '';
var language = options['language'] || options['srclang'] || '';
var id = options['id'] || 'vjs_text_track_' + Guid.newGUID();
if (kind === 'metadata' || kind === 'chapters') {
mode = 'hidden';
}
tt.cues_ = [];
tt.activeCues_ = [];
var cues = new _textTrackCueList2['default'](tt.cues_);
var activeCues = new _textTrackCueList2['default'](tt.activeCues_);
var changed = false;
var timeupdateHandler = Fn.bind(tt, function () {
this['activeCues'];
if (changed) {
this['trigger']('cuechange');
changed = false;
}
});
if (mode !== 'disabled') {
tt.tech_.on('timeupdate', timeupdateHandler);
}
Object.defineProperty(tt, 'kind', {
get: function get() {
return kind;
},
set: Function.prototype
});
Object.defineProperty(tt, 'label', {
get: function get() {
return label;
},
set: Function.prototype
});
Object.defineProperty(tt, 'language', {
get: function get() {
return language;
},
set: Function.prototype
});
Object.defineProperty(tt, 'id', {
get: function get() {
return id;
},
set: Function.prototype
});
Object.defineProperty(tt, 'mode', {
get: function get() {
return mode;
},
set: function set(newMode) {
if (!TextTrackEnum.TextTrackMode[newMode]) {
return;
}
mode = newMode;
if (mode === 'showing') {
this.tech_.on('timeupdate', timeupdateHandler);
}
this.trigger('modechange');
}
});
Object.defineProperty(tt, 'cues', {
get: function get() {
if (!this.loaded_) {
return null;
}
return cues;
},
set: Function.prototype
});
Object.defineProperty(tt, 'activeCues', {
get: function get() {
if (!this.loaded_) {
return null;
}
if (this['cues'].length === 0) {
return activeCues; // nothing to do
}
var ct = this.tech_.currentTime();
var active = [];
for (var i = 0, l = this['cues'].length; i < l; i++) {
var cue = this['cues'][i];
if (cue['startTime'] <= ct && cue['endTime'] >= ct) {
active.push(cue);
} else if (cue['startTime'] === cue['endTime'] && cue['startTime'] <= ct && cue['startTime'] + 0.5 >= ct) {
active.push(cue);
}
}
changed = false;
if (active.length !== this.activeCues_.length) {
changed = true;
} else {
for (var i = 0; i < active.length; i++) {
if (indexOf.call(this.activeCues_, active[i]) === -1) {
changed = true;
}
}
}
this.activeCues_ = active;
activeCues.setCues_(this.activeCues_);
return activeCues;
},
set: Function.prototype
});
if (options.src) {
tt.src = options.src;
loadTrack(options.src, tt);
} else {
tt.loaded_ = true;
}
if (browser.IS_IE8) {
return tt;
}
};
TextTrack.prototype = Object.create(_eventTarget2['default'].prototype);
TextTrack.prototype.constructor = TextTrack;
/*
* cuechange - One or more cues in the track have become active or stopped being active.
*/
TextTrack.prototype.allowedEvents_ = {
'cuechange': 'cuechange'
};
TextTrack.prototype.addCue = function (cue) {
var tracks = this.tech_.textTracks();
if (tracks) {
for (var i = 0; i < tracks.length; i++) {
if (tracks[i] !== this) {
tracks[i].removeCue(cue);
}
}
}
this.cues_.push(cue);
this['cues'].setCues_(this.cues_);
};
TextTrack.prototype.removeCue = function (removeCue) {
var removed = false;
for (var i = 0, l = this.cues_.length; i < l; i++) {
var cue = this.cues_[i];
if (cue === removeCue) {
this.cues_.splice(i, 1);
removed = true;
}
}
if (removed) {
this.cues.setCues_(this.cues_);
}
};
/*
* Downloading stuff happens below this point
*/
var parseCues = function parseCues(srcContent, track) {
if (typeof _globalWindow2['default']['WebVTT'] !== 'function') {
//try again a bit later
return _globalWindow2['default'].setTimeout(function () {
parseCues(srcContent, track);
}, 25);
}
var parser = new _globalWindow2['default']['WebVTT']['Parser'](_globalWindow2['default'], _globalWindow2['default']['vttjs'], _globalWindow2['default']['WebVTT']['StringDecoder']());
parser['oncue'] = function (cue) {
track.addCue(cue);
};
parser['onparsingerror'] = function (error) {
_utilsLogJs2['default'].error(error);
};
parser['parse'](srcContent);
parser['flush']();
};
var loadTrack = function loadTrack(src, track) {
_xhrJs2['default'](src, Fn.bind(this, function (err, response, responseBody) {
if (err) {
return _utilsLogJs2['default'].error(err, response);
}
track.loaded_ = true;
parseCues(responseBody, track);
}));
};
var indexOf = function indexOf(searchElement, fromIndex) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (len === 0) {
return -1;
}
var n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in O && O[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
exports['default'] = TextTrack;
module.exports = exports['default'];
},{"../event-target":79,"../utils/browser.js":104,"../utils/fn.js":109,"../utils/guid.js":111,"../utils/log.js":112,"../xhr.js":119,"./text-track-cue-list":97,"./text-track-enums":99,"global/document":1,"global/window":2}],104:[function(_dereq_,module,exports){
/**
* @file browser.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var USER_AGENT = _globalWindow2['default'].navigator.userAgent;
var webkitVersionMap = /AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);
var appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;
/*
* Device is an iPhone
*
* @type {Boolean}
* @constant
* @private
*/
var IS_IPHONE = /iPhone/i.test(USER_AGENT);
exports.IS_IPHONE = IS_IPHONE;
var IS_IPAD = /iPad/i.test(USER_AGENT);
exports.IS_IPAD = IS_IPAD;
var IS_IPOD = /iPod/i.test(USER_AGENT);
exports.IS_IPOD = IS_IPOD;
var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;
exports.IS_IOS = IS_IOS;
var IOS_VERSION = (function () {
var match = USER_AGENT.match(/OS (\d+)_/i);
if (match && match[1]) {
return match[1];
}
})();
exports.IOS_VERSION = IOS_VERSION;
var IS_ANDROID = /Android/i.test(USER_AGENT);
exports.IS_ANDROID = IS_ANDROID;
var ANDROID_VERSION = (function () {
// This matches Android Major.Minor.Patch versions
// ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned
var match = USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),
major,
minor;
if (!match) {
return null;
}
major = match[1] && parseFloat(match[1]);
minor = match[2] && parseFloat(match[2]);
if (major && minor) {
return parseFloat(match[1] + '.' + match[2]);
} else if (major) {
return major;
} else {
return null;
}
})();
exports.ANDROID_VERSION = ANDROID_VERSION;
// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser
var IS_OLD_ANDROID = IS_ANDROID && /webkit/i.test(USER_AGENT) && ANDROID_VERSION < 2.3;
exports.IS_OLD_ANDROID = IS_OLD_ANDROID;
var IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;
exports.IS_NATIVE_ANDROID = IS_NATIVE_ANDROID;
var IS_FIREFOX = /Firefox/i.test(USER_AGENT);
exports.IS_FIREFOX = IS_FIREFOX;
var IS_CHROME = /Chrome/i.test(USER_AGENT);
exports.IS_CHROME = IS_CHROME;
var IS_IE8 = /MSIE\s8\.0/.test(USER_AGENT);
exports.IS_IE8 = IS_IE8;
var TOUCH_ENABLED = !!('ontouchstart' in _globalWindow2['default'] || _globalWindow2['default'].DocumentTouch && _globalDocument2['default'] instanceof _globalWindow2['default'].DocumentTouch);
exports.TOUCH_ENABLED = TOUCH_ENABLED;
var BACKGROUND_SIZE_SUPPORTED = ('backgroundSize' in _globalDocument2['default'].createElement('video').style);
exports.BACKGROUND_SIZE_SUPPORTED = BACKGROUND_SIZE_SUPPORTED;
},{"global/document":1,"global/window":2}],105:[function(_dereq_,module,exports){
/**
* @file buffer.js
*/
'use strict';
exports.__esModule = true;
exports.bufferedPercent = bufferedPercent;
var _timeRangesJs = _dereq_('./time-ranges.js');
/**
* Compute how much your video has been buffered
*
* @param {Object} Buffered object
* @param {Number} Total duration
* @return {Number} Percent buffered of the total duration
* @private
* @function bufferedPercent
*/
function bufferedPercent(buffered, duration) {
var bufferedDuration = 0,
start,
end;
if (!duration) {
return 0;
}
if (!buffered || !buffered.length) {
buffered = _timeRangesJs.createTimeRange(0, 0);
}
for (var i = 0; i < buffered.length; i++) {
start = buffered.start(i);
end = buffered.end(i);
// buffered end can be bigger than duration by a very small fraction
if (end > duration) {
end = duration;
}
bufferedDuration += end - start;
}
return bufferedDuration / duration;
}
},{"./time-ranges.js":115}],106:[function(_dereq_,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _logJs = _dereq_('./log.js');
var _logJs2 = _interopRequireDefault(_logJs);
/**
* Object containing the default behaviors for available handler methods.
*
* @private
* @type {Object}
*/
var defaultBehaviors = {
get: function get(obj, key) {
return obj[key];
},
set: function set(obj, key, value) {
obj[key] = value;
return true;
}
};
/**
* Expose private objects publicly using a Proxy to log deprecation warnings.
*
* Browsers that do not support Proxy objects will simply return the `target`
* object, so it can be directly exposed.
*
* @param {Object} target The target object.
* @param {Object} messages Messages to display from a Proxy. Only operations
* with an associated message will be proxied.
* @param {String} [messages.get]
* @param {String} [messages.set]
* @return {Object} A Proxy if supported or the `target` argument.
*/
exports['default'] = function (target) {
var messages = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
if (typeof Proxy === 'function') {
var _ret = (function () {
var handler = {};
// Build a handler object based on those keys that have both messages
// and default behaviors.
Object.keys(messages).forEach(function (key) {
if (defaultBehaviors.hasOwnProperty(key)) {
handler[key] = function () {
_logJs2['default'].warn(messages[key]);
return defaultBehaviors[key].apply(this, arguments);
};
}
});
return {
v: new Proxy(target, handler)
};
})();
if (typeof _ret === 'object') return _ret.v;
}
return target;
};
module.exports = exports['default'];
},{"./log.js":112}],107:[function(_dereq_,module,exports){
/**
* @file dom.js
*/
'use strict';
exports.__esModule = true;
exports.getEl = getEl;
exports.createEl = createEl;
exports.insertElFirst = insertElFirst;
exports.getElData = getElData;
exports.hasElData = hasElData;
exports.removeElData = removeElData;
exports.hasElClass = hasElClass;
exports.addElClass = addElClass;
exports.removeElClass = removeElClass;
exports.setElAttributes = setElAttributes;
exports.getElAttributes = getElAttributes;
exports.blockTextSelection = blockTextSelection;
exports.unblockTextSelection = unblockTextSelection;
exports.findElPosition = findElPosition;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _guidJs = _dereq_('./guid.js');
var Guid = _interopRequireWildcard(_guidJs);
/**
* Shorthand for document.getElementById()
* Also allows for CSS (jQuery) ID syntax. But nothing other than IDs.
*
* @param {String} id Element ID
* @return {Element} Element with supplied ID
* @function getEl
*/
function getEl(id) {
if (id.indexOf('#') === 0) {
id = id.slice(1);
}
return _globalDocument2['default'].getElementById(id);
}
/**
* Creates an element and applies properties.
*
* @param {String=} tagName Name of tag to be created.
* @param {Object=} properties Element properties to be applied.
* @return {Element}
* @function createEl
*/
function createEl() {
var tagName = arguments.length <= 0 || arguments[0] === undefined ? 'div' : arguments[0];
var properties = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var el = _globalDocument2['default'].createElement(tagName);
Object.getOwnPropertyNames(properties).forEach(function (propName) {
var val = properties[propName];
// Not remembering why we were checking for dash
// but using setAttribute means you have to use getAttribute
// The check for dash checks for the aria- * attributes, like aria-label, aria-valuemin.
// The additional check for "role" is because the default method for adding attributes does not
// add the attribute "role". My guess is because it's not a valid attribute in some namespaces, although
// browsers handle the attribute just fine. The W3C allows for aria- * attributes to be used in pre-HTML5 docs.
// http://www.w3.org/TR/wai-aria-primer/#ariahtml. Using setAttribute gets around this problem.
if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') {
el.setAttribute(propName, val);
} else {
el[propName] = val;
}
});
return el;
}
/**
* Insert an element as the first child node of another
*
* @param {Element} child Element to insert
* @param {Element} parent Element to insert child into
* @private
* @function insertElFirst
*/
function insertElFirst(child, parent) {
if (parent.firstChild) {
parent.insertBefore(child, parent.firstChild);
} else {
parent.appendChild(child);
}
}
/**
* Element Data Store. Allows for binding data to an element without putting it directly on the element.
* Ex. Event listeners are stored here.
* (also from jsninja.com, slightly modified and updated for closure compiler)
*
* @type {Object}
* @private
*/
var elData = {};
/*
* Unique attribute name to store an element's guid in
*
* @type {String}
* @constant
* @private
*/
var elIdAttr = 'vdata' + new Date().getTime();
/**
* Returns the cache object where data for an element is stored
*
* @param {Element} el Element to store data for.
* @return {Object}
* @function getElData
*/
function getElData(el) {
var id = el[elIdAttr];
if (!id) {
id = el[elIdAttr] = Guid.newGUID();
}
if (!elData[id]) {
elData[id] = {};
}
return elData[id];
}
/**
* Returns whether or not an element has cached data
*
* @param {Element} el A dom element
* @return {Boolean}
* @private
* @function hasElData
*/
function hasElData(el) {
var id = el[elIdAttr];
if (!id) {
return false;
}
return !!Object.getOwnPropertyNames(elData[id]).length;
}
/**
* Delete data for the element from the cache and the guid attr from getElementById
*
* @param {Element} el Remove data for an element
* @private
* @function removeElData
*/
function removeElData(el) {
var id = el[elIdAttr];
if (!id) {
return;
}
// Remove all stored data
delete elData[id];
// Remove the elIdAttr property from the DOM node
try {
delete el[elIdAttr];
} catch (e) {
if (el.removeAttribute) {
el.removeAttribute(elIdAttr);
} else {
// IE doesn't appear to support removeAttribute on the document element
el[elIdAttr] = null;
}
}
}
/**
* Check if an element has a CSS class
*
* @param {Element} element Element to check
* @param {String} classToCheck Classname to check
* @function hasElClass
*/
function hasElClass(element, classToCheck) {
return (' ' + element.className + ' ').indexOf(' ' + classToCheck + ' ') !== -1;
}
/**
* Add a CSS class name to an element
*
* @param {Element} element Element to add class name to
* @param {String} classToAdd Classname to add
* @function addElClass
*/
function addElClass(element, classToAdd) {
if (!hasElClass(element, classToAdd)) {
element.className = element.className === '' ? classToAdd : element.className + ' ' + classToAdd;
}
}
/**
* Remove a CSS class name from an element
*
* @param {Element} element Element to remove from class name
* @param {String} classToRemove Classname to remove
* @function removeElClass
*/
function removeElClass(element, classToRemove) {
if (!hasElClass(element, classToRemove)) {
return;
}
var classNames = element.className.split(' ');
// no arr.indexOf in ie8, and we don't want to add a big shim
for (var i = classNames.length - 1; i >= 0; i--) {
if (classNames[i] === classToRemove) {
classNames.splice(i, 1);
}
}
element.className = classNames.join(' ');
}
/**
* Apply attributes to an HTML element.
*
* @param {Element} el Target element.
* @param {Object=} attributes Element attributes to be applied.
* @private
* @function setElAttributes
*/
function setElAttributes(el, attributes) {
Object.getOwnPropertyNames(attributes).forEach(function (attrName) {
var attrValue = attributes[attrName];
if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {
el.removeAttribute(attrName);
} else {
el.setAttribute(attrName, attrValue === true ? '' : attrValue);
}
});
}
/**
* Get an element's attribute values, as defined on the HTML tag
* Attributes are not the same as properties. They're defined on the tag
* or with setAttribute (which shouldn't be used with HTML)
* This will return true or false for boolean attributes.
*
* @param {Element} tag Element from which to get tag attributes
* @return {Object}
* @private
* @function getElAttributes
*/
function getElAttributes(tag) {
var obj, knownBooleans, attrs, attrName, attrVal;
obj = {};
// known boolean attributes
// we can check for matching boolean properties, but older browsers
// won't know about HTML5 boolean attributes that we still read from
knownBooleans = ',' + 'autoplay,controls,loop,muted,default' + ',';
if (tag && tag.attributes && tag.attributes.length > 0) {
attrs = tag.attributes;
for (var i = attrs.length - 1; i >= 0; i--) {
attrName = attrs[i].name;
attrVal = attrs[i].value;
// check for known booleans
// the matching element property will return a value for typeof
if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(',' + attrName + ',') !== -1) {
// the value of an included boolean attribute is typically an empty
// string ('') which would equal false if we just check for a false value.
// we also don't want support bad code like autoplay='false'
attrVal = attrVal !== null ? true : false;
}
obj[attrName] = attrVal;
}
}
return obj;
}
/**
* Attempt to block the ability to select text while dragging controls
*
* @return {Boolean}
* @method blockTextSelection
*/
function blockTextSelection() {
_globalDocument2['default'].body.focus();
_globalDocument2['default'].onselectstart = function () {
return false;
};
}
/**
* Turn off text selection blocking
*
* @return {Boolean}
* @method unblockTextSelection
*/
function unblockTextSelection() {
_globalDocument2['default'].onselectstart = function () {
return true;
};
}
/**
* Offset Left
* getBoundingClientRect technique from
* John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
*
* @param {Element} el Element from which to get offset
* @return {Object=}
* @method findElPosition
*/
function findElPosition(el) {
var box = undefined;
if (el.getBoundingClientRect && el.parentNode) {
box = el.getBoundingClientRect();
}
if (!box) {
return {
left: 0,
top: 0
};
}
var docEl = _globalDocument2['default'].documentElement;
var body = _globalDocument2['default'].body;
var clientLeft = docEl.clientLeft || body.clientLeft || 0;
var scrollLeft = _globalWindow2['default'].pageXOffset || body.scrollLeft;
var left = box.left + scrollLeft - clientLeft;
var clientTop = docEl.clientTop || body.clientTop || 0;
var scrollTop = _globalWindow2['default'].pageYOffset || body.scrollTop;
var top = box.top + scrollTop - clientTop;
// Android sometimes returns slightly off decimal values, so need to round
return {
left: Math.round(left),
top: Math.round(top)
};
}
},{"./guid.js":111,"global/document":1,"global/window":2}],108:[function(_dereq_,module,exports){
/**
* @file events.js
*
* Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)
* (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)
* This should work very similarly to jQuery's events, however it's based off the book version which isn't as
* robust as jquery's, so there's probably some differences.
*/
'use strict';
exports.__esModule = true;
exports.on = on;
exports.off = off;
exports.trigger = trigger;
exports.one = one;
exports.fixEvent = fixEvent;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _domJs = _dereq_('./dom.js');
var Dom = _interopRequireWildcard(_domJs);
var _guidJs = _dereq_('./guid.js');
var Guid = _interopRequireWildcard(_guidJs);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* Add an event listener to element
* It stores the handler function in a separate cache object
* and adds a generic handler to the element's event,
* along with a unique id (guid) to the element.
*
* @param {Element|Object} elem Element or object to bind listeners to
* @param {String|Array} type Type of event to bind to.
* @param {Function} fn Event listener.
* @method on
*/
function on(elem, type, fn) {
if (Array.isArray(type)) {
return _handleMultipleEvents(on, elem, type, fn);
}
var data = Dom.getElData(elem);
// We need a place to store all our handler data
if (!data.handlers) data.handlers = {};
if (!data.handlers[type]) data.handlers[type] = [];
if (!fn.guid) fn.guid = Guid.newGUID();
data.handlers[type].push(fn);
if (!data.dispatcher) {
data.disabled = false;
data.dispatcher = function (event, hash) {
if (data.disabled) return;
event = fixEvent(event);
var handlers = data.handlers[event.type];
if (handlers) {
// Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.
var handlersCopy = handlers.slice(0);
for (var m = 0, n = handlersCopy.length; m < n; m++) {
if (event.isImmediatePropagationStopped()) {
break;
} else {
handlersCopy[m].call(elem, event, hash);
}
}
}
};
}
if (data.handlers[type].length === 1) {
if (elem.addEventListener) {
elem.addEventListener(type, data.dispatcher, false);
} else if (elem.attachEvent) {
elem.attachEvent('on' + type, data.dispatcher);
}
}
}
/**
* Removes event listeners from an element
*
* @param {Element|Object} elem Object to remove listeners from
* @param {String|Array=} type Type of listener to remove. Don't include to remove all events from element.
* @param {Function} fn Specific listener to remove. Don't include to remove listeners for an event type.
* @method off
*/
function off(elem, type, fn) {
// Don't want to add a cache object through getElData if not needed
if (!Dom.hasElData(elem)) return;
var data = Dom.getElData(elem);
// If no events exist, nothing to unbind
if (!data.handlers) {
return;
}
if (Array.isArray(type)) {
return _handleMultipleEvents(off, elem, type, fn);
}
// Utility function
var removeType = function removeType(t) {
data.handlers[t] = [];
_cleanUpEvents(elem, t);
};
// Are we removing all bound events?
if (!type) {
for (var t in data.handlers) {
removeType(t);
}return;
}
var handlers = data.handlers[type];
// If no handlers exist, nothing to unbind
if (!handlers) return;
// If no listener was provided, remove all listeners for type
if (!fn) {
removeType(type);
return;
}
// We're only removing a single handler
if (fn.guid) {
for (var n = 0; n < handlers.length; n++) {
if (handlers[n].guid === fn.guid) {
handlers.splice(n--, 1);
}
}
}
_cleanUpEvents(elem, type);
}
/**
* Trigger an event for an element
*
* @param {Element|Object} elem Element to trigger an event on
* @param {Event|Object|String} event A string (the type) or an event object with a type attribute
* @param {Object} [hash] data hash to pass along with the event
* @return {Boolean=} Returned only if default was prevented
* @method trigger
*/
function trigger(elem, event, hash) {
// Fetches element data and a reference to the parent (for bubbling).
// Don't want to add a data object to cache for every parent,
// so checking hasElData first.
var elemData = Dom.hasElData(elem) ? Dom.getElData(elem) : {};
var parent = elem.parentNode || elem.ownerDocument;
// type = event.type || event,
// handler;
// If an event name was passed as a string, creates an event out of it
if (typeof event === 'string') {
event = { type: event, target: elem };
}
// Normalizes the event properties.
event = fixEvent(event);
// If the passed element has a dispatcher, executes the established handlers.
if (elemData.dispatcher) {
elemData.dispatcher.call(elem, event, hash);
}
// Unless explicitly stopped or the event does not bubble (e.g. media events)
// recursively calls this function to bubble the event up the DOM.
if (parent && !event.isPropagationStopped() && event.bubbles === true) {
trigger.call(null, parent, event, hash);
// If at the top of the DOM, triggers the default action unless disabled.
} else if (!parent && !event.defaultPrevented) {
var targetData = Dom.getElData(event.target);
// Checks if the target has a default action for this event.
if (event.target[event.type]) {
// Temporarily disables event dispatching on the target as we have already executed the handler.
targetData.disabled = true;
// Executes the default action.
if (typeof event.target[event.type] === 'function') {
event.target[event.type]();
}
// Re-enables event dispatching.
targetData.disabled = false;
}
}
// Inform the triggerer if the default was prevented by returning false
return !event.defaultPrevented;
}
/**
* Trigger a listener only once for an event
*
* @param {Element|Object} elem Element or object to
* @param {String|Array} type Name/type of event
* @param {Function} fn Event handler function
* @method one
*/
function one(elem, type, fn) {
if (Array.isArray(type)) {
return _handleMultipleEvents(one, elem, type, fn);
}
var func = function func() {
off(elem, type, func);
fn.apply(this, arguments);
};
// copy the guid to the new function so it can removed using the original function's ID
func.guid = fn.guid = fn.guid || Guid.newGUID();
on(elem, type, func);
}
/**
* Fix a native event to have standard property values
*
* @param {Object} event Event object to fix
* @return {Object}
* @private
* @method fixEvent
*/
function fixEvent(event) {
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
// Test if fixing up is needed
// Used to check if !event.stopPropagation instead of isPropagationStopped
// But native events return true for stopPropagation, but don't have
// other expected methods like isPropagationStopped. Seems to be a problem
// with the Javascript Ninja code. So we're just overriding all events now.
if (!event || !event.isPropagationStopped) {
var old = event || _globalWindow2['default'].event;
event = {};
// Clone the old object so that we can modify the values event = {};
// IE8 Doesn't like when you mess with native event properties
// Firefox returns false for event.hasOwnProperty('type') and other props
// which makes copying more difficult.
// TODO: Probably best to create a whitelist of event props
for (var key in old) {
// Safari 6.0.3 warns you if you try to copy deprecated layerX/Y
// Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation
if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation') {
// Chrome 32+ warns if you try to copy deprecated returnValue, but
// we still want to if preventDefault isn't supported (IE8).
if (!(key === 'returnValue' && old.preventDefault)) {
event[key] = old[key];
}
}
}
// The event occurred on this element
if (!event.target) {
event.target = event.srcElement || _globalDocument2['default'];
}
// Handle which other element the event is related to
if (!event.relatedTarget) {
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
}
// Stop the default browser action
event.preventDefault = function () {
if (old.preventDefault) {
old.preventDefault();
}
event.returnValue = false;
old.returnValue = false;
event.defaultPrevented = true;
};
event.defaultPrevented = false;
// Stop the event from bubbling
event.stopPropagation = function () {
if (old.stopPropagation) {
old.stopPropagation();
}
event.cancelBubble = true;
old.cancelBubble = true;
event.isPropagationStopped = returnTrue;
};
event.isPropagationStopped = returnFalse;
// Stop the event from bubbling and executing other handlers
event.stopImmediatePropagation = function () {
if (old.stopImmediatePropagation) {
old.stopImmediatePropagation();
}
event.isImmediatePropagationStopped = returnTrue;
event.stopPropagation();
};
event.isImmediatePropagationStopped = returnFalse;
// Handle mouse position
if (event.clientX != null) {
var doc = _globalDocument2['default'].documentElement,
body = _globalDocument2['default'].body;
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
}
// Handle key presses
event.which = event.charCode || event.keyCode;
// Fix button for mouse clicks:
// 0 == left; 1 == middle; 2 == right
if (event.button != null) {
event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0;
}
}
// Returns fixed-up instance
return event;
}
/**
* Clean up the listener cache and dispatchers
*
* @param {Element|Object} elem Element to clean up
* @param {String} type Type of event to clean up
* @private
* @method _cleanUpEvents
*/
function _cleanUpEvents(elem, type) {
var data = Dom.getElData(elem);
// Remove the events of a particular type if there are none left
if (data.handlers[type].length === 0) {
delete data.handlers[type];
// data.handlers[type] = null;
// Setting to null was causing an error with data.handlers
// Remove the meta-handler from the element
if (elem.removeEventListener) {
elem.removeEventListener(type, data.dispatcher, false);
} else if (elem.detachEvent) {
elem.detachEvent('on' + type, data.dispatcher);
}
}
// Remove the events object if there are no types left
if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
delete data.handlers;
delete data.dispatcher;
delete data.disabled;
}
// Finally remove the element data if there is no data left
if (Object.getOwnPropertyNames(data).length === 0) {
Dom.removeElData(elem);
}
}
/**
* Loops through an array of event types and calls the requested method for each type.
*
* @param {Function} fn The event method we want to use.
* @param {Element|Object} elem Element or object to bind listeners to
* @param {String} type Type of event to bind to.
* @param {Function} callback Event listener.
* @private
* @function _handleMultipleEvents
*/
function _handleMultipleEvents(fn, elem, types, callback) {
types.forEach(function (type) {
//Call the event method for each one of the types
fn(elem, type, callback);
});
}
},{"./dom.js":107,"./guid.js":111,"global/document":1,"global/window":2}],109:[function(_dereq_,module,exports){
/**
* @file fn.js
*/
'use strict';
exports.__esModule = true;
var _guidJs = _dereq_('./guid.js');
/**
* Bind (a.k.a proxy or Context). A simple method for changing the context of a function
* It also stores a unique id on the function so it can be easily removed from events
*
* @param {*} context The object to bind as scope
* @param {Function} fn The function to be bound to a scope
* @param {Number=} uid An optional unique ID for the function to be set
* @return {Function}
* @private
* @method bind
*/
var bind = function bind(context, fn, uid) {
// Make sure the function has a unique ID
if (!fn.guid) {
fn.guid = _guidJs.newGUID();
}
// Create the new function that changes the context
var ret = function ret() {
return fn.apply(context, arguments);
};
// Allow for the ability to individualize this function
// Needed in the case where multiple objects might share the same prototype
// IF both items add an event listener with the same function, then you try to remove just one
// it will remove both because they both have the same guid.
// when using this, you need to use the bind method when you remove the listener as well.
// currently used in text tracks
ret.guid = uid ? uid + '_' + fn.guid : fn.guid;
return ret;
};
exports.bind = bind;
},{"./guid.js":111}],110:[function(_dereq_,module,exports){
/**
* @file format-time.js
*
* Format seconds as a time string, H:MM:SS or M:SS
* Supplying a guide (in seconds) will force a number of leading zeros
* to cover the length of the guide
*
* @param {Number} seconds Number of seconds to be turned into a string
* @param {Number} guide Number (in seconds) to model the string after
* @return {String} Time formatted as H:MM:SS or M:SS
* @private
* @function formatTime
*/
'use strict';
exports.__esModule = true;
function formatTime(seconds) {
var guide = arguments.length <= 1 || arguments[1] === undefined ? seconds : arguments[1];
return (function () {
var s = Math.floor(seconds % 60);
var m = Math.floor(seconds / 60 % 60);
var h = Math.floor(seconds / 3600);
var gm = Math.floor(guide / 60 % 60);
var gh = Math.floor(guide / 3600);
// handle invalid times
if (isNaN(seconds) || seconds === Infinity) {
// '-' is false for all relational operators (e.g. <, >=) so this setting
// will add the minimum number of fields specified by the guide
h = m = s = '-';
}
// Check if we need to show hours
h = h > 0 || gh > 0 ? h + ':' : '';
// If hours are showing, we may need to add a leading zero.
// Always show at least one digit of minutes.
m = ((h || gm >= 10) && m < 10 ? '0' + m : m) + ':';
// Check if leading zero is need for seconds
s = s < 10 ? '0' + s : s;
return h + m + s;
})();
}
exports['default'] = formatTime;
module.exports = exports['default'];
},{}],111:[function(_dereq_,module,exports){
/**
* @file guid.js
*
* Unique ID for an element or function
* @type {Number}
* @private
*/
"use strict";
exports.__esModule = true;
exports.newGUID = newGUID;
var _guid = 1;
/**
* Get the next unique ID
*
* @return {String}
* @function newGUID
*/
function newGUID() {
return _guid++;
}
},{}],112:[function(_dereq_,module,exports){
/**
* @file log.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
/**
* Log plain debug messages
*/
var log = function log() {
_logType(null, arguments);
};
/**
* Keep a history of log messages
* @type {Array}
*/
log.history = [];
/**
* Log error messages
*/
log.error = function () {
_logType('error', arguments);
};
/**
* Log warning messages
*/
log.warn = function () {
_logType('warn', arguments);
};
/**
* Log messages to the console and history based on the type of message
*
* @param {String} type The type of message, or `null` for `log`
* @param {Object} args The args to be passed to the log
* @private
* @method _logType
*/
function _logType(type, args) {
// convert args to an array to get array functions
var argsArray = Array.prototype.slice.call(args);
// if there's no console then don't try to output messages
// they will still be stored in log.history
// Was setting these once outside of this function, but containing them
// in the function makes it easier to test cases where console doesn't exist
var noop = function noop() {};
var console = _globalWindow2['default']['console'] || {
'log': noop,
'warn': noop,
'error': noop
};
if (type) {
// add the type to the front of the message
argsArray.unshift(type.toUpperCase() + ':');
} else {
// default to log with no prefix
type = 'log';
}
// add to history
log.history.push(argsArray);
// add console prefix after adding to history
argsArray.unshift('VIDEOJS:');
// call appropriate log function
if (console[type].apply) {
console[type].apply(console, argsArray);
} else {
// ie8 doesn't allow error.apply, but it will just join() the array anyway
console[type](argsArray.join(' '));
}
}
exports['default'] = log;
module.exports = exports['default'];
},{"global/window":2}],113:[function(_dereq_,module,exports){
/**
* @file merge-options.js
*/
'use strict';
exports.__esModule = true;
exports['default'] = mergeOptions;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _lodashCompatObjectMerge = _dereq_('lodash-compat/object/merge');
var _lodashCompatObjectMerge2 = _interopRequireDefault(_lodashCompatObjectMerge);
function isPlain(obj) {
return !!obj && typeof obj === 'object' && obj.toString() === '[object Object]' && obj.constructor === Object;
}
/**
* Merge customizer. video.js simply overwrites non-simple objects
* (like arrays) instead of attempting to overlay them.
* @see https://lodash.com/docs#merge
*/
var customizer = function customizer(destination, source) {
// If we're not working with a plain object, copy the value as is
// If source is an array, for instance, it will replace destination
if (!isPlain(source)) {
return source;
}
// If the new value is a plain object but the first object value is not
// we need to create a new object for the first object to merge with.
// This makes it consistent with how merge() works by default
// and also protects from later changes the to first object affecting
// the second object's values.
if (!isPlain(destination)) {
return mergeOptions(source);
}
};
/**
* Merge one or more options objects, recursively merging **only**
* plain object properties. Previously `deepMerge`.
*
* @param {...Object} source One or more objects to merge
* @returns {Object} a new object that is the union of all
* provided objects
* @function mergeOptions
*/
function mergeOptions() {
// contruct the call dynamically to handle the variable number of
// objects to merge
var args = Array.prototype.slice.call(arguments);
// unshift an empty object into the front of the call as the target
// of the merge
args.unshift({});
// customize conflict resolution to match our historical merge behavior
args.push(customizer);
_lodashCompatObjectMerge2['default'].apply(null, args);
// return the mutated result object
return args[0];
}
module.exports = exports['default'];
},{"lodash-compat/object/merge":37}],114:[function(_dereq_,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var createStyleElement = function createStyleElement(className) {
var style = _globalDocument2['default'].createElement('style');
style.className = className;
return style;
};
exports.createStyleElement = createStyleElement;
var setTextContent = function setTextContent(el, content) {
if (el.styleSheet) {
el.styleSheet.cssText = content;
} else {
el.textContent = content;
}
};
exports.setTextContent = setTextContent;
},{"global/document":1}],115:[function(_dereq_,module,exports){
/**
* @file time-ranges.js
*
* Should create a fake TimeRange object
* Mimics an HTML5 time range instance, which has functions that
* return the start and end times for a range
* TimeRanges are returned by the buffered() method
*
* @param {Number} start Start time in seconds
* @param {Number} end End time in seconds
* @return {Object} Fake TimeRange object
* @private
* @method createTimeRange
*/
'use strict';
exports.__esModule = true;
exports.createTimeRange = createTimeRange;
function createTimeRange(_start, _end) {
if (_start === undefined && _end === undefined) {
return {
length: 0,
start: function start() {
throw new Error('This TimeRanges object is empty');
},
end: function end() {
throw new Error('This TimeRanges object is empty');
}
};
}
return {
length: 1,
start: function start() {
return _start;
},
end: function end() {
return _end;
}
};
}
},{}],116:[function(_dereq_,module,exports){
/**
* @file to-title-case.js
*
* Uppercase the first letter of a string
*
* @param {String} string String to be uppercased
* @return {String}
* @private
* @method toTitleCase
*/
"use strict";
exports.__esModule = true;
function toTitleCase(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
exports["default"] = toTitleCase;
module.exports = exports["default"];
},{}],117:[function(_dereq_,module,exports){
/**
* @file url.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
/**
* Resolve and parse the elements of a URL
*
* @param {String} url The url to parse
* @return {Object} An object of url details
* @method parseUrl
*/
var parseUrl = function parseUrl(url) {
var props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host'];
// add the url to an anchor and let the browser parse the URL
var a = _globalDocument2['default'].createElement('a');
a.href = url;
// IE8 (and 9?) Fix
// ie8 doesn't parse the URL correctly until the anchor is actually
// added to the body, and an innerHTML is needed to trigger the parsing
var addToBody = a.host === '' && a.protocol !== 'file:';
var div = undefined;
if (addToBody) {
div = _globalDocument2['default'].createElement('div');
div.innerHTML = '<a href="' + url + '"></a>';
a = div.firstChild;
// prevent the div from affecting layout
div.setAttribute('style', 'display:none; position:absolute;');
_globalDocument2['default'].body.appendChild(div);
}
// Copy the specific URL properties to a new object
// This is also needed for IE8 because the anchor loses its
// properties when it's removed from the dom
var details = {};
for (var i = 0; i < props.length; i++) {
details[props[i]] = a[props[i]];
}
// IE9 adds the port to the host property unlike everyone else. If
// a port identifier is added for standard ports, strip it.
if (details.protocol === 'http:') {
details.host = details.host.replace(/:80$/, '');
}
if (details.protocol === 'https:') {
details.host = details.host.replace(/:443$/, '');
}
if (addToBody) {
_globalDocument2['default'].body.removeChild(div);
}
return details;
};
exports.parseUrl = parseUrl;
/**
* Get absolute version of relative URL. Used to tell flash correct URL.
* http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue
*
* @param {String} url URL to make absolute
* @return {String} Absolute URL
* @private
* @method getAbsoluteURL
*/
var getAbsoluteURL = function getAbsoluteURL(url) {
// Check if absolute URL
if (!url.match(/^https?:\/\//)) {
// Convert to absolute URL. Flash hosted off-site needs an absolute URL.
var div = _globalDocument2['default'].createElement('div');
div.innerHTML = '<a href="' + url + '">x</a>';
url = div.firstChild.href;
}
return url;
};
exports.getAbsoluteURL = getAbsoluteURL;
/**
* Returns the extension of the passed file name. It will return an empty string if you pass an invalid path
*
* @param {String} path The fileName path like '/path/to/file.mp4'
* @returns {String} The extension in lower case or an empty string if no extension could be found.
* @method getFileExtension
*/
var getFileExtension = function getFileExtension(path) {
if (typeof path === 'string') {
var splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i;
var pathParts = splitPathRe.exec(path);
if (pathParts) {
return pathParts.pop().toLowerCase();
}
}
return '';
};
exports.getFileExtension = getFileExtension;
},{"global/document":1}],118:[function(_dereq_,module,exports){
/**
* @file video.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _globalDocument = _dereq_('global/document');
var _globalDocument2 = _interopRequireDefault(_globalDocument);
var _setup = _dereq_('./setup');
var setup = _interopRequireWildcard(_setup);
var _utilsStylesheetJs = _dereq_('./utils/stylesheet.js');
var stylesheet = _interopRequireWildcard(_utilsStylesheetJs);
var _component = _dereq_('./component');
var _component2 = _interopRequireDefault(_component);
var _eventTarget = _dereq_('./event-target');
var _eventTarget2 = _interopRequireDefault(_eventTarget);
var _utilsEventsJs = _dereq_('./utils/events.js');
var Events = _interopRequireWildcard(_utilsEventsJs);
var _player = _dereq_('./player');
var _player2 = _interopRequireDefault(_player);
var _pluginsJs = _dereq_('./plugins.js');
var _pluginsJs2 = _interopRequireDefault(_pluginsJs);
var _srcJsUtilsMergeOptionsJs = _dereq_('../../src/js/utils/merge-options.js');
var _srcJsUtilsMergeOptionsJs2 = _interopRequireDefault(_srcJsUtilsMergeOptionsJs);
var _utilsFnJs = _dereq_('./utils/fn.js');
var Fn = _interopRequireWildcard(_utilsFnJs);
var _objectAssign = _dereq_('object.assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _utilsTimeRangesJs = _dereq_('./utils/time-ranges.js');
var _utilsFormatTimeJs = _dereq_('./utils/format-time.js');
var _utilsFormatTimeJs2 = _interopRequireDefault(_utilsFormatTimeJs);
var _utilsLogJs = _dereq_('./utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _xhrJs = _dereq_('./xhr.js');
var _xhrJs2 = _interopRequireDefault(_xhrJs);
var _utilsDomJs = _dereq_('./utils/dom.js');
var Dom = _interopRequireWildcard(_utilsDomJs);
var _utilsBrowserJs = _dereq_('./utils/browser.js');
var browser = _interopRequireWildcard(_utilsBrowserJs);
var _utilsUrlJs = _dereq_('./utils/url.js');
var Url = _interopRequireWildcard(_utilsUrlJs);
var _extendsJs = _dereq_('./extends.js');
var _extendsJs2 = _interopRequireDefault(_extendsJs);
var _lodashCompatObjectMerge = _dereq_('lodash-compat/object/merge');
var _lodashCompatObjectMerge2 = _interopRequireDefault(_lodashCompatObjectMerge);
var _utilsCreateDeprecationProxyJs = _dereq_('./utils/create-deprecation-proxy.js');
var _utilsCreateDeprecationProxyJs2 = _interopRequireDefault(_utilsCreateDeprecationProxyJs);
// Include the built-in techs
var _techHtml5Js = _dereq_('./tech/html5.js');
var _techHtml5Js2 = _interopRequireDefault(_techHtml5Js);
var _techFlashJs = _dereq_('./tech/flash.js');
var _techFlashJs2 = _interopRequireDefault(_techFlashJs);
// HTML5 Element Shim for IE8
if (typeof HTMLVideoElement === 'undefined') {
_globalDocument2['default'].createElement('video');
_globalDocument2['default'].createElement('audio');
_globalDocument2['default'].createElement('track');
}
/**
* Doubles as the main function for users to create a player instance and also
* the main library object.
* The `videojs` function can be used to initialize or retrieve a player.
* ```js
* var myPlayer = videojs('my_video_id');
* ```
*
* @param {String|Element} id Video element or video element ID
* @param {Object=} options Optional options object for config/settings
* @param {Function=} ready Optional ready callback
* @return {Player} A player instance
* @mixes videojs
* @method videojs
*/
var videojs = function videojs(id, options, ready) {
var tag; // Element of ID
// Allow for element or ID to be passed in
// String ID
if (typeof id === 'string') {
// Adjust for jQuery ID syntax
if (id.indexOf('#') === 0) {
id = id.slice(1);
}
// If a player instance has already been created for this ID return it.
if (videojs.getPlayers()[id]) {
// If options or ready funtion are passed, warn
if (options) {
_utilsLogJs2['default'].warn('Player "' + id + '" is already initialised. Options will not be applied.');
}
if (ready) {
videojs.getPlayers()[id].ready(ready);
}
return videojs.getPlayers()[id];
// Otherwise get element for ID
} else {
tag = Dom.getEl(id);
}
// ID is a media element
} else {
tag = id;
}
// Check for a useable element
if (!tag || !tag.nodeName) {
// re: nodeName, could be a box div also
throw new TypeError('The element or ID supplied is not valid. (videojs)'); // Returns
}
// Element may have a player attr referring to an already created player instance.
// If not, set up a new player and return the instance.
return tag['player'] || new _player2['default'](tag, options, ready);
};
// Add default styles
var style = stylesheet.createStyleElement('vjs-styles-defaults');
var head = _globalDocument2['default'].querySelector('head');
head.insertBefore(style, head.firstChild);
stylesheet.setTextContent(style, '\n .video-js {\n width: 300px;\n height: 150px;\n');
// Run Auto-load players
// You have to wait at least once in case this script is loaded after your video in the DOM (weird behavior only with minified version)
setup.autoSetupTimeout(1, videojs);
/*
* Current software version (semver)
*
* @type {String}
*/
videojs.VERSION = '5.0.0-rc.76';
/**
* The global options object. These are the settings that take effect
* if no overrides are specified when the player is created.
*
* ```js
* videojs.options.autoplay = true
* // -> all players will autoplay by default
* ```
*
* @type {Object}
*/
videojs.options = _player2['default'].prototype.options_;
/**
* Get an object with the currently created players, keyed by player ID
*
* @return {Object} The created players
* @mixes videojs
* @method getPlayers
*/
videojs.getPlayers = function () {
return _player2['default'].players;
};
/**
* For backward compatibility, expose players object.
*
* @deprecated
* @memberOf videojs
* @property {Object|Proxy} players
*/
videojs.players = _utilsCreateDeprecationProxyJs2['default'](_player2['default'].players, {
get: 'Access to videojs.players is deprecated; use videojs.getPlayers instead',
set: 'Modification of videojs.players is deprecated'
});
/**
* Get a component class object by name
* ```js
* var VjsButton = videojs.getComponent('Button');
* // Create a new instance of the component
* var myButton = new VjsButton(myPlayer);
* ```
*
* @return {Component} Component identified by name
* @mixes videojs
* @method getComponent
*/
videojs.getComponent = _component2['default'].getComponent;
/**
* Register a component so it can referred to by name
* Used when adding to other
* components, either through addChild
* `component.addChild('myComponent')`
* or through default children options
* `{ children: ['myComponent'] }`.
* ```js
* // Get a component to subclass
* var VjsButton = videojs.getComponent('Button');
* // Subclass the component (see 'extends' doc for more info)
* var MySpecialButton = videojs.extends(VjsButton, {});
* // Register the new component
* VjsButton.registerComponent('MySepcialButton', MySepcialButton);
* // (optionally) add the new component as a default player child
* myPlayer.addChild('MySepcialButton');
* ```
* NOTE: You could also just initialize the component before adding.
* `component.addChild(new MyComponent());`
*
* @param {String} The class name of the component
* @param {Component} The component class
* @return {Component} The newly registered component
* @mixes videojs
* @method registerComponent
*/
videojs.registerComponent = _component2['default'].registerComponent;
/**
* A suite of browser and device tests
*
* @type {Object}
* @private
*/
videojs.browser = browser;
/**
* Whether or not the browser supports touch events. Included for backward
* compatibility with 4.x, but deprecated. Use `videojs.browser.TOUCH_ENABLED`
* instead going forward.
*
* @deprecated
* @type {Boolean}
*/
videojs.TOUCH_ENABLED = browser.TOUCH_ENABLED;
/**
* Subclass an existing class
* Mimics ES6 subclassing with the `extends` keyword
* ```js
* // Create a basic javascript 'class'
* function MyClass(name){
* // Set a property at initialization
* this.myName = name;
* }
* // Create an instance method
* MyClass.prototype.sayMyName = function(){
* alert(this.myName);
* };
* // Subclass the exisitng class and change the name
* // when initializing
* var MySubClass = videojs.extends(MyClass, {
* constructor: function(name) {
* // Call the super class constructor for the subclass
* MyClass.call(this, name)
* }
* });
* // Create an instance of the new sub class
* var myInstance = new MySubClass('John');
* myInstance.sayMyName(); // -> should alert "John"
* ```
*
* @param {Function} The Class to subclass
* @param {Object} An object including instace methods for the new class
* Optionally including a `constructor` function
* @return {Function} The newly created subclass
* @mixes videojs
* @method extends
*/
videojs['extends'] = _extendsJs2['default'];
/**
* Merge two options objects recursively
* Performs a deep merge like lodash.merge but **only merges plain objects**
* (not arrays, elements, anything else)
* Other values will be copied directly from the second object.
* ```js
* var defaultOptions = {
* foo: true,
* bar: {
* a: true,
* b: [1,2,3]
* }
* };
* var newOptions = {
* foo: false,
* bar: {
* b: [4,5,6]
* }
* };
* var result = videojs.mergeOptions(defaultOptions, newOptions);
* // result.foo = false;
* // result.bar.a = true;
* // result.bar.b = [4,5,6];
* ```
*
* @param {Object} The options object whose values will be overriden
* @param {Object} The options object with values to override the first
* @param {Object} Any number of additional options objects
*
* @return {Object} a new object with the merged values
* @mixes videojs
* @method mergeOptions
*/
videojs.mergeOptions = _srcJsUtilsMergeOptionsJs2['default'];
/**
* Change the context (this) of a function
*
* videojs.bind(newContext, function(){
* this === newContext
* });
*
* NOTE: as of v5.0 we require an ES5 shim, so you should use the native
* `function(){}.bind(newContext);` instead of this.
*
* @param {*} context The object to bind as scope
* @param {Function} fn The function to be bound to a scope
* @param {Number=} uid An optional unique ID for the function to be set
* @return {Function}
*/
videojs.bind = Fn.bind;
/**
* Create a Video.js player plugin
* Plugins are only initialized when options for the plugin are included
* in the player options, or the plugin function on the player instance is
* called.
* **See the plugin guide in the docs for a more detailed example**
* ```js
* // Make a plugin that alerts when the player plays
* videojs.plugin('myPlugin', function(myPluginOptions) {
* myPluginOptions = myPluginOptions || {};
*
* var player = this;
* var alertText = myPluginOptions.text || 'Player is playing!'
*
* player.on('play', function(){
* alert(alertText);
* });
* });
* // USAGE EXAMPLES
* // EXAMPLE 1: New player with plugin options, call plugin immediately
* var player1 = videojs('idOne', {
* myPlugin: {
* text: 'Custom text!'
* }
* });
* // Click play
* // --> Should alert 'Custom text!'
* // EXAMPLE 3: New player, initialize plugin later
* var player3 = videojs('idThree');
* // Click play
* // --> NO ALERT
* // Click pause
* // Initialize plugin using the plugin function on the player instance
* player3.myPlugin({
* text: 'Plugin added later!'
* });
* // Click play
* // --> Should alert 'Plugin added later!'
* ```
*
* @param {String} The plugin name
* @param {Function} The plugin function that will be called with options
* @mixes videojs
* @method plugin
*/
videojs.plugin = _pluginsJs2['default'];
/**
* Adding languages so that they're available to all players.
* ```js
* videojs.addLanguage('es', { 'Hello': 'Hola' });
* ```
*
* @param {String} code The language code or dictionary property
* @param {Object} data The data values to be translated
* @return {Object} The resulting language dictionary object
* @mixes videojs
* @method addLanguage
*/
videojs.addLanguage = function (code, data) {
var _merge;
code = ('' + code).toLowerCase();
return _lodashCompatObjectMerge2['default'](videojs.options.languages, (_merge = {}, _merge[code] = data, _merge))[code];
};
/**
* Log debug messages.
*
* @param {...Object} messages One or more messages to log
*/
videojs.log = _utilsLogJs2['default'];
/**
* Creates an emulated TimeRange object.
*
* @param {Number} start Start time in seconds
* @param {Number} end End time in seconds
* @return {Object} Fake TimeRange object
* @method createTimeRange
*/
videojs.createTimeRange = _utilsTimeRangesJs.createTimeRange;
/**
* Format seconds as a time string, H:MM:SS or M:SS
* Supplying a guide (in seconds) will force a number of leading zeros
* to cover the length of the guide
*
* @param {Number} seconds Number of seconds to be turned into a string
* @param {Number} guide Number (in seconds) to model the string after
* @return {String} Time formatted as H:MM:SS or M:SS
* @method formatTime
*/
videojs.formatTime = _utilsFormatTimeJs2['default'];
/**
* Simple http request for retrieving external files (e.g. text tracks)
*
* ##### Example
*
* // using url string
* videojs.xhr('http://example.com/myfile.vtt', function(error, response, responseBody){});
*
* // or options block
* videojs.xhr({
* uri: 'http://example.com/myfile.vtt',
* method: 'GET',
* responseType: 'text'
* }, function(error, response, responseBody){
* if (error) {
* // log the error
* } else {
* // successful, do something with the response
* }
* });
*
*
* API is modeled after the Raynos/xhr.
* https://github.com/Raynos/xhr/blob/master/index.js
*
* @param {Object|String} options Options block or URL string
* @param {Function} callback The callback function
* @returns {Object} The request
*/
videojs.xhr = _xhrJs2['default'];
/**
* Resolve and parse the elements of a URL
*
* @param {String} url The url to parse
* @return {Object} An object of url details
* @method parseUrl
*/
videojs.parseUrl = Url.parseUrl;
/**
* Event target class.
*
* @type {Function}
*/
videojs.EventTarget = _eventTarget2['default'];
/**
* Add an event listener to element
* It stores the handler function in a separate cache object
* and adds a generic handler to the element's event,
* along with a unique id (guid) to the element.
*
* @param {Element|Object} elem Element or object to bind listeners to
* @param {String|Array} type Type of event to bind to.
* @param {Function} fn Event listener.
* @method on
*/
videojs.on = Events.on;
/**
* Trigger a listener only once for an event
*
* @param {Element|Object} elem Element or object to
* @param {String|Array} type Name/type of event
* @param {Function} fn Event handler function
* @method one
*/
videojs.one = Events.one;
/**
* Removes event listeners from an element
*
* @param {Element|Object} elem Object to remove listeners from
* @param {String|Array=} type Type of listener to remove. Don't include to remove all events from element.
* @param {Function} fn Specific listener to remove. Don't include to remove listeners for an event type.
* @method off
*/
videojs.off = Events.off;
/**
* Trigger an event for an element
*
* @param {Element|Object} elem Element to trigger an event on
* @param {Event|Object|String} event A string (the type) or an event object with a type attribute
* @param {Object} [hash] data hash to pass along with the event
* @return {Boolean=} Returned only if default was prevented
* @method trigger
*/
videojs.trigger = Events.trigger;
// REMOVING: We probably should add this to the migration plugin
// // Expose but deprecate the window[componentName] method for accessing components
// Object.getOwnPropertyNames(Component.components).forEach(function(name){
// let component = Component.components[name];
//
// // A deprecation warning as the constuctor
// module.exports[name] = function(player, options, ready){
// log.warn('Using videojs.'+name+' to access the '+name+' component has been deprecated. Please use videojs.getComponent("componentName")');
//
// return new Component(player, options, ready);
// };
//
// // Allow the prototype and class methods to be accessible still this way
// // Though anything that attempts to override class methods will no longer work
// assign(module.exports[name], component);
// });
/*
* Custom Universal Module Definition (UMD)
*
* Video.js will never be a non-browser lib so we can simplify UMD a bunch and
* still support requirejs and browserify. This also needs to be closure
* compiler compatible, so string keys are used.
*/
if (typeof define === 'function' && define['amd']) {
define('videojs', [], function () {
return videojs;
});
// checking that module is an object too because of umdjs/umd#35
} else if (typeof exports === 'object' && typeof module === 'object') {
module['exports'] = videojs;
}
exports['default'] = videojs;
module.exports = exports['default'];
},{"../../src/js/utils/merge-options.js":113,"./component":48,"./event-target":79,"./extends.js":80,"./player":87,"./plugins.js":88,"./setup":90,"./tech/flash.js":93,"./tech/html5.js":94,"./utils/browser.js":104,"./utils/create-deprecation-proxy.js":106,"./utils/dom.js":107,"./utils/events.js":108,"./utils/fn.js":109,"./utils/format-time.js":110,"./utils/log.js":112,"./utils/stylesheet.js":114,"./utils/time-ranges.js":115,"./utils/url.js":117,"./xhr.js":119,"global/document":1,"lodash-compat/object/merge":37,"object.assign":40}],119:[function(_dereq_,module,exports){
/**
* @file xhr.js
*/
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _utilsUrlJs = _dereq_('./utils/url.js');
var Url = _interopRequireWildcard(_utilsUrlJs);
var _utilsLogJs = _dereq_('./utils/log.js');
var _utilsLogJs2 = _interopRequireDefault(_utilsLogJs);
var _utilsMergeOptionsJs = _dereq_('./utils/merge-options.js');
var _utilsMergeOptionsJs2 = _interopRequireDefault(_utilsMergeOptionsJs);
var _globalWindow = _dereq_('global/window');
var _globalWindow2 = _interopRequireDefault(_globalWindow);
/*
* Simple http request for retrieving external files (e.g. text tracks)
* ##### Example
* // using url string
* videojs.xhr('http://example.com/myfile.vtt', function(error, response, responseBody){});
*
* // or options block
* videojs.xhr({
* uri: 'http://example.com/myfile.vtt',
* method: 'GET',
* responseType: 'text'
* }, function(error, response, responseBody){
* if (error) {
* // log the error
* } else {
* // successful, do something with the response
* }
* });
* /////////////
* API is modeled after the Raynos/xhr, which we hope to use after
* getting browserify implemented.
* https://github.com/Raynos/xhr/blob/master/index.js
*
* @param {Object|String} options Options block or URL string
* @param {Function} callback The callback function
* @return {Object} The request
* @method xhr
*/
var xhr = function xhr(options, callback) {
var abortTimeout = undefined;
// If options is a string it's the url
if (typeof options === 'string') {
options = {
uri: options
};
}
// Merge with default options
options = _utilsMergeOptionsJs2['default']({
method: 'GET',
timeout: 45 * 1000
}, options);
callback = callback || function () {};
var XHR = _globalWindow2['default'].XMLHttpRequest;
if (typeof XHR === 'undefined') {
// Shim XMLHttpRequest for older IEs
XHR = function () {
try {
return new _globalWindow2['default'].ActiveXObject('Msxml2.XMLHTTP.6.0');
} catch (e) {}
try {
return new _globalWindow2['default'].ActiveXObject('Msxml2.XMLHTTP.3.0');
} catch (f) {}
try {
return new _globalWindow2['default'].ActiveXObject('Msxml2.XMLHTTP');
} catch (g) {}
throw new Error('This browser does not support XMLHttpRequest.');
};
}
var request = new XHR();
// Store a reference to the url on the request instance
request.uri = options.uri;
var urlInfo = Url.parseUrl(options.uri);
var winLoc = _globalWindow2['default'].location;
var successHandler = function successHandler() {
_globalWindow2['default'].clearTimeout(abortTimeout);
callback(null, request, request.response || request.responseText);
};
var errorHandler = function errorHandler(err) {
_globalWindow2['default'].clearTimeout(abortTimeout);
if (!err || typeof err === 'string') {
err = new Error(err || 'XHR Failed with a response of: ' + (request && (request.response || request.responseText)));
}
callback(err, request);
};
// Check if url is for another domain/origin
// IE8 doesn't know location.origin, so we won't rely on it here
var crossOrigin = urlInfo.protocol + urlInfo.host !== winLoc.protocol + winLoc.host;
// XDomainRequest -- Use for IE if XMLHTTPRequest2 isn't available
// 'withCredentials' is only available in XMLHTTPRequest2
// Also XDomainRequest has a lot of gotchas, so only use if cross domain
if (crossOrigin && _globalWindow2['default'].XDomainRequest && !('withCredentials' in request)) {
request = new _globalWindow2['default'].XDomainRequest();
request.onload = successHandler;
request.onerror = errorHandler;
// These blank handlers need to be set to fix ie9
// http://cypressnorth.com/programming/internet-explorer-aborting-ajax-requests-fixed/
request.onprogress = function () {};
request.ontimeout = function () {};
// XMLHTTPRequest
} else {
(function () {
var fileUrl = urlInfo.protocol === 'file:' || winLoc.protocol === 'file:';
request.onreadystatechange = function () {
if (request.readyState === 4) {
if (request.timedout) {
return errorHandler('timeout');
}
if (request.status === 200 || fileUrl && request.status === 0) {
successHandler();
} else {
errorHandler();
}
}
};
if (options.timeout) {
abortTimeout = _globalWindow2['default'].setTimeout(function () {
if (request.readyState !== 4) {
request.timedout = true;
request.abort();
}
}, options.timeout);
}
})();
}
// open the connection
try {
// Third arg is async, or ignored by XDomainRequest
request.open(options.method || 'GET', options.uri, true);
} catch (err) {
return errorHandler(err);
}
// withCredentials only supported by XMLHttpRequest2
if (options.withCredentials) {
request.withCredentials = true;
}
if (options.responseType) {
request.responseType = options.responseType;
}
// send the request
try {
request.send();
} catch (err) {
return errorHandler(err);
}
return request;
};
exports['default'] = xhr;
module.exports = exports['default'];
},{"./utils/log.js":112,"./utils/merge-options.js":113,"./utils/url.js":117,"global/window":2}]},{},[118])(118)
});
//# sourceMappingURL=video.js.map |
lib/ui/example/client/preview.js | nfl/react-storybook | import React from 'react';
const mainStyle = {
padding: 10,
fontFamily: 'arial',
};
export default class Preview extends React.Component {
constructor(globalState) {
super();
this.state = {};
this.globalState = globalState;
this.globalState.on('change', (kind, story) => {
if (this.mounted) {
this.setState({
kind,
story,
});
} else {
this.state = {
...this.state,
kind,
story,
};
}
});
}
componentDidMount() {
this.mounted = true;
}
componentWillUnmount() {
this.mounted = false;
}
jump() {
const { kind, story } = this.state;
this.globalState.emit('jump', 'Component 2', 'State b');
}
toggleFullscreen() {
this.globalState.emit('toggleFullscreen');
}
render() {
const { kind, story } = this.state;
return (
<div style={mainStyle}>
<h3>Rendering the Preview</h3>
{kind} => {story}
<ul>
<li>
<button onClick={this.jump.bind(this)}>Jump to Component2:State b</button>
</li>
<li>
<button onClick={this.toggleFullscreen.bind(this)}>Go FullScreen</button>
</li>
</ul>
</div>
);
}
}
|
app/jsx/gradebook/default_gradebook/components/content-filters/GradingPeriodFilter.js | djbender/canvas-lms | /*
* Copyright (C) 2019 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react'
import {arrayOf, shape, string} from 'prop-types'
import I18n from 'i18n!gradebook_default_gradebook_components_content_filters_grading_period_filter'
import ContentFilter from './ContentFilter'
function normalizeGradingPeriods(gradingPeriods) {
return gradingPeriods.map(gradingPeriod => ({
id: gradingPeriod.id,
name: gradingPeriod.title
}))
}
export default function GradingPeriodFilter(props) {
const {gradingPeriods, selectedGradingPeriodId, ...filterProps} = props
return (
<ContentFilter
{...filterProps}
allItemsId="0"
allItemsLabel={I18n.t('All Grading Periods')}
items={normalizeGradingPeriods(gradingPeriods)}
label={I18n.t('Grading Period Filter')}
selectedItemId={selectedGradingPeriodId}
/>
)
}
GradingPeriodFilter.propTypes = {
gradingPeriods: arrayOf(
shape({
id: string.isRequired,
title: string.isRequired
})
).isRequired,
selectedGradingPeriodId: string
}
GradingPeriodFilter.defaultProps = {
selectedGradingPeriodId: null
}
|
www/js/jquery-1.10.1.min.js | nicowcorbiere/My-weather-dressing | /*! jQuery v1.10.1 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.1.min.map
*/
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.1",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=lt(),k=lt(),E=lt(),S=!1,A=function(){return 0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=bt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+xt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return At(e.replace(z,"$1"),t,n,i)}function st(e){return K.test(e+"")}function lt(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function ut(e){return e[b]=!0,e}function ct(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function pt(e,t,n){e=e.split("|");var r,i=e.length,a=n?null:t;while(i--)(r=o.attrHandle[e[i]])&&r!==t||(o.attrHandle[e[i]]=a)}function ft(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:e[t]===!0?t.toLowerCase():null}function dt(e,t){return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}function ht(e){return"input"===e.nodeName.toLowerCase()?e.defaultValue:t}function gt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function mt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function yt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function vt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.parentWindow;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.frameElement&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ct(function(e){return e.innerHTML="<a href='#'></a>",pt("type|href|height|width",dt,"#"===e.firstChild.getAttribute("href")),pt(B,ft,null==e.getAttribute("disabled")),e.className="i",!e.getAttribute("className")}),r.input=ct(function(e){return e.innerHTML="<input>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}),pt("value",ht,r.attributes&&r.input),r.getElementsByTagName=ct(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ct(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ct(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=st(n.querySelectorAll))&&(ct(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ct(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=st(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ct(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=st(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},r.sortDetached=ct(function(e){return 1&e.compareDocumentPosition(n.createElement("div"))}),A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return gt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?gt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:ut,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=bt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ut(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?ut(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ut(function(e){return function(t){return at(e,t).length>0}}),contains:ut(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:ut(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:vt(function(){return[0]}),last:vt(function(e,t){return[t-1]}),eq:vt(function(e,t,n){return[0>n?n+t:n]}),even:vt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:vt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:vt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:vt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=mt(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=yt(n);function bt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function xt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function wt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function Tt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Ct(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function Nt(e,t,n,r,i,o){return r&&!r[b]&&(r=Nt(r)),i&&!i[b]&&(i=Nt(i,o)),ut(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||St(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:Ct(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=Ct(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=Ct(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function kt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=wt(function(e){return e===t},s,!0),p=wt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[wt(Tt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return Nt(l>1&&Tt(f),l>1&&xt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&kt(e.slice(l,r)),i>r&&kt(e=e.slice(r)),i>r&&xt(e))}f.push(n)}return Tt(f)}function Et(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=Ct(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?ut(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=bt(e)),n=t.length;while(n--)o=kt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Et(i,r))}return o};function St(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function At(e,t,n,i){var a,s,u,c,p,f=bt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&xt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}o.pseudos.nth=o.pseudos.eq;function jt(){}jt.prototype=o.filters=o.pseudos,o.setFilters=new jt,r.sortStable=b.split("").sort(A).join("")===b,p(),[0,0].sort(A),r.detectDuplicates=S,x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||i&&!u||(n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)
}),n=s=l=u=r=o=null,t}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=x(this),l=t,u=e.match(T)||[];while(o=u[a++])l=r?l:!s.hasClass(o),s[l?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
|
frontend/src/admin/common/tables/SortedTable.js | rabblerouser/core | import React, { Component } from 'react';
import styled from 'styled-components';
import Table from './Table';
import sortColumn from './sortColumn';
const TableAside = styled.aside`
padding: 15px;
font-size: 14px;
background-color: ${props => props.theme.lightGrey};
font-style: italic;
`;
class SortedTable extends Component {
constructor(props) {
super(props);
this.onSort = this.onSort.bind(this);
this.state = sortColumn(props.sortOn, props.columns, props.data);
}
componentWillReceiveProps(props) {
this.setState(sortColumn(props.sortOn, props.columns, props.data));
}
onSort(field) {
this.setState(sortColumn(field, this.state.columns, this.state.data));
}
render() {
return (
this.state.data.length === 0 ?
<TableAside>No entries found</TableAside>
:
<Table
columns={this.state.columns}
data={this.state.data}
onClickHeader={this.onSort}
/>
);
}
}
export default SortedTable;
|
ajax/libs/angular.js/1.0.4/angular-scenario.js | idleberg/cdnjs | /*!
* jQuery JavaScript Library v1.7.2
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Wed Mar 21 12:46:34 2012 -0700
*/
(function( window, undefined ) {
'use strict';
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
if ( selector.charAt(0) === "<" && selector.charAt( 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 = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context ? context.ownerDocument || context : document );
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.7.2",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.add( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
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;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
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 = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.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({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// 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,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// 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.fireWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).off( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery.Callbacks( "once memory" );
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array, i ) {
var len;
if ( array ) {
if ( indexOf ) {
return indexOf.call( array, elem, i );
}
len = array.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in array && array[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var 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
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, 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 || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
var exec,
bulk = key == null,
i = 0,
length = elems.length;
// Sets many values
if ( key && typeof key === "object" ) {
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
}
chainable = 1;
// Sets one value
} else if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = pass === undefined && jQuery.isFunction( value );
if ( bulk ) {
// Bulk operations only iterate when executing function values
if ( exec ) {
exec = fn;
fn = function( elem, key, value ) {
return exec.call( jQuery( elem ), value );
};
// Otherwise they run against the entire set
} else {
fn.call( elems, value );
fn = null;
}
}
if ( fn ) {
for (; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
}
chainable = 1;
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
sub: function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
return jQuery;
})();
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
/*
* Create a callback list using the following parameters:
*
* flags: an optional list of space-separated flags that will change how
* the callback list behaves
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible flags:
*
* 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( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
fired = true;
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory || memory === true ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
Deferred: function( func ) {
var doneList = jQuery.Callbacks( "once memory" ),
failList = jQuery.Callbacks( "once memory" ),
progressList = jQuery.Callbacks( "memory" ),
state = "pending",
lists = {
resolve: doneList,
reject: failList,
notify: progressList
},
promise = {
done: doneList.add,
fail: failList.add,
progress: progressList.add,
state: function() {
return state;
},
// Deprecated
isResolved: doneList.fired,
isRejected: failList.fired,
then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
return this;
},
always: function() {
deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
return this;
},
pipe: function( fnDone, fnFail, fnProgress ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ],
progress: [ fnProgress, "notify" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
obj = promise;
} else {
for ( var key in promise ) {
obj[ key ] = promise[ key ];
}
}
return obj;
}
},
deferred = promise.promise({}),
key;
for ( key in lists ) {
deferred[ key ] = lists[ key ].fire;
deferred[ key + "With" ] = lists[ key ].fireWith;
}
// Handle state
deferred.done( function() {
state = "resolved";
}, failList.disable, progressList.lock ).fail( function() {
state = "rejected";
}, doneList.disable, progressList.lock );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = sliceDeferred.call( arguments, 0 ),
i = 0,
length = args.length,
pValues = new Array( length ),
count = length,
pCount = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred(),
promise = deferred.promise();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
deferred.resolveWith( deferred, args );
}
};
}
function progressFunc( i ) {
return function( value ) {
pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
deferred.notifyWith( promise, pValues );
};
}
if ( length > 1 ) {
for ( ; i < length; i++ ) {
if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return promise;
}
});
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
fragment,
tds,
events,
eventName,
i,
isSupported,
div = document.createElement( "div" ),
documentElement = document.documentElement;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form(#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
pixelMargin: true
};
// jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: 1,
change: 1,
focusin: 1
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
fragment.removeChild( div );
// Null elements to avoid leaks in IE
fragment = select = opt = div = input = null;
// Run tests that need a body at doc ready
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
paddingMarginBorderVisibility, paddingMarginBorder,
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
conMarginTop = 1;
paddingMarginBorder = "padding:0;margin:0;border:";
positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
"<table " + style + "' cellpadding='0' cellspacing='0'>" +
"<tr><td></td></tr></table>";
container = document.createElement("div");
container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( window.getComputedStyle ) {
div.innerHTML = "";
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.width = div.style.padding = "1px";
div.style.border = 0;
div.style.overflow = "hidden";
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "<div style='width:5px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
}
div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
div.innerHTML = html;
outer = div.firstChild;
inner = outer.firstChild;
td = outer.nextSibling.firstChild.firstChild;
offsetSupport = {
doesNotAddBorder: ( inner.offsetTop !== 5 ),
doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
};
inner.style.position = "fixed";
inner.style.top = "20px";
// safari subtracts parent border width here which is 5px
offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
inner.style.position = inner.style.top = "";
outer.style.overflow = "hidden";
outer.style.position = "relative";
offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
if ( window.getComputedStyle ) {
div.style.marginTop = "1%";
support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
}
if ( typeof container.style.zoom !== "undefined" ) {
container.style.zoom = 1;
}
body.removeChild( container );
marginDiv = div = container = null;
jQuery.extend( support, offsetSupport );
});
return support;
})();
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var privateCache, thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
isEvents = name === "events";
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = ++jQuery.uuid;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
privateCache = thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ internalKey ] : internalKey;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split( " " );
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the cache and need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
jQuery.isNumeric( data ) ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = ( type || "fx" ) + "mark";
jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
if ( count ) {
jQuery._data( elem, key, count );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
var q;
if ( elem ) {
type = ( type || "fx" ) + "queue";
q = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
hooks = {};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
jQuery._data( elem, type + ".run", hooks );
fn.call( elem, function() {
jQuery.dequeue( elem, type );
}, hooks );
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue " + type + ".run", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( 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 );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
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 = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( 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( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise( object );
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = ( value || "" ).split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( 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;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.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( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, i, max, option,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
i = one ? index : 0;
max = one ? index + 1 : options.length;
for ( ; i < max; i++ ) {
option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.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 );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, l, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.toLowerCase().split( rspace );
l = attrNames.length;
for ( ; i < l; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// 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;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.nodeValue = value + "" );
}
};
// Apply the nodeHook to tabindex
jQuery.attrHooks.tabindex.set = nodeHook.set;
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = "" + value );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
quickParse = function( selector ) {
var quick = rquickIs.exec( selector );
if ( quick ) {
// 0 1 2 3
// [ _, tag, id, class ]
quick[1] = ( quick[1] || "" ).toLowerCase();
quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
}
return quick;
},
quickIs = function( elem, m ) {
var attrs = elem.attributes || {};
return (
(!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
(!m[2] || (attrs.id || {}).value === m[2]) &&
(!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
);
},
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, quick, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
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;
}
// 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
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = 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" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// 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: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
quick: selector && quickParse( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + 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;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, origType, namespaces, origCount,
j, events, special, handle, eventType, handleObj;
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// 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;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.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 ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, [ "events", "handle" ], true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var type = event.type || event,
namespaces = [],
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
// 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( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// 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 ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( 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)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
old = null;
for ( ; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old && old === elem.ownerDocument ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === 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( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
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 ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [],
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
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 that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
// Pregenerate a single jQuery object for reuse with .is()
jqcur = jQuery(this);
jqcur.context = this.ownerDocument || this;
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process events on disabled elements (#6911, #8165)
if ( cur.disabled !== true ) {
selMatch = {};
matches = [];
jqcur[0] = cur;
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = (
handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
);
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( 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;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
if ( event.metaKey === undefined ) {
event.metaKey = event.ctrlKey;
}
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady
},
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + 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.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// 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;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector,
ret;
// For mousenter/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;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
jQuery.event.simulate( "change", this, event, true );
}
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
elem._change_attached = true;
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
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 this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( 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 this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
var handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( var 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 );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
expando = "sizcache" + (Math.random() + '').replace('.', ''),
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context, seed );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set, seed );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set, i, len, match, type, left;
if ( !expr ) {
return [];
}
for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
type, found, item, filter, left,
i, pass,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
filter = Expr.filter[ type ];
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
pass = not ^ found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Utility function for retreiving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
var getText = Sizzle.getText = function( elem ) {
var i, node,
nodeType = elem.nodeType,
ret = "";
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent || innerText for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
} else {
// If no nodeType, this is expected to be an array
for ( i = 0; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
if ( node.nodeType !== 8 ) {
ret += getText( node );
}
}
}
return ret;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var first, last,
doneName, parent, cache,
count, diff,
type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
first = match[2];
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
doneName = match[0];
parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent[ expando ] = doneName;
}
diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
!type && Sizzle.attr ?
result != null :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
// Expose origPOS
// "global" as in regardless of relation to brackets/parens
Expr.match.globalPOS = origPOS;
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
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 : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context, seed ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet, seed );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.globalPOS,
// 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({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) {
var level = 1;
while ( cur && cur.ownerDocument && cur !== context ) {
for ( i = 0; i < selectors.length; i++ ) {
if ( jQuery( cur ).is( selectors[ i ] ) ) {
ret.push({ selector: selectors[ i ], elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var 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.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( 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( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery.clean( arguments );
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery.clean(arguments) );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
null;
}
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName( "*" ) );
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( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || ( l > 1 && i < lastIndex ) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
type: "GET",
global: false,
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
});
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
// Clear flags for bubbling special change/submit events, they must
// be reattached when the newly cloned events are first activated
dest.removeAttribute( "_submit_attached" );
dest.removeAttribute( "_change_attached" );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ first ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ first ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "input" ) {
fixDefaultChecked( elem );
// Skip scripts, get other children
} else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
function shimCloneNode( elem ) {
var div = document.createElement( "div" );
safeFragment.appendChild( div );
div.innerHTML = elem.outerHTML;
return div.firstChild;
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
// IE<=8 does not properly clone detached, unknown element nodes
clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
elem.cloneNode( true ) :
shimCloneNode( elem );
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType, script, j,
ret = [];
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div"),
safeChildNodes = safeFragment.childNodes,
remove;
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
// Use the fragment we've already created for this document
safeFragment.appendChild( div );
} else {
// Use a fragment created with the owner document
createSafeFragment( context ).appendChild( div );
}
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
// Clear elements from DocumentFragment (safeFragment or otherwise)
// to avoid hoarding elements. Fixes #11356
if ( div ) {
div.parentNode.removeChild( div );
// Guard against -1 index exceptions in FF3.6
if ( safeChildNodes.length > 0 ) {
remove = safeChildNodes[ safeChildNodes.length - 1 ];
if ( remove && remove.parentNode ) {
remove.parentNode.removeChild( remove );
}
}
}
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
script = ret[i];
if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
} else {
if ( script.nodeType === 1 ) {
var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( script );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id,
cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
if ( data && data.events ) {
for ( var 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 );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
rrelNum = /^([\-+])=([\-+.\de]+)/,
rmargin = /^margin/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
// order is important!
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": 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: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( 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, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} 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( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {},
ret, name;
// 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.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// DEPRECATED in 1.3, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle, width,
style = elem.style;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( (defaultView = elem.ownerDocument.defaultView) &&
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
// A tribute to the "awesome hack by Dean Edwards"
// WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
// which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
width = style.width;
style.width = ret;
ret = computedStyle.width;
style.width = width;
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && (uncomputed = style[ name ]) ) {
ret = uncomputed;
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( rnumnonpx.test( ret ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
i = name === "width" ? 1 : 0,
len = 4;
if ( val > 0 ) {
if ( extra !== "border" ) {
for ( ; i < len; i += 2 ) {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
}
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
for ( ; i < len; i += 2 ) {
val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
}
}
}
return val + "px";
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWidthOrHeight( elem, name, extra );
} else {
return jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
});
}
}
},
set: function( elem, value ) {
return rnum.test( value ) ?
value + "px" :
value;
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
return curCSS( elem, "margin-right" );
} else {
return elem.style.marginRight;
}
});
}
};
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ],
expanded = {};
for ( i = 0; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* 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 = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// 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 = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// 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 );
}
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// 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 ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.on( o, f );
};
});
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;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// 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: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || "abort";
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
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;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( !statusText || status ) {
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( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ 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" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.then( tmp, tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// 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 ( state === 2 ) {
return false;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// 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 If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// 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 || state === 2 ) ) {
// Abort if not done already
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// 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 ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.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 ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.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 {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// 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
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for ( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for ( key in s.converters ) {
if ( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if ( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for ( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.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 ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( _ ) {
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
// if we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( (display === "" && jQuery.css(elem, "display") === "none") ||
!jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
var elem, display,
i = 0,
j = this.length;
for ( ; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = jQuery.css( elem, "display" );
if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed( speed, easing, callback );
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
function doAnimation() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p, e, hooks, replace,
parts, start, end, unit,
method;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
// first pass over propertys to expand / normalize
for ( p in prop ) {
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
replace = hooks.expand( prop[ name ] );
delete prop[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'p' from above because we have the correct "name"
for ( p in replace ) {
if ( ! ( p in prop ) ) {
prop[ p ] = replace[ p ];
}
}
}
}
for ( name in prop ) {
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.zoom = 1;
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test( val ) ) {
// Tracks whether to show or hide based on private
// data attached to the element
method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
if ( method ) {
jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
e[ method ]();
} else {
e[ val ]();
}
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ( (end || 1) / e.cur() ) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
}
return optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var index,
hadTimers = false,
timers = jQuery.timers,
data = jQuery._data( this );
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
function stopQueue( elem, data, index ) {
var hooks = data[ index ];
jQuery.removeData( elem, index, true );
hooks.stop( gotoEnd );
}
if ( type == null ) {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
stopQueue( this, data, index );
}
}
} else if ( data[ index = type + ".run" ] && data[ index ].stop ){
stopQueue( this, data, index );
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
if ( gotoEnd ) {
// force the next step to be the last
timers[ index ]( true );
} else {
timers[ index ].saveState();
}
hadTimers = true;
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 ( !( gotoEnd && hadTimers ) ) {
jQuery.dequeue( this, type );
}
});
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx( "show", 1 ),
slideUp: genFx( "hide", 1 ),
slideToggle: genFx( "toggle", 1 ),
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.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ 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( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p ) {
return p;
},
swing: function( p ) {
return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
},
// Get the current size
cur: function() {
if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.end = to;
this.now = this.start = from;
this.pos = this.state = 0;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
function t( gotoEnd ) {
return self.step( gotoEnd );
}
t.queue = this.options.queue;
t.elem = this.elem;
t.saveState = function() {
if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
if ( self.options.hide ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.start );
} else if ( self.options.show ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.end );
}
}
};
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any flash of content
if ( dataShow !== undefined ) {
// This show is picking up where a previous hide or show left off
this.custom( this.cur(), dataShow );
} else {
this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
}
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom( this.cur(), 0 );
},
// Each step of an animation
step: function( gotoEnd ) {
var p, n, complete,
t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( p in options.animatedProperties ) {
if ( options.animatedProperties[ p ] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function( index, value ) {
elem.style[ "overflow" + value ] = options.overflow[ index ];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery( elem ).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[ p ] );
jQuery.removeData( elem, "fxshow" + p, true );
// Toggle data is no longer needed
jQuery.removeData( elem, "toggle" + p, true );
}
}
// Execute the complete function
// in the event that the complete function throws an exception
// we must ensure it won't be called twice. #5684
complete = options.complete;
if ( complete ) {
options.complete = false;
complete.call( elem );
}
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ( (this.end - this.start) * this.pos );
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
var timer,
timers = jQuery.timers,
i = 0;
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
// Ensure props that can't be negative don't go there on undershoot easing
jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
// exclude marginTop, marginLeft, marginBottom and marginRight from this list
if ( prop.indexOf( "margin" ) ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
};
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var getOffset,
rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
getOffset = function( elem, doc, docElem, box ) {
try {
box = elem.getBoundingClientRect();
} catch(e) {}
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow( doc ),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
getOffset = function( elem, doc, docElem ) {
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var elem = this[0],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return null;
}
if ( elem === doc.body ) {
return jQuery.offset.bodyOffset( elem );
}
return getOffset( elem, doc, doc.documentElement );
};
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// 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 ) ) {
options = options.call( elem, i, 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({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
var clientProp = "client" + name,
scrollProp = "scroll" + name,
offsetProp = "offset" + name;
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};
jQuery.fn[ type ] = function( value ) {
return jQuery.access( this, function( elem, type, value ) {
var doc, docElemProp, orig, ret;
if ( jQuery.isWindow( elem ) ) {
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
doc = elem.document;
docElemProp = doc.documentElement[ clientProp ];
return jQuery.support.boxModel && docElemProp ||
doc.body && doc.body[ clientProp ] || docElemProp;
}
// Get document width or height
if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
doc = elem.documentElement;
// when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
// so we can't use max, as it'll choose the incorrect offset[Width/Height]
// instead we use the correct client[Width/Height]
// support:IE6
if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
return doc[ clientProp ];
}
return Math.max(
elem.body[ scrollProp ], doc[ scrollProp ],
elem.body[ offsetProp ], doc[ offsetProp ]
);
}
// Get width or height on the element
if ( value === undefined ) {
orig = jQuery.css( elem, type );
ret = parseFloat( orig );
return jQuery.isNumeric( ret ) ? ret : orig;
}
// Set the width or height on the element
jQuery( elem ).css( type, value );
}, type, value, arguments.length, null );
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use 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.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
/**
* @license AngularJS v1.0.4
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document){
var _jQuery = window.jQuery.noConflict(true);
////////////////////////////////////
/**
* @ngdoc function
* @name angular.lowercase
* @function
*
* @description Converts the specified string to lowercase.
* @param {string} string String to be converted to lowercase.
* @returns {string} Lowercased string.
*/
var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;};
/**
* @ngdoc function
* @name angular.uppercase
* @function
*
* @description Converts the specified string to uppercase.
* @param {string} string String to be converted to uppercase.
* @returns {string} Uppercased string.
*/
var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;};
var manualLowercase = function(s) {
return isString(s)
? s.replace(/[A-Z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) | 32);})
: s;
};
var manualUppercase = function(s) {
return isString(s)
? s.replace(/[a-z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) & ~32);})
: s;
};
// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
// with correct but slower alternatives.
if ('i' !== 'I'.toLowerCase()) {
lowercase = manualLowercase;
uppercase = manualUppercase;
}
function fromCharCode(code) {return String.fromCharCode(code);}
var Error = window.Error,
/** holds major version number for IE or NaN for real browsers */
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
jqLite, // delay binding since jQuery could be loaded after us.
jQuery, // delay binding
slice = [].slice,
push = [].push,
toString = Object.prototype.toString,
/** @name angular */
angular = window.angular || (window.angular = {}),
angularModule,
nodeName_,
uid = ['0', '0', '0'];
/**
* @ngdoc function
* @name angular.forEach
* @function
*
* @description
* Invokes the `iterator` function once for each item in `obj` collection, which can be either an
* object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`
* is the value of an object property or an array element and `key` is the object property key or
* array element index. Specifying a `context` for the function is optional.
*
* Note: this function was previously known as `angular.foreach`.
*
<pre>
var values = {name: 'misko', gender: 'male'};
var log = [];
angular.forEach(values, function(value, key){
this.push(key + ': ' + value);
}, log);
expect(log).toEqual(['name: misko', 'gender:male']);
</pre>
*
* @param {Object|Array} obj Object to iterate over.
* @param {Function} iterator Iterator function.
* @param {Object=} context Object to become context (`this`) for the iterator function.
* @returns {Object|Array} Reference to `obj`.
*/
function forEach(obj, iterator, context) {
var key;
if (obj) {
if (isFunction(obj)){
for (key in obj) {
if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key);
}
}
} else if (obj.forEach && obj.forEach !== forEach) {
obj.forEach(iterator, context);
} else if (isObject(obj) && isNumber(obj.length)) {
for (key = 0; key < obj.length; key++)
iterator.call(context, obj[key], key);
} else {
for (key in obj) {
if (obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key);
}
}
}
}
return obj;
}
function sortedKeys(obj) {
var keys = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
keys.push(key);
}
}
return keys.sort();
}
function forEachSorted(obj, iterator, context) {
var keys = sortedKeys(obj);
for ( var i = 0; i < keys.length; i++) {
iterator.call(context, obj[keys[i]], keys[i]);
}
return keys;
}
/**
* when using forEach the params are value, key, but it is often useful to have key, value.
* @param {function(string, *)} iteratorFn
* @returns {function(*, string)}
*/
function reverseParams(iteratorFn) {
return function(value, key) { iteratorFn(key, value) };
}
/**
* A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
* characters such as '012ABC'. The reason why we are not using simply a number counter is that
* the number string gets longer over time, and it can also overflow, where as the the nextId
* will grow much slower, it is a string, and it will never overflow.
*
* @returns an unique alpha-numeric string
*/
function nextUid() {
var index = uid.length;
var digit;
while(index) {
index--;
digit = uid[index].charCodeAt(0);
if (digit == 57 /*'9'*/) {
uid[index] = 'A';
return uid.join('');
}
if (digit == 90 /*'Z'*/) {
uid[index] = '0';
} else {
uid[index] = String.fromCharCode(digit + 1);
return uid.join('');
}
}
uid.unshift('0');
return uid.join('');
}
/**
* @ngdoc function
* @name angular.extend
* @function
*
* @description
* Extends the destination object `dst` by copying all of the properties from the `src` object(s)
* to `dst`. You can specify multiple `src` objects.
*
* @param {Object} dst Destination object.
* @param {...Object} src Source object(s).
*/
function extend(dst) {
forEach(arguments, function(obj){
if (obj !== dst) {
forEach(obj, function(value, key){
dst[key] = value;
});
}
});
return dst;
}
function int(str) {
return parseInt(str, 10);
}
function inherit(parent, extra) {
return extend(new (extend(function() {}, {prototype:parent}))(), extra);
}
/**
* @ngdoc function
* @name angular.noop
* @function
*
* @description
* A function that performs no operations. This function can be useful when writing code in the
* functional style.
<pre>
function foo(callback) {
var result = calculateResult();
(callback || angular.noop)(result);
}
</pre>
*/
function noop() {}
noop.$inject = [];
/**
* @ngdoc function
* @name angular.identity
* @function
*
* @description
* A function that returns its first argument. This function is useful when writing code in the
* functional style.
*
<pre>
function transformer(transformationFn, value) {
return (transformationFn || identity)(value);
};
</pre>
*/
function identity($) {return $;}
identity.$inject = [];
function valueFn(value) {return function() {return value;};}
/**
* @ngdoc function
* @name angular.isUndefined
* @function
*
* @description
* Determines if a reference is undefined.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is undefined.
*/
function isUndefined(value){return typeof value == 'undefined';}
/**
* @ngdoc function
* @name angular.isDefined
* @function
*
* @description
* Determines if a reference is defined.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is defined.
*/
function isDefined(value){return typeof value != 'undefined';}
/**
* @ngdoc function
* @name angular.isObject
* @function
*
* @description
* Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
* considered to be objects.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Object` but not `null`.
*/
function isObject(value){return value != null && typeof value == 'object';}
/**
* @ngdoc function
* @name angular.isString
* @function
*
* @description
* Determines if a reference is a `String`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `String`.
*/
function isString(value){return typeof value == 'string';}
/**
* @ngdoc function
* @name angular.isNumber
* @function
*
* @description
* Determines if a reference is a `Number`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Number`.
*/
function isNumber(value){return typeof value == 'number';}
/**
* @ngdoc function
* @name angular.isDate
* @function
*
* @description
* Determines if a value is a date.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Date`.
*/
function isDate(value){
return toString.apply(value) == '[object Date]';
}
/**
* @ngdoc function
* @name angular.isArray
* @function
*
* @description
* Determines if a reference is an `Array`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Array`.
*/
function isArray(value) {
return toString.apply(value) == '[object Array]';
}
/**
* @ngdoc function
* @name angular.isFunction
* @function
*
* @description
* Determines if a reference is a `Function`.
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Function`.
*/
function isFunction(value){return typeof value == 'function';}
/**
* Checks if `obj` is a window object.
*
* @private
* @param {*} obj Object to check
* @returns {boolean} True if `obj` is a window obj.
*/
function isWindow(obj) {
return obj && obj.document && obj.location && obj.alert && obj.setInterval;
}
function isScope(obj) {
return obj && obj.$evalAsync && obj.$watch;
}
function isFile(obj) {
return toString.apply(obj) === '[object File]';
}
function isBoolean(value) {
return typeof value == 'boolean';
}
function trim(value) {
return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
}
/**
* @ngdoc function
* @name angular.isElement
* @function
*
* @description
* Determines if a reference is a DOM element (or wrapped jQuery element).
*
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
*/
function isElement(node) {
return node &&
(node.nodeName // we are a direct element
|| (node.bind && node.find)); // we have a bind and find method part of jQuery API
}
/**
* @param str 'key1,key2,...'
* @returns {object} in the form of {key1:true, key2:true, ...}
*/
function makeMap(str){
var obj = {}, items = str.split(","), i;
for ( i = 0; i < items.length; i++ )
obj[ items[i] ] = true;
return obj;
}
if (msie < 9) {
nodeName_ = function(element) {
element = element.nodeName ? element : element[0];
return (element.scopeName && element.scopeName != 'HTML')
? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;
};
} else {
nodeName_ = function(element) {
return element.nodeName ? element.nodeName : element[0].nodeName;
};
}
function map(obj, iterator, context) {
var results = [];
forEach(obj, function(value, index, list) {
results.push(iterator.call(context, value, index, list));
});
return results;
}
/**
* @description
* Determines the number of elements in an array, the number of properties an object has, or
* the length of a string.
*
* Note: This function is used to augment the Object type in Angular expressions. See
* {@link angular.Object} for more information about Angular arrays.
*
* @param {Object|Array|string} obj Object, array, or string to inspect.
* @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object
* @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array.
*/
function size(obj, ownPropsOnly) {
var size = 0, key;
if (isArray(obj) || isString(obj)) {
return obj.length;
} else if (isObject(obj)){
for (key in obj)
if (!ownPropsOnly || obj.hasOwnProperty(key))
size++;
}
return size;
}
function includes(array, obj) {
return indexOf(array, obj) != -1;
}
function indexOf(array, obj) {
if (array.indexOf) return array.indexOf(obj);
for ( var i = 0; i < array.length; i++) {
if (obj === array[i]) return i;
}
return -1;
}
function arrayRemove(array, value) {
var index = indexOf(array, value);
if (index >=0)
array.splice(index, 1);
return value;
}
function isLeafNode (node) {
if (node) {
switch (node.nodeName) {
case "OPTION":
case "PRE":
case "TITLE":
return true;
}
}
return false;
}
/**
* @ngdoc function
* @name angular.copy
* @function
*
* @description
* Creates a deep copy of `source`, which should be an object or an array.
*
* * If no destination is supplied, a copy of the object or array is created.
* * If a destination is provided, all of its elements (for array) or properties (for objects)
* are deleted and then all elements/properties from the source are copied to it.
* * If `source` is not an object or array, `source` is returned.
*
* Note: this function is used to augment the Object type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.
*
* @param {*} source The source that will be used to make a copy.
* Can be any type, including primitives, `null`, and `undefined`.
* @param {(Object|Array)=} destination Destination into which the source is copied. If
* provided, must be of the same type as `source`.
* @returns {*} The copy or updated `destination`, if `destination` was specified.
*/
function copy(source, destination){
if (isWindow(source) || isScope(source)) throw Error("Can't copy Window or Scope");
if (!destination) {
destination = source;
if (source) {
if (isArray(source)) {
destination = copy(source, []);
} else if (isDate(source)) {
destination = new Date(source.getTime());
} else if (isObject(source)) {
destination = copy(source, {});
}
}
} else {
if (source === destination) throw Error("Can't copy equivalent objects or arrays");
if (isArray(source)) {
while(destination.length) {
destination.pop();
}
for ( var i = 0; i < source.length; i++) {
destination.push(copy(source[i]));
}
} else {
forEach(destination, function(value, key){
delete destination[key];
});
for ( var key in source) {
destination[key] = copy(source[key]);
}
}
}
return destination;
}
/**
* Create a shallow copy of an object
*/
function shallowCopy(src, dst) {
dst = dst || {};
for(var key in src) {
if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') {
dst[key] = src[key];
}
}
return dst;
}
/**
* @ngdoc function
* @name angular.equals
* @function
*
* @description
* Determines if two objects or two values are equivalent. Supports value types, arrays and
* objects.
*
* Two objects or values are considered equivalent if at least one of the following is true:
*
* * Both objects or values pass `===` comparison.
* * Both objects or values are of the same type and all of their properties pass `===` comparison.
* * Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal)
*
* During a property comparision, properties of `function` type and properties with names
* that begin with `$` are ignored.
*
* Scope and DOMWindow objects are being compared only be identify (`===`).
*
* @param {*} o1 Object or value to compare.
* @param {*} o2 Object or value to compare.
* @returns {boolean} True if arguments are equal.
*/
function equals(o1, o2) {
if (o1 === o2) return true;
if (o1 === null || o2 === null) return false;
if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
if (t1 == t2) {
if (t1 == 'object') {
if (isArray(o1)) {
if ((length = o1.length) == o2.length) {
for(key=0; key<length; key++) {
if (!equals(o1[key], o2[key])) return false;
}
return true;
}
} else if (isDate(o1)) {
return isDate(o2) && o1.getTime() == o2.getTime();
} else {
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false;
keySet = {};
for(key in o1) {
if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
if (!equals(o1[key], o2[key])) return false;
keySet[key] = true;
}
for(key in o2) {
if (!keySet[key] &&
key.charAt(0) !== '$' &&
o2[key] !== undefined &&
!isFunction(o2[key])) return false;
}
return true;
}
}
}
return false;
}
function concat(array1, array2, index) {
return array1.concat(slice.call(array2, index));
}
function sliceArgs(args, startIndex) {
return slice.call(args, startIndex || 0);
}
/**
* @ngdoc function
* @name angular.bind
* @function
*
* @description
* Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
* `fn`). You can supply optional `args` that are are prebound to the function. This feature is also
* known as [function currying](http://en.wikipedia.org/wiki/Currying).
*
* @param {Object} self Context which `fn` should be evaluated in.
* @param {function()} fn Function to be bound.
* @param {...*} args Optional arguments to be prebound to the `fn` function call.
* @returns {function()} Function that wraps the `fn` with all the specified bindings.
*/
function bind(self, fn) {
var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
if (isFunction(fn) && !(fn instanceof RegExp)) {
return curryArgs.length
? function() {
return arguments.length
? fn.apply(self, curryArgs.concat(slice.call(arguments, 0)))
: fn.apply(self, curryArgs);
}
: function() {
return arguments.length
? fn.apply(self, arguments)
: fn.call(self);
};
} else {
// in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
return fn;
}
}
function toJsonReplacer(key, value) {
var val = value;
if (/^\$+/.test(key)) {
val = undefined;
} else if (isWindow(value)) {
val = '$WINDOW';
} else if (value && document === value) {
val = '$DOCUMENT';
} else if (isScope(value)) {
val = '$SCOPE';
}
return val;
}
/**
* @ngdoc function
* @name angular.toJson
* @function
*
* @description
* Serializes input into a JSON-formatted string.
*
* @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
* @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace.
* @returns {string} Jsonified string representing `obj`.
*/
function toJson(obj, pretty) {
return JSON.stringify(obj, toJsonReplacer, pretty ? ' ' : null);
}
/**
* @ngdoc function
* @name angular.fromJson
* @function
*
* @description
* Deserializes a JSON string.
*
* @param {string} json JSON string to deserialize.
* @returns {Object|Array|Date|string|number} Deserialized thingy.
*/
function fromJson(json) {
return isString(json)
? JSON.parse(json)
: json;
}
function toBoolean(value) {
if (value && value.length !== 0) {
var v = lowercase("" + value);
value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
} else {
value = false;
}
return value;
}
/**
* @returns {string} Returns the string representation of the element.
*/
function startingTag(element) {
element = jqLite(element).clone();
try {
// turns out IE does not let you set .html() on elements which
// are not allowed to have children. So we just ignore it.
element.html('');
} catch(e) {}
return jqLite('<div>').append(element).html().
match(/^(<[^>]+>)/)[1].
replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
}
/////////////////////////////////////////////////
/**
* Parses an escaped url query string into key-value pairs.
* @returns Object.<(string|boolean)>
*/
function parseKeyValue(/**string*/keyValue) {
var obj = {}, key_value, key;
forEach((keyValue || "").split('&'), function(keyValue){
if (keyValue) {
key_value = keyValue.split('=');
key = decodeURIComponent(key_value[0]);
obj[key] = isDefined(key_value[1]) ? decodeURIComponent(key_value[1]) : true;
}
});
return obj;
}
function toKeyValue(obj) {
var parts = [];
forEach(obj, function(value, key) {
parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true)));
});
return parts.length ? parts.join('&') : '';
}
/**
* We need our custom method because encodeURIComponent is too agressive and doesn't follow
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
* segments:
* segment = *pchar
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* pct-encoded = "%" HEXDIG HEXDIG
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriSegment(val) {
return encodeUriQuery(val, true).
replace(/%26/gi, '&').
replace(/%3D/gi, '=').
replace(/%2B/gi, '+');
}
/**
* This method is intended for encoding *key* or *value* parts of query component. We need a custom
* method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be
* encoded per http://tools.ietf.org/html/rfc3986:
* query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriQuery(val, pctEncodeSpaces) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace((pctEncodeSpaces ? null : /%20/g), '+');
}
/**
* @ngdoc directive
* @name ng.directive:ngApp
*
* @element ANY
* @param {angular.Module} ngApp an optional application
* {@link angular.module module} name to load.
*
* @description
*
* Use this directive to auto-bootstrap on application. Only
* one directive can be used per HTML document. The directive
* designates the root of the application and is typically placed
* ot the root of the page.
*
* In the example below if the `ngApp` directive would not be placed
* on the `html` element then the document would not be compiled
* and the `{{ 1+2 }}` would not be resolved to `3`.
*
* `ngApp` is the easiest way to bootstrap an application.
*
<doc:example>
<doc:source>
I can add: 1 + 2 = {{ 1+2 }}
</doc:source>
</doc:example>
*
*/
function angularInit(element, bootstrap) {
var elements = [element],
appElement,
module,
names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'],
NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;
function append(element) {
element && elements.push(element);
}
forEach(names, function(name) {
names[name] = true;
append(document.getElementById(name));
name = name.replace(':', '\\:');
if (element.querySelectorAll) {
forEach(element.querySelectorAll('.' + name), append);
forEach(element.querySelectorAll('.' + name + '\\:'), append);
forEach(element.querySelectorAll('[' + name + ']'), append);
}
});
forEach(elements, function(element) {
if (!appElement) {
var className = ' ' + element.className + ' ';
var match = NG_APP_CLASS_REGEXP.exec(className);
if (match) {
appElement = element;
module = (match[2] || '').replace(/\s+/g, ',');
} else {
forEach(element.attributes, function(attr) {
if (!appElement && names[attr.name]) {
appElement = element;
module = attr.value;
}
});
}
}
});
if (appElement) {
bootstrap(appElement, module ? [module] : []);
}
}
/**
* @ngdoc function
* @name angular.bootstrap
* @description
* Use this function to manually start up angular application.
*
* See: {@link guide/bootstrap Bootstrap}
*
* @param {Element} element DOM element which is the root of angular application.
* @param {Array<String|Function>=} modules an array of module declarations. See: {@link angular.module modules}
* @returns {AUTO.$injector} Returns the newly created injector for this app.
*/
function bootstrap(element, modules) {
element = jqLite(element);
modules = modules || [];
modules.unshift(['$provide', function($provide) {
$provide.value('$rootElement', element);
}]);
modules.unshift('ng');
var injector = createInjector(modules);
injector.invoke(
['$rootScope', '$rootElement', '$compile', '$injector', function(scope, element, compile, injector){
scope.$apply(function() {
element.data('$injector', injector);
compile(element)(scope);
});
}]
);
return injector;
}
var SNAKE_CASE_REGEXP = /[A-Z]/g;
function snake_case(name, separator){
separator = separator || '_';
return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
return (pos ? separator : '') + letter.toLowerCase();
});
}
function bindJQuery() {
// bind to jQuery if present;
jQuery = window.jQuery;
// reset to jQuery or default to us.
if (jQuery) {
jqLite = jQuery;
extend(jQuery.fn, {
scope: JQLitePrototype.scope,
controller: JQLitePrototype.controller,
injector: JQLitePrototype.injector,
inheritedData: JQLitePrototype.inheritedData
});
JQLitePatchJQueryRemove('remove', true);
JQLitePatchJQueryRemove('empty');
JQLitePatchJQueryRemove('html');
} else {
jqLite = JQLite;
}
angular.element = jqLite;
}
/**
* throw error of the argument is falsy.
*/
function assertArg(arg, name, reason) {
if (!arg) {
throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required"));
}
return arg;
}
function assertArgFn(arg, name, acceptArrayAnnotation) {
if (acceptArrayAnnotation && isArray(arg)) {
arg = arg[arg.length - 1];
}
assertArg(isFunction(arg), name, 'not a function, got ' +
(arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg));
return arg;
}
/**
* @ngdoc interface
* @name angular.Module
* @description
*
* Interface for configuring angular {@link angular.module modules}.
*/
function setupModuleLoader(window) {
function ensure(obj, name, factory) {
return obj[name] || (obj[name] = factory());
}
return ensure(ensure(window, 'angular', Object), 'module', function() {
/** @type {Object.<string, angular.Module>} */
var modules = {};
/**
* @ngdoc function
* @name angular.module
* @description
*
* The `angular.module` is a global place for creating and registering Angular modules. All
* modules (angular core or 3rd party) that should be available to an application must be
* registered using this mechanism.
*
*
* # Module
*
* A module is a collocation of services, directives, filters, and configuration information. Module
* is used to configure the {@link AUTO.$injector $injector}.
*
* <pre>
* // Create a new module
* var myModule = angular.module('myModule', []);
*
* // register a new service
* myModule.value('appName', 'MyCoolApp');
*
* // configure existing services inside initialization blocks.
* myModule.config(function($locationProvider) {
* // Configure existing providers
* $locationProvider.hashPrefix('!');
* });
* </pre>
*
* Then you can create an injector and load your modules like this:
*
* <pre>
* var injector = angular.injector(['ng', 'MyModule'])
* </pre>
*
* However it's more likely that you'll just use
* {@link ng.directive:ngApp ngApp} or
* {@link angular.bootstrap} to simplify this process for you.
*
* @param {!string} name The name of the module to create or retrieve.
* @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the
* the module is being retrieved for further configuration.
* @param {Function} configFn Optional configuration function for the module. Same as
* {@link angular.Module#config Module#config()}.
* @returns {module} new module with the {@link angular.Module} api.
*/
return function module(name, requires, configFn) {
if (requires && modules.hasOwnProperty(name)) {
modules[name] = null;
}
return ensure(modules, name, function() {
if (!requires) {
throw Error('No module: ' + name);
}
/** @type {!Array.<Array.<*>>} */
var invokeQueue = [];
/** @type {!Array.<Function>} */
var runBlocks = [];
var config = invokeLater('$injector', 'invoke');
/** @type {angular.Module} */
var moduleInstance = {
// Private state
_invokeQueue: invokeQueue,
_runBlocks: runBlocks,
/**
* @ngdoc property
* @name angular.Module#requires
* @propertyOf angular.Module
* @returns {Array.<string>} List of module names which must be loaded before this module.
* @description
* Holds the list of modules which the injector will load before the current module is loaded.
*/
requires: requires,
/**
* @ngdoc property
* @name angular.Module#name
* @propertyOf angular.Module
* @returns {string} Name of the module.
* @description
*/
name: name,
/**
* @ngdoc method
* @name angular.Module#provider
* @methodOf angular.Module
* @param {string} name service name
* @param {Function} providerType Construction function for creating new instance of the service.
* @description
* See {@link AUTO.$provide#provider $provide.provider()}.
*/
provider: invokeLater('$provide', 'provider'),
/**
* @ngdoc method
* @name angular.Module#factory
* @methodOf angular.Module
* @param {string} name service name
* @param {Function} providerFunction Function for creating new instance of the service.
* @description
* See {@link AUTO.$provide#factory $provide.factory()}.
*/
factory: invokeLater('$provide', 'factory'),
/**
* @ngdoc method
* @name angular.Module#service
* @methodOf angular.Module
* @param {string} name service name
* @param {Function} constructor A constructor function that will be instantiated.
* @description
* See {@link AUTO.$provide#service $provide.service()}.
*/
service: invokeLater('$provide', 'service'),
/**
* @ngdoc method
* @name angular.Module#value
* @methodOf angular.Module
* @param {string} name service name
* @param {*} object Service instance object.
* @description
* See {@link AUTO.$provide#value $provide.value()}.
*/
value: invokeLater('$provide', 'value'),
/**
* @ngdoc method
* @name angular.Module#constant
* @methodOf angular.Module
* @param {string} name constant name
* @param {*} object Constant value.
* @description
* Because the constant are fixed, they get applied before other provide methods.
* See {@link AUTO.$provide#constant $provide.constant()}.
*/
constant: invokeLater('$provide', 'constant', 'unshift'),
/**
* @ngdoc method
* @name angular.Module#filter
* @methodOf angular.Module
* @param {string} name Filter name.
* @param {Function} filterFactory Factory function for creating new instance of filter.
* @description
* See {@link ng.$filterProvider#register $filterProvider.register()}.
*/
filter: invokeLater('$filterProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#controller
* @methodOf angular.Module
* @param {string} name Controller name.
* @param {Function} constructor Controller constructor function.
* @description
* See {@link ng.$controllerProvider#register $controllerProvider.register()}.
*/
controller: invokeLater('$controllerProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#directive
* @methodOf angular.Module
* @param {string} name directive name
* @param {Function} directiveFactory Factory function for creating new instance of
* directives.
* @description
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
*/
directive: invokeLater('$compileProvider', 'directive'),
/**
* @ngdoc method
* @name angular.Module#config
* @methodOf angular.Module
* @param {Function} configFn Execute this function on module load. Useful for service
* configuration.
* @description
* Use this method to register work which needs to be performed on module loading.
*/
config: config,
/**
* @ngdoc method
* @name angular.Module#run
* @methodOf angular.Module
* @param {Function} initializationFn Execute this function after injector creation.
* Useful for application initialization.
* @description
* Use this method to register work which should be performed when the injector is done
* loading all modules.
*/
run: function(block) {
runBlocks.push(block);
return this;
}
};
if (configFn) {
config(configFn);
}
return moduleInstance;
/**
* @param {string} provider
* @param {string} method
* @param {String=} insertMethod
* @returns {angular.Module}
*/
function invokeLater(provider, method, insertMethod) {
return function() {
invokeQueue[insertMethod || 'push']([provider, method, arguments]);
return moduleInstance;
}
}
});
};
});
}
/**
* @ngdoc property
* @name angular.version
* @description
* An object that contains information about the current AngularJS version. This object has the
* following properties:
*
* - `full` – `{string}` – Full version string, such as "0.9.18".
* - `major` – `{number}` – Major version number, such as "0".
* - `minor` – `{number}` – Minor version number, such as "9".
* - `dot` – `{number}` – Dot version number, such as "18".
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/
var version = {
full: '1.0.4', // all of these placeholder strings will be replaced by rake's
major: 1, // compile task
minor: 0,
dot: 4,
codeName: 'bewildering-hair'
};
function publishExternalAPI(angular){
extend(angular, {
'bootstrap': bootstrap,
'copy': copy,
'extend': extend,
'equals': equals,
'element': jqLite,
'forEach': forEach,
'injector': createInjector,
'noop':noop,
'bind':bind,
'toJson': toJson,
'fromJson': fromJson,
'identity':identity,
'isUndefined': isUndefined,
'isDefined': isDefined,
'isString': isString,
'isFunction': isFunction,
'isObject': isObject,
'isNumber': isNumber,
'isElement': isElement,
'isArray': isArray,
'version': version,
'isDate': isDate,
'lowercase': lowercase,
'uppercase': uppercase,
'callbacks': {counter: 0}
});
angularModule = setupModuleLoader(window);
try {
angularModule('ngLocale');
} catch (e) {
angularModule('ngLocale', []).provider('$locale', $LocaleProvider);
}
angularModule('ng', ['ngLocale'], ['$provide',
function ngModule($provide) {
$provide.provider('$compile', $CompileProvider).
directive({
a: htmlAnchorDirective,
input: inputDirective,
textarea: inputDirective,
form: formDirective,
script: scriptDirective,
select: selectDirective,
style: styleDirective,
option: optionDirective,
ngBind: ngBindDirective,
ngBindHtmlUnsafe: ngBindHtmlUnsafeDirective,
ngBindTemplate: ngBindTemplateDirective,
ngClass: ngClassDirective,
ngClassEven: ngClassEvenDirective,
ngClassOdd: ngClassOddDirective,
ngCsp: ngCspDirective,
ngCloak: ngCloakDirective,
ngController: ngControllerDirective,
ngForm: ngFormDirective,
ngHide: ngHideDirective,
ngInclude: ngIncludeDirective,
ngInit: ngInitDirective,
ngNonBindable: ngNonBindableDirective,
ngPluralize: ngPluralizeDirective,
ngRepeat: ngRepeatDirective,
ngShow: ngShowDirective,
ngSubmit: ngSubmitDirective,
ngStyle: ngStyleDirective,
ngSwitch: ngSwitchDirective,
ngSwitchWhen: ngSwitchWhenDirective,
ngSwitchDefault: ngSwitchDefaultDirective,
ngOptions: ngOptionsDirective,
ngView: ngViewDirective,
ngTransclude: ngTranscludeDirective,
ngModel: ngModelDirective,
ngList: ngListDirective,
ngChange: ngChangeDirective,
required: requiredDirective,
ngRequired: requiredDirective,
ngValue: ngValueDirective
}).
directive(ngAttributeAliasDirectives).
directive(ngEventDirectives);
$provide.provider({
$anchorScroll: $AnchorScrollProvider,
$browser: $BrowserProvider,
$cacheFactory: $CacheFactoryProvider,
$controller: $ControllerProvider,
$document: $DocumentProvider,
$exceptionHandler: $ExceptionHandlerProvider,
$filter: $FilterProvider,
$interpolate: $InterpolateProvider,
$http: $HttpProvider,
$httpBackend: $HttpBackendProvider,
$location: $LocationProvider,
$log: $LogProvider,
$parse: $ParseProvider,
$route: $RouteProvider,
$routeParams: $RouteParamsProvider,
$rootScope: $RootScopeProvider,
$q: $QProvider,
$sniffer: $SnifferProvider,
$templateCache: $TemplateCacheProvider,
$timeout: $TimeoutProvider,
$window: $WindowProvider
});
}
]);
}
//////////////////////////////////
//JQLite
//////////////////////////////////
/**
* @ngdoc function
* @name angular.element
* @function
*
* @description
* Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
* `angular.element` can be either an alias for [jQuery](http://api.jquery.com/jQuery/) function, if
* jQuery is available, or a function that wraps the element or string in Angular's jQuery lite
* implementation (commonly referred to as jqLite).
*
* Real jQuery always takes precedence over jqLite, provided it was loaded before `DOMContentLoaded`
* event fired.
*
* jqLite is a tiny, API-compatible subset of jQuery that allows
* Angular to manipulate the DOM. jqLite implements only the most commonly needed functionality
* within a very small footprint, so only a subset of the jQuery API - methods, arguments and
* invocation styles - are supported.
*
* Note: All element references in Angular are always wrapped with jQuery or jqLite; they are never
* raw DOM references.
*
* ## Angular's jQuery lite provides the following methods:
*
* - [addClass()](http://api.jquery.com/addClass/)
* - [after()](http://api.jquery.com/after/)
* - [append()](http://api.jquery.com/append/)
* - [attr()](http://api.jquery.com/attr/)
* - [bind()](http://api.jquery.com/bind/)
* - [children()](http://api.jquery.com/children/)
* - [clone()](http://api.jquery.com/clone/)
* - [contents()](http://api.jquery.com/contents/)
* - [css()](http://api.jquery.com/css/)
* - [data()](http://api.jquery.com/data/)
* - [eq()](http://api.jquery.com/eq/)
* - [find()](http://api.jquery.com/find/) - Limited to lookups by tag name.
* - [hasClass()](http://api.jquery.com/hasClass/)
* - [html()](http://api.jquery.com/html/)
* - [next()](http://api.jquery.com/next/)
* - [parent()](http://api.jquery.com/parent/)
* - [prepend()](http://api.jquery.com/prepend/)
* - [prop()](http://api.jquery.com/prop/)
* - [ready()](http://api.jquery.com/ready/)
* - [remove()](http://api.jquery.com/remove/)
* - [removeAttr()](http://api.jquery.com/removeAttr/)
* - [removeClass()](http://api.jquery.com/removeClass/)
* - [removeData()](http://api.jquery.com/removeData/)
* - [replaceWith()](http://api.jquery.com/replaceWith/)
* - [text()](http://api.jquery.com/text/)
* - [toggleClass()](http://api.jquery.com/toggleClass/)
* - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Doesn't pass native event objects to handlers.
* - [unbind()](http://api.jquery.com/unbind/)
* - [val()](http://api.jquery.com/val/)
* - [wrap()](http://api.jquery.com/wrap/)
*
* ## In addtion to the above, Angular provides additional methods to both jQuery and jQuery lite:
*
* - `controller(name)` - retrieves the controller of the current element or its parent. By default
* retrieves controller associated with the `ngController` directive. If `name` is provided as
* camelCase directive name, then the controller for this directive will be retrieved (e.g.
* `'ngModel'`).
* - `injector()` - retrieves the injector of the current element or its parent.
* - `scope()` - retrieves the {@link api/ng.$rootScope.Scope scope} of the current
* element or its parent.
* - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
* parent element is reached.
*
* @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
* @returns {Object} jQuery object.
*/
var jqCache = JQLite.cache = {},
jqName = JQLite.expando = 'ng-' + new Date().getTime(),
jqId = 1,
addEventListenerFn = (window.document.addEventListener
? function(element, type, fn) {element.addEventListener(type, fn, false);}
: function(element, type, fn) {element.attachEvent('on' + type, fn);}),
removeEventListenerFn = (window.document.removeEventListener
? function(element, type, fn) {element.removeEventListener(type, fn, false); }
: function(element, type, fn) {element.detachEvent('on' + type, fn); });
function jqNextId() { return ++jqId; }
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
/**
* Converts snake_case to camelCase.
* Also there is special case for Moz prefix starting with upper case letter.
* @param name Name to normalize
*/
function camelCase(name) {
return name.
replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).
replace(MOZ_HACK_REGEXP, 'Moz$1');
}
/////////////////////////////////////////////
// jQuery mutation patch
//
// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a
// $destroy event on all DOM nodes being removed.
//
/////////////////////////////////////////////
function JQLitePatchJQueryRemove(name, dispatchThis) {
var originalJqFn = jQuery.fn[name];
originalJqFn = originalJqFn.$original || originalJqFn;
removePatch.$original = originalJqFn;
jQuery.fn[name] = removePatch;
function removePatch() {
var list = [this],
fireEvent = dispatchThis,
set, setIndex, setLength,
element, childIndex, childLength, children,
fns, events;
while(list.length) {
set = list.shift();
for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {
element = jqLite(set[setIndex]);
if (fireEvent) {
element.triggerHandler('$destroy');
} else {
fireEvent = !fireEvent;
}
for(childIndex = 0, childLength = (children = element.children()).length;
childIndex < childLength;
childIndex++) {
list.push(jQuery(children[childIndex]));
}
}
}
return originalJqFn.apply(this, arguments);
}
}
/////////////////////////////////////////////
function JQLite(element) {
if (element instanceof JQLite) {
return element;
}
if (!(this instanceof JQLite)) {
if (isString(element) && element.charAt(0) != '<') {
throw Error('selectors not implemented');
}
return new JQLite(element);
}
if (isString(element)) {
var div = document.createElement('div');
// Read about the NoScope elements here:
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
div.innerHTML = '<div> </div>' + element; // IE insanity to make NoScope elements work!
div.removeChild(div.firstChild); // remove the superfluous div
JQLiteAddNodes(this, div.childNodes);
this.remove(); // detach the elements from the temporary DOM div.
} else {
JQLiteAddNodes(this, element);
}
}
function JQLiteClone(element) {
return element.cloneNode(true);
}
function JQLiteDealoc(element){
JQLiteRemoveData(element);
for ( var i = 0, children = element.childNodes || []; i < children.length; i++) {
JQLiteDealoc(children[i]);
}
}
function JQLiteUnbind(element, type, fn) {
var events = JQLiteExpandoStore(element, 'events'),
handle = JQLiteExpandoStore(element, 'handle');
if (!handle) return; //no listeners registered
if (isUndefined(type)) {
forEach(events, function(eventHandler, type) {
removeEventListenerFn(element, type, eventHandler);
delete events[type];
});
} else {
if (isUndefined(fn)) {
removeEventListenerFn(element, type, events[type]);
delete events[type];
} else {
arrayRemove(events[type], fn);
}
}
}
function JQLiteRemoveData(element) {
var expandoId = element[jqName],
expandoStore = jqCache[expandoId];
if (expandoStore) {
if (expandoStore.handle) {
expandoStore.events.$destroy && expandoStore.handle({}, '$destroy');
JQLiteUnbind(element);
}
delete jqCache[expandoId];
element[jqName] = undefined; // ie does not allow deletion of attributes on elements.
}
}
function JQLiteExpandoStore(element, key, value) {
var expandoId = element[jqName],
expandoStore = jqCache[expandoId || -1];
if (isDefined(value)) {
if (!expandoStore) {
element[jqName] = expandoId = jqNextId();
expandoStore = jqCache[expandoId] = {};
}
expandoStore[key] = value;
} else {
return expandoStore && expandoStore[key];
}
}
function JQLiteData(element, key, value) {
var data = JQLiteExpandoStore(element, 'data'),
isSetter = isDefined(value),
keyDefined = !isSetter && isDefined(key),
isSimpleGetter = keyDefined && !isObject(key);
if (!data && !isSimpleGetter) {
JQLiteExpandoStore(element, 'data', data = {});
}
if (isSetter) {
data[key] = value;
} else {
if (keyDefined) {
if (isSimpleGetter) {
// don't create data in this case.
return data && data[key];
} else {
extend(data, key);
}
} else {
return data;
}
}
}
function JQLiteHasClass(element, selector) {
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").
indexOf( " " + selector + " " ) > -1);
}
function JQLiteRemoveClass(element, cssClasses) {
if (cssClasses) {
forEach(cssClasses.split(' '), function(cssClass) {
element.className = trim(
(" " + element.className + " ")
.replace(/[\n\t]/g, " ")
.replace(" " + trim(cssClass) + " ", " ")
);
});
}
}
function JQLiteAddClass(element, cssClasses) {
if (cssClasses) {
forEach(cssClasses.split(' '), function(cssClass) {
if (!JQLiteHasClass(element, cssClass)) {
element.className = trim(element.className + ' ' + trim(cssClass));
}
});
}
}
function JQLiteAddNodes(root, elements) {
if (elements) {
elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements))
? elements
: [ elements ];
for(var i=0; i < elements.length; i++) {
root.push(elements[i]);
}
}
}
function JQLiteController(element, name) {
return JQLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller');
}
function JQLiteInheritedData(element, name, value) {
element = jqLite(element);
// if element is the document object work with the html element instead
// this makes $(document).scope() possible
if(element[0].nodeType == 9) {
element = element.find('html');
}
while (element.length) {
if (value = element.data(name)) return value;
element = element.parent();
}
}
//////////////////////////////////////////
// Functions which are declared directly.
//////////////////////////////////////////
var JQLitePrototype = JQLite.prototype = {
ready: function(fn) {
var fired = false;
function trigger() {
if (fired) return;
fired = true;
fn();
}
this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9
// we can not use jqLite since we are not done loading and jQuery could be loaded later.
JQLite(window).bind('load', trigger); // fallback to window.onload for others
},
toString: function() {
var value = [];
forEach(this, function(e){ value.push('' + e);});
return '[' + value.join(', ') + ']';
},
eq: function(index) {
return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
},
length: 0,
push: push,
sort: [].sort,
splice: [].splice
};
//////////////////////////////////////////
// Functions iterating getter/setters.
// these functions return self on setter and
// value on get.
//////////////////////////////////////////
var BOOLEAN_ATTR = {};
forEach('multiple,selected,checked,disabled,readOnly,required'.split(','), function(value) {
BOOLEAN_ATTR[lowercase(value)] = value;
});
var BOOLEAN_ELEMENTS = {};
forEach('input,select,option,textarea,button,form'.split(','), function(value) {
BOOLEAN_ELEMENTS[uppercase(value)] = true;
});
function getBooleanAttrName(element, name) {
// check dom last since we will most likely fail on name
var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
// booleanAttr is here twice to minimize DOM access
return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;
}
forEach({
data: JQLiteData,
inheritedData: JQLiteInheritedData,
scope: function(element) {
return JQLiteInheritedData(element, '$scope');
},
controller: JQLiteController ,
injector: function(element) {
return JQLiteInheritedData(element, '$injector');
},
removeAttr: function(element,name) {
element.removeAttribute(name);
},
hasClass: JQLiteHasClass,
css: function(element, name, value) {
name = camelCase(name);
if (isDefined(value)) {
element.style[name] = value;
} else {
var val;
if (msie <= 8) {
// this is some IE specific weirdness that jQuery 1.6.4 does not sure why
val = element.currentStyle && element.currentStyle[name];
if (val === '') val = 'auto';
}
val = val || element.style[name];
if (msie <= 8) {
// jquery weirdness :-/
val = (val === '') ? undefined : val;
}
return val;
}
},
attr: function(element, name, value){
var lowercasedName = lowercase(name);
if (BOOLEAN_ATTR[lowercasedName]) {
if (isDefined(value)) {
if (!!value) {
element[name] = true;
element.setAttribute(name, lowercasedName);
} else {
element[name] = false;
element.removeAttribute(lowercasedName);
}
} else {
return (element[name] ||
(element.attributes.getNamedItem(name)|| noop).specified)
? lowercasedName
: undefined;
}
} else if (isDefined(value)) {
element.setAttribute(name, value);
} else if (element.getAttribute) {
// the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
// some elements (e.g. Document) don't have get attribute, so return undefined
var ret = element.getAttribute(name, 2);
// normalize non-existing attributes to undefined (as jQuery)
return ret === null ? undefined : ret;
}
},
prop: function(element, name, value) {
if (isDefined(value)) {
element[name] = value;
} else {
return element[name];
}
},
text: extend((msie < 9)
? function(element, value) {
if (element.nodeType == 1 /** Element */) {
if (isUndefined(value))
return element.innerText;
element.innerText = value;
} else {
if (isUndefined(value))
return element.nodeValue;
element.nodeValue = value;
}
}
: function(element, value) {
if (isUndefined(value)) {
return element.textContent;
}
element.textContent = value;
}, {$dv:''}),
val: function(element, value) {
if (isUndefined(value)) {
return element.value;
}
element.value = value;
},
html: function(element, value) {
if (isUndefined(value)) {
return element.innerHTML;
}
for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
JQLiteDealoc(childNodes[i]);
}
element.innerHTML = value;
}
}, function(fn, name){
/**
* Properties: writes return selection, reads return first value
*/
JQLite.prototype[name] = function(arg1, arg2) {
var i, key;
// JQLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
// in a way that survives minification.
if (((fn.length == 2 && (fn !== JQLiteHasClass && fn !== JQLiteController)) ? arg1 : arg2) === undefined) {
if (isObject(arg1)) {
// we are a write, but the object properties are the key/values
for(i=0; i < this.length; i++) {
if (fn === JQLiteData) {
// data() takes the whole object in jQuery
fn(this[i], arg1);
} else {
for (key in arg1) {
fn(this[i], key, arg1[key]);
}
}
}
// return self for chaining
return this;
} else {
// we are a read, so read the first child.
if (this.length)
return fn(this[0], arg1, arg2);
}
} else {
// we are a write, so apply to all children
for(i=0; i < this.length; i++) {
fn(this[i], arg1, arg2);
}
// return self for chaining
return this;
}
return fn.$dv;
};
});
function createEventHandler(element, events) {
var eventHandler = function (event, type) {
if (!event.preventDefault) {
event.preventDefault = function() {
event.returnValue = false; //ie
};
}
if (!event.stopPropagation) {
event.stopPropagation = function() {
event.cancelBubble = true; //ie
};
}
if (!event.target) {
event.target = event.srcElement || document;
}
if (isUndefined(event.defaultPrevented)) {
var prevent = event.preventDefault;
event.preventDefault = function() {
event.defaultPrevented = true;
prevent.call(event);
};
event.defaultPrevented = false;
}
event.isDefaultPrevented = function() {
return event.defaultPrevented;
};
forEach(events[type || event.type], function(fn) {
fn.call(element, event);
});
// Remove monkey-patched methods (IE),
// as they would cause memory leaks in IE8.
if (msie <= 8) {
// IE7/8 does not allow to delete property on native object
event.preventDefault = null;
event.stopPropagation = null;
event.isDefaultPrevented = null;
} else {
// It shouldn't affect normal browsers (native methods are defined on prototype).
delete event.preventDefault;
delete event.stopPropagation;
delete event.isDefaultPrevented;
}
};
eventHandler.elem = element;
return eventHandler;
}
//////////////////////////////////////////
// Functions iterating traversal.
// These functions chain results into a single
// selector.
//////////////////////////////////////////
forEach({
removeData: JQLiteRemoveData,
dealoc: JQLiteDealoc,
bind: function bindFn(element, type, fn){
var events = JQLiteExpandoStore(element, 'events'),
handle = JQLiteExpandoStore(element, 'handle');
if (!events) JQLiteExpandoStore(element, 'events', events = {});
if (!handle) JQLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));
forEach(type.split(' '), function(type){
var eventFns = events[type];
if (!eventFns) {
if (type == 'mouseenter' || type == 'mouseleave') {
var counter = 0;
events.mouseenter = [];
events.mouseleave = [];
bindFn(element, 'mouseover', function(event) {
counter++;
if (counter == 1) {
handle(event, 'mouseenter');
}
});
bindFn(element, 'mouseout', function(event) {
counter --;
if (counter == 0) {
handle(event, 'mouseleave');
}
});
} else {
addEventListenerFn(element, type, handle);
events[type] = [];
}
eventFns = events[type]
}
eventFns.push(fn);
});
},
unbind: JQLiteUnbind,
replaceWith: function(element, replaceNode) {
var index, parent = element.parentNode;
JQLiteDealoc(element);
forEach(new JQLite(replaceNode), function(node){
if (index) {
parent.insertBefore(node, index.nextSibling);
} else {
parent.replaceChild(node, element);
}
index = node;
});
},
children: function(element) {
var children = [];
forEach(element.childNodes, function(element){
if (element.nodeType === 1)
children.push(element);
});
return children;
},
contents: function(element) {
return element.childNodes || [];
},
append: function(element, node) {
forEach(new JQLite(node), function(child){
if (element.nodeType === 1)
element.appendChild(child);
});
},
prepend: function(element, node) {
if (element.nodeType === 1) {
var index = element.firstChild;
forEach(new JQLite(node), function(child){
if (index) {
element.insertBefore(child, index);
} else {
element.appendChild(child);
index = child;
}
});
}
},
wrap: function(element, wrapNode) {
wrapNode = jqLite(wrapNode)[0];
var parent = element.parentNode;
if (parent) {
parent.replaceChild(wrapNode, element);
}
wrapNode.appendChild(element);
},
remove: function(element) {
JQLiteDealoc(element);
var parent = element.parentNode;
if (parent) parent.removeChild(element);
},
after: function(element, newElement) {
var index = element, parent = element.parentNode;
forEach(new JQLite(newElement), function(node){
parent.insertBefore(node, index.nextSibling);
index = node;
});
},
addClass: JQLiteAddClass,
removeClass: JQLiteRemoveClass,
toggleClass: function(element, selector, condition) {
if (isUndefined(condition)) {
condition = !JQLiteHasClass(element, selector);
}
(condition ? JQLiteAddClass : JQLiteRemoveClass)(element, selector);
},
parent: function(element) {
var parent = element.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
next: function(element) {
if (element.nextElementSibling) {
return element.nextElementSibling;
}
// IE8 doesn't have nextElementSibling
var elm = element.nextSibling;
while (elm != null && elm.nodeType !== 1) {
elm = elm.nextSibling;
}
return elm;
},
find: function(element, selector) {
return element.getElementsByTagName(selector);
},
clone: JQLiteClone,
triggerHandler: function(element, eventName) {
var eventFns = (JQLiteExpandoStore(element, 'events') || {})[eventName];
forEach(eventFns, function(fn) {
fn.call(element, null);
});
}
}, function(fn, name){
/**
* chaining functions
*/
JQLite.prototype[name] = function(arg1, arg2) {
var value;
for(var i=0; i < this.length; i++) {
if (value == undefined) {
value = fn(this[i], arg1, arg2);
if (value !== undefined) {
// any function which returns a value needs to be wrapped
value = jqLite(value);
}
} else {
JQLiteAddNodes(value, fn(this[i], arg1, arg2));
}
}
return value == undefined ? this : value;
};
});
/**
* Computes a hash of an 'obj'.
* Hash of a:
* string is string
* number is number as string
* object is either result of calling $$hashKey function on the object or uniquely generated id,
* that is also assigned to the $$hashKey property of the object.
*
* @param obj
* @returns {string} hash string such that the same input will have the same hash string.
* The resulting string key is in 'type:hashKey' format.
*/
function hashKey(obj) {
var objType = typeof obj,
key;
if (objType == 'object' && obj !== null) {
if (typeof (key = obj.$$hashKey) == 'function') {
// must invoke on object to keep the right this
key = obj.$$hashKey();
} else if (key === undefined) {
key = obj.$$hashKey = nextUid();
}
} else {
key = obj;
}
return objType + ':' + key;
}
/**
* HashMap which can use objects as keys
*/
function HashMap(array){
forEach(array, this.put, this);
}
HashMap.prototype = {
/**
* Store key value pair
* @param key key to store can be any type
* @param value value to store can be any type
*/
put: function(key, value) {
this[hashKey(key)] = value;
},
/**
* @param key
* @returns the value for the key
*/
get: function(key) {
return this[hashKey(key)];
},
/**
* Remove the key/value pair
* @param key
*/
remove: function(key) {
var value = this[key = hashKey(key)];
delete this[key];
return value;
}
};
/**
* A map where multiple values can be added to the same key such that they form a queue.
* @returns {HashQueueMap}
*/
function HashQueueMap() {}
HashQueueMap.prototype = {
/**
* Same as array push, but using an array as the value for the hash
*/
push: function(key, value) {
var array = this[key = hashKey(key)];
if (!array) {
this[key] = [value];
} else {
array.push(value);
}
},
/**
* Same as array shift, but using an array as the value for the hash
*/
shift: function(key) {
var array = this[key = hashKey(key)];
if (array) {
if (array.length == 1) {
delete this[key];
return array[0];
} else {
return array.shift();
}
}
},
/**
* return the first item without deleting it
*/
peek: function(key) {
var array = this[hashKey(key)];
if (array) {
return array[0];
}
}
};
/**
* @ngdoc function
* @name angular.injector
* @function
*
* @description
* Creates an injector function that can be used for retrieving services as well as for
* dependency injection (see {@link guide/di dependency injection}).
*
* @param {Array.<string|Function>} modules A list of module functions or their aliases. See
* {@link angular.module}. The `ng` module must be explicitly added.
* @returns {function()} Injector function. See {@link AUTO.$injector $injector}.
*
* @example
* Typical usage
* <pre>
* // create an injector
* var $injector = angular.injector(['ng']);
*
* // use the injector to kick off your application
* // use the type inference to auto inject arguments, or use implicit injection
* $injector.invoke(function($rootScope, $compile, $document){
* $compile($document)($rootScope);
* $rootScope.$digest();
* });
* </pre>
*/
/**
* @ngdoc overview
* @name AUTO
* @description
*
* Implicit module which gets automatically added to each {@link AUTO.$injector $injector}.
*/
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
function annotate(fn) {
var $inject,
fnText,
argDecl,
last;
if (typeof fn == 'function') {
if (!($inject = fn.$inject)) {
$inject = [];
fnText = fn.toString().replace(STRIP_COMMENTS, '');
argDecl = fnText.match(FN_ARGS);
forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
arg.replace(FN_ARG, function(all, underscore, name){
$inject.push(name);
});
});
fn.$inject = $inject;
}
} else if (isArray(fn)) {
last = fn.length - 1;
assertArgFn(fn[last], 'fn')
$inject = fn.slice(0, last);
} else {
assertArgFn(fn, 'fn', true);
}
return $inject;
}
///////////////////////////////////////
/**
* @ngdoc object
* @name AUTO.$injector
* @function
*
* @description
*
* `$injector` is used to retrieve object instances as defined by
* {@link AUTO.$provide provider}, instantiate types, invoke methods,
* and load modules.
*
* The following always holds true:
*
* <pre>
* var $injector = angular.injector();
* expect($injector.get('$injector')).toBe($injector);
* expect($injector.invoke(function($injector){
* return $injector;
* }).toBe($injector);
* </pre>
*
* # Injection Function Annotation
*
* JavaScript does not have annotations, and annotations are needed for dependency injection. The
* following ways are all valid way of annotating function with injection arguments and are equivalent.
*
* <pre>
* // inferred (only works if code not minified/obfuscated)
* $inject.invoke(function(serviceA){});
*
* // annotated
* function explicit(serviceA) {};
* explicit.$inject = ['serviceA'];
* $inject.invoke(explicit);
*
* // inline
* $inject.invoke(['serviceA', function(serviceA){}]);
* </pre>
*
* ## Inference
*
* In JavaScript calling `toString()` on a function returns the function definition. The definition can then be
* parsed and the function arguments can be extracted. *NOTE:* This does not work with minification, and obfuscation
* tools since these tools change the argument names.
*
* ## `$inject` Annotation
* By adding a `$inject` property onto a function the injection parameters can be specified.
*
* ## Inline
* As an array of injection names, where the last item in the array is the function to call.
*/
/**
* @ngdoc method
* @name AUTO.$injector#get
* @methodOf AUTO.$injector
*
* @description
* Return an instance of the service.
*
* @param {string} name The name of the instance to retrieve.
* @return {*} The instance.
*/
/**
* @ngdoc method
* @name AUTO.$injector#invoke
* @methodOf AUTO.$injector
*
* @description
* Invoke the method and supply the method arguments from the `$injector`.
*
* @param {!function} fn The function to invoke. The function arguments come form the function annotation.
* @param {Object=} self The `this` for the invoked method.
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
* the `$injector` is consulted.
* @returns {*} the value returned by the invoked `fn` function.
*/
/**
* @ngdoc method
* @name AUTO.$injector#instantiate
* @methodOf AUTO.$injector
* @description
* Create a new instance of JS type. The method takes a constructor function invokes the new operator and supplies
* all of the arguments to the constructor function as specified by the constructor annotation.
*
* @param {function} Type Annotated constructor function.
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
* the `$injector` is consulted.
* @returns {Object} new instance of `Type`.
*/
/**
* @ngdoc method
* @name AUTO.$injector#annotate
* @methodOf AUTO.$injector
*
* @description
* Returns an array of service names which the function is requesting for injection. This API is used by the injector
* to determine which services need to be injected into the function when the function is invoked. There are three
* ways in which the function can be annotated with the needed dependencies.
*
* # Argument names
*
* The simplest form is to extract the dependencies from the arguments of the function. This is done by converting
* the function into a string using `toString()` method and extracting the argument names.
* <pre>
* // Given
* function MyController($scope, $route) {
* // ...
* }
*
* // Then
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
* </pre>
*
* This method does not work with code minfication / obfuscation. For this reason the following annotation strategies
* are supported.
*
* # The `$injector` property
*
* If a function has an `$inject` property and its value is an array of strings, then the strings represent names of
* services to be injected into the function.
* <pre>
* // Given
* var MyController = function(obfuscatedScope, obfuscatedRoute) {
* // ...
* }
* // Define function dependencies
* MyController.$inject = ['$scope', '$route'];
*
* // Then
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
* </pre>
*
* # The array notation
*
* It is often desirable to inline Injected functions and that's when setting the `$inject` property is very
* inconvenient. In these situations using the array notation to specify the dependencies in a way that survives
* minification is a better choice:
*
* <pre>
* // We wish to write this (not minification / obfuscation safe)
* injector.invoke(function($compile, $rootScope) {
* // ...
* });
*
* // We are forced to write break inlining
* var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
* // ...
* };
* tmpFn.$inject = ['$compile', '$rootScope'];
* injector.invoke(tempFn);
*
* // To better support inline function the inline annotation is supported
* injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
* // ...
* }]);
*
* // Therefore
* expect(injector.annotate(
* ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
* ).toEqual(['$compile', '$rootScope']);
* </pre>
*
* @param {function|Array.<string|Function>} fn Function for which dependent service names need to be retrieved as described
* above.
*
* @returns {Array.<string>} The names of the services which the function requires.
*/
/**
* @ngdoc object
* @name AUTO.$provide
*
* @description
*
* Use `$provide` to register new providers with the `$injector`. The providers are the factories for the instance.
* The providers share the same name as the instance they create with the `Provider` suffixed to them.
*
* A provider is an object with a `$get()` method. The injector calls the `$get` method to create a new instance of
* a service. The Provider can have additional methods which would allow for configuration of the provider.
*
* <pre>
* function GreetProvider() {
* var salutation = 'Hello';
*
* this.salutation = function(text) {
* salutation = text;
* };
*
* this.$get = function() {
* return function (name) {
* return salutation + ' ' + name + '!';
* };
* };
* }
*
* describe('Greeter', function(){
*
* beforeEach(module(function($provide) {
* $provide.provider('greet', GreetProvider);
* });
*
* it('should greet', inject(function(greet) {
* expect(greet('angular')).toEqual('Hello angular!');
* }));
*
* it('should allow configuration of salutation', function() {
* module(function(greetProvider) {
* greetProvider.salutation('Ahoj');
* });
* inject(function(greet) {
* expect(greet('angular')).toEqual('Ahoj angular!');
* });
* )};
*
* });
* </pre>
*/
/**
* @ngdoc method
* @name AUTO.$provide#provider
* @methodOf AUTO.$provide
* @description
*
* Register a provider for a service. The providers can be retrieved and can have additional configuration methods.
*
* @param {string} name The name of the instance. NOTE: the provider will be available under `name + 'Provider'` key.
* @param {(Object|function())} provider If the provider is:
*
* - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
* {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be created.
* - `Constructor`: a new instance of the provider will be created using
* {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as `object`.
*
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#factory
* @methodOf AUTO.$provide
* @description
*
* A short hand for configuring services if only `$get` method is required.
*
* @param {string} name The name of the instance.
* @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand for
* `$provide.provider(name, {$get: $getFn})`.
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#service
* @methodOf AUTO.$provide
* @description
*
* A short hand for registering service of given class.
*
* @param {string} name The name of the instance.
* @param {Function} constructor A class (constructor function) that will be instantiated.
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#value
* @methodOf AUTO.$provide
* @description
*
* A short hand for configuring services if the `$get` method is a constant.
*
* @param {string} name The name of the instance.
* @param {*} value The value.
* @returns {Object} registered provider instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#constant
* @methodOf AUTO.$provide
* @description
*
* A constant value, but unlike {@link AUTO.$provide#value value} it can be injected
* into configuration function (other modules) and it is not interceptable by
* {@link AUTO.$provide#decorator decorator}.
*
* @param {string} name The name of the constant.
* @param {*} value The constant value.
* @returns {Object} registered instance
*/
/**
* @ngdoc method
* @name AUTO.$provide#decorator
* @methodOf AUTO.$provide
* @description
*
* Decoration of service, allows the decorator to intercept the service instance creation. The
* returned instance may be the original instance, or a new instance which delegates to the
* original instance.
*
* @param {string} name The name of the service to decorate.
* @param {function()} decorator This function will be invoked when the service needs to be
* instanciated. The function is called using the {@link AUTO.$injector#invoke
* injector.invoke} method and is therefore fully injectable. Local injection arguments:
*
* * `$delegate` - The original service instance, which can be monkey patched, configured,
* decorated or delegated to.
*/
function createInjector(modulesToLoad) {
var INSTANTIATING = {},
providerSuffix = 'Provider',
path = [],
loadedModules = new HashMap(),
providerCache = {
$provide: {
provider: supportObject(provider),
factory: supportObject(factory),
service: supportObject(service),
value: supportObject(value),
constant: supportObject(constant),
decorator: decorator
}
},
providerInjector = createInternalInjector(providerCache, function() {
throw Error("Unknown provider: " + path.join(' <- '));
}),
instanceCache = {},
instanceInjector = (instanceCache.$injector =
createInternalInjector(instanceCache, function(servicename) {
var provider = providerInjector.get(servicename + providerSuffix);
return instanceInjector.invoke(provider.$get, provider);
}));
forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });
return instanceInjector;
////////////////////////////////////
// $provider
////////////////////////////////////
function supportObject(delegate) {
return function(key, value) {
if (isObject(key)) {
forEach(key, reverseParams(delegate));
} else {
return delegate(key, value);
}
}
}
function provider(name, provider_) {
if (isFunction(provider_) || isArray(provider_)) {
provider_ = providerInjector.instantiate(provider_);
}
if (!provider_.$get) {
throw Error('Provider ' + name + ' must define $get factory method.');
}
return providerCache[name + providerSuffix] = provider_;
}
function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); }
function service(name, constructor) {
return factory(name, ['$injector', function($injector) {
return $injector.instantiate(constructor);
}]);
}
function value(name, value) { return factory(name, valueFn(value)); }
function constant(name, value) {
providerCache[name] = value;
instanceCache[name] = value;
}
function decorator(serviceName, decorFn) {
var origProvider = providerInjector.get(serviceName + providerSuffix),
orig$get = origProvider.$get;
origProvider.$get = function() {
var origInstance = instanceInjector.invoke(orig$get, origProvider);
return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
};
}
////////////////////////////////////
// Module Loading
////////////////////////////////////
function loadModules(modulesToLoad){
var runBlocks = [];
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return;
loadedModules.put(module, true);
if (isString(module)) {
var moduleFn = angularModule(module);
runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
try {
for(var invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
var invokeArgs = invokeQueue[i],
provider = invokeArgs[0] == '$injector'
? providerInjector
: providerInjector.get(invokeArgs[0]);
provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
}
} catch (e) {
if (e.message) e.message += ' from ' + module;
throw e;
}
} else if (isFunction(module)) {
try {
runBlocks.push(providerInjector.invoke(module));
} catch (e) {
if (e.message) e.message += ' from ' + module;
throw e;
}
} else if (isArray(module)) {
try {
runBlocks.push(providerInjector.invoke(module));
} catch (e) {
if (e.message) e.message += ' from ' + String(module[module.length - 1]);
throw e;
}
} else {
assertArgFn(module, 'module');
}
});
return runBlocks;
}
////////////////////////////////////
// internal Injector
////////////////////////////////////
function createInternalInjector(cache, factory) {
function getService(serviceName) {
if (typeof serviceName !== 'string') {
throw Error('Service name expected');
}
if (cache.hasOwnProperty(serviceName)) {
if (cache[serviceName] === INSTANTIATING) {
throw Error('Circular dependency: ' + path.join(' <- '));
}
return cache[serviceName];
} else {
try {
path.unshift(serviceName);
cache[serviceName] = INSTANTIATING;
return cache[serviceName] = factory(serviceName);
} finally {
path.shift();
}
}
}
function invoke(fn, self, locals){
var args = [],
$inject = annotate(fn),
length, i,
key;
for(i = 0, length = $inject.length; i < length; i++) {
key = $inject[i];
args.push(
locals && locals.hasOwnProperty(key)
? locals[key]
: getService(key)
);
}
if (!fn.$inject) {
// this means that we must be an array.
fn = fn[length];
}
// Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke
switch (self ? -1 : args.length) {
case 0: return fn();
case 1: return fn(args[0]);
case 2: return fn(args[0], args[1]);
case 3: return fn(args[0], args[1], args[2]);
case 4: return fn(args[0], args[1], args[2], args[3]);
case 5: return fn(args[0], args[1], args[2], args[3], args[4]);
case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
default: return fn.apply(self, args);
}
}
function instantiate(Type, locals) {
var Constructor = function() {},
instance, returnedValue;
Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
instance = new Constructor();
returnedValue = invoke(Type, instance, locals);
return isObject(returnedValue) ? returnedValue : instance;
}
return {
invoke: invoke,
instantiate: instantiate,
get: getService,
annotate: annotate
};
}
}
/**
* @ngdoc function
* @name ng.$anchorScroll
* @requires $window
* @requires $location
* @requires $rootScope
*
* @description
* When called, it checks current value of `$location.hash()` and scroll to related element,
* according to rules specified in
* {@link http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document Html5 spec}.
*
* It also watches the `$location.hash()` and scroll whenever it changes to match any anchor.
* This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`.
*/
function $AnchorScrollProvider() {
var autoScrollingEnabled = true;
this.disableAutoScrolling = function() {
autoScrollingEnabled = false;
};
this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
var document = $window.document;
// helper function to get first anchor from a NodeList
// can't use filter.filter, as it accepts only instances of Array
// and IE can't convert NodeList to an array using [].slice
// TODO(vojta): use filter if we change it to accept lists as well
function getFirstAnchor(list) {
var result = null;
forEach(list, function(element) {
if (!result && lowercase(element.nodeName) === 'a') result = element;
});
return result;
}
function scroll() {
var hash = $location.hash(), elm;
// empty hash, scroll to the top of the page
if (!hash) $window.scrollTo(0, 0);
// element with given id
else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
// first anchor with given name :-D
else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
// no element and hash == 'top', scroll to the top of the page
else if (hash === 'top') $window.scrollTo(0, 0);
}
// does not scroll when user clicks on anchor link that is currently on
// (no url change, no $location.hash() change), browser native does scroll
if (autoScrollingEnabled) {
$rootScope.$watch(function autoScrollWatch() {return $location.hash();},
function autoScrollWatchAction() {
$rootScope.$evalAsync(scroll);
});
}
return scroll;
}];
}
/**
* ! This is a private undocumented service !
*
* @name ng.$browser
* @requires $log
* @description
* This object has two goals:
*
* - hide all the global state in the browser caused by the window object
* - abstract away all the browser specific features and inconsistencies
*
* For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
* service, which can be used for convenient testing of the application without the interaction with
* the real browser apis.
*/
/**
* @param {object} window The global window object.
* @param {object} document jQuery wrapped document.
* @param {function()} XHR XMLHttpRequest constructor.
* @param {object} $log console.log or an object with the same interface.
* @param {object} $sniffer $sniffer service
*/
function Browser(window, document, $log, $sniffer) {
var self = this,
rawDocument = document[0],
location = window.location,
history = window.history,
setTimeout = window.setTimeout,
clearTimeout = window.clearTimeout,
pendingDeferIds = {};
self.isMock = false;
var outstandingRequestCount = 0;
var outstandingRequestCallbacks = [];
// TODO(vojta): remove this temporary api
self.$$completeOutstandingRequest = completeOutstandingRequest;
self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
/**
* Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
* counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
*/
function completeOutstandingRequest(fn) {
try {
fn.apply(null, sliceArgs(arguments, 1));
} finally {
outstandingRequestCount--;
if (outstandingRequestCount === 0) {
while(outstandingRequestCallbacks.length) {
try {
outstandingRequestCallbacks.pop()();
} catch (e) {
$log.error(e);
}
}
}
}
}
/**
* @private
* Note: this method is used only by scenario runner
* TODO(vojta): prefix this method with $$ ?
* @param {function()} callback Function that will be called when no outstanding request
*/
self.notifyWhenNoOutstandingRequests = function(callback) {
// force browser to execute all pollFns - this is needed so that cookies and other pollers fire
// at some deterministic time in respect to the test runner's actions. Leaving things up to the
// regular poller would result in flaky tests.
forEach(pollFns, function(pollFn){ pollFn(); });
if (outstandingRequestCount === 0) {
callback();
} else {
outstandingRequestCallbacks.push(callback);
}
};
//////////////////////////////////////////////////////////////
// Poll Watcher API
//////////////////////////////////////////////////////////////
var pollFns = [],
pollTimeout;
/**
* @name ng.$browser#addPollFn
* @methodOf ng.$browser
*
* @param {function()} fn Poll function to add
*
* @description
* Adds a function to the list of functions that poller periodically executes,
* and starts polling if not started yet.
*
* @returns {function()} the added function
*/
self.addPollFn = function(fn) {
if (isUndefined(pollTimeout)) startPoller(100, setTimeout);
pollFns.push(fn);
return fn;
};
/**
* @param {number} interval How often should browser call poll functions (ms)
* @param {function()} setTimeout Reference to a real or fake `setTimeout` function.
*
* @description
* Configures the poller to run in the specified intervals, using the specified
* setTimeout fn and kicks it off.
*/
function startPoller(interval, setTimeout) {
(function check() {
forEach(pollFns, function(pollFn){ pollFn(); });
pollTimeout = setTimeout(check, interval);
})();
}
//////////////////////////////////////////////////////////////
// URL API
//////////////////////////////////////////////////////////////
var lastBrowserUrl = location.href,
baseElement = document.find('base');
/**
* @name ng.$browser#url
* @methodOf ng.$browser
*
* @description
* GETTER:
* Without any argument, this method just returns current value of location.href.
*
* SETTER:
* With at least one argument, this method sets url to new value.
* If html5 history api supported, pushState/replaceState is used, otherwise
* location.href/location.replace is used.
* Returns its own instance to allow chaining
*
* NOTE: this api is intended for use only by the $location service. Please use the
* {@link ng.$location $location service} to change url.
*
* @param {string} url New url (when used as setter)
* @param {boolean=} replace Should new url replace current history record ?
*/
self.url = function(url, replace) {
// setter
if (url) {
if (lastBrowserUrl == url) return;
lastBrowserUrl = url;
if ($sniffer.history) {
if (replace) history.replaceState(null, '', url);
else {
history.pushState(null, '', url);
// Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462
baseElement.attr('href', baseElement.attr('href'));
}
} else {
if (replace) location.replace(url);
else location.href = url;
}
return self;
// getter
} else {
// the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
return location.href.replace(/%27/g,"'");
}
};
var urlChangeListeners = [],
urlChangeInit = false;
function fireUrlChange() {
if (lastBrowserUrl == self.url()) return;
lastBrowserUrl = self.url();
forEach(urlChangeListeners, function(listener) {
listener(self.url());
});
}
/**
* @name ng.$browser#onUrlChange
* @methodOf ng.$browser
* @TODO(vojta): refactor to use node's syntax for events
*
* @description
* Register callback function that will be called, when url changes.
*
* It's only called when the url is changed by outside of angular:
* - user types different url into address bar
* - user clicks on history (forward/back) button
* - user clicks on a link
*
* It's not called when url is changed by $browser.url() method
*
* The listener gets called with new url as parameter.
*
* NOTE: this api is intended for use only by the $location service. Please use the
* {@link ng.$location $location service} to monitor url changes in angular apps.
*
* @param {function(string)} listener Listener function to be called when url changes.
* @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
*/
self.onUrlChange = function(callback) {
if (!urlChangeInit) {
// We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
// don't fire popstate when user change the address bar and don't fire hashchange when url
// changed by push/replaceState
// html5 history api - popstate event
if ($sniffer.history) jqLite(window).bind('popstate', fireUrlChange);
// hashchange event
if ($sniffer.hashchange) jqLite(window).bind('hashchange', fireUrlChange);
// polling
else self.addPollFn(fireUrlChange);
urlChangeInit = true;
}
urlChangeListeners.push(callback);
return callback;
};
//////////////////////////////////////////////////////////////
// Misc API
//////////////////////////////////////////////////////////////
/**
* Returns current <base href>
* (always relative - without domain)
*
* @returns {string=}
*/
self.baseHref = function() {
var href = baseElement.attr('href');
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;
};
//////////////////////////////////////////////////////////////
// Cookies API
//////////////////////////////////////////////////////////////
var lastCookies = {};
var lastCookieString = '';
var cookiePath = self.baseHref();
/**
* @name ng.$browser#cookies
* @methodOf ng.$browser
*
* @param {string=} name Cookie name
* @param {string=} value Cokkie value
*
* @description
* The cookies method provides a 'private' low level access to browser cookies.
* It is not meant to be used directly, use the $cookie service instead.
*
* The return values vary depending on the arguments that the method was called with as follows:
* <ul>
* <li>cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify it</li>
* <li>cookies(name, value) -> set name to value, if value is undefined delete the cookie</li>
* <li>cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that way)</li>
* </ul>
*
* @returns {Object} Hash of all cookies (if called without any parameter)
*/
self.cookies = function(name, value) {
var cookieLength, cookieArray, cookie, i, index;
if (name) {
if (value === undefined) {
rawDocument.cookie = escape(name) + "=;path=" + cookiePath + ";expires=Thu, 01 Jan 1970 00:00:00 GMT";
} else {
if (isString(value)) {
cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) + ';path=' + cookiePath).length + 1;
// per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
// - 300 cookies
// - 20 cookies per unique domain
// - 4096 bytes per cookie
if (cookieLength > 4096) {
$log.warn("Cookie '"+ name +"' possibly not set or overflowed because it was too large ("+
cookieLength + " > 4096 bytes)!");
}
}
}
} else {
if (rawDocument.cookie !== lastCookieString) {
lastCookieString = rawDocument.cookie;
cookieArray = lastCookieString.split("; ");
lastCookies = {};
for (i = 0; i < cookieArray.length; i++) {
cookie = cookieArray[i];
index = cookie.indexOf('=');
if (index > 0) { //ignore nameless cookies
lastCookies[unescape(cookie.substring(0, index))] = unescape(cookie.substring(index + 1));
}
}
}
return lastCookies;
}
};
/**
* @name ng.$browser#defer
* @methodOf ng.$browser
* @param {function()} fn A function, who's execution should be defered.
* @param {number=} [delay=0] of milliseconds to defer the function execution.
* @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
*
* @description
* Executes a fn asynchroniously via `setTimeout(fn, delay)`.
*
* Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
* `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
* via `$browser.defer.flush()`.
*
*/
self.defer = function(fn, delay) {
var timeoutId;
outstandingRequestCount++;
timeoutId = setTimeout(function() {
delete pendingDeferIds[timeoutId];
completeOutstandingRequest(fn);
}, delay || 0);
pendingDeferIds[timeoutId] = true;
return timeoutId;
};
/**
* @name ng.$browser#defer.cancel
* @methodOf ng.$browser.defer
*
* @description
* Cancels a defered task identified with `deferId`.
*
* @param {*} deferId Token returned by the `$browser.defer` function.
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfuly canceled.
*/
self.defer.cancel = function(deferId) {
if (pendingDeferIds[deferId]) {
delete pendingDeferIds[deferId];
clearTimeout(deferId);
completeOutstandingRequest(noop);
return true;
}
return false;
};
}
function $BrowserProvider(){
this.$get = ['$window', '$log', '$sniffer', '$document',
function( $window, $log, $sniffer, $document){
return new Browser($window, $document, $log, $sniffer);
}];
}
/**
* @ngdoc object
* @name ng.$cacheFactory
*
* @description
* Factory that constructs cache objects.
*
*
* @param {string} cacheId Name or id of the newly created cache.
* @param {object=} options Options object that specifies the cache behavior. Properties:
*
* - `{number=}` `capacity` — turns the cache into LRU cache.
*
* @returns {object} Newly created cache object with the following set of methods:
*
* - `{object}` `info()` — Returns id, size, and options of cache.
* - `{void}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache.
* - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
* - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
* - `{void}` `removeAll()` — Removes all cached values.
* - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
*
*/
function $CacheFactoryProvider() {
this.$get = function() {
var caches = {};
function cacheFactory(cacheId, options) {
if (cacheId in caches) {
throw Error('cacheId ' + cacheId + ' taken');
}
var size = 0,
stats = extend({}, options, {id: cacheId}),
data = {},
capacity = (options && options.capacity) || Number.MAX_VALUE,
lruHash = {},
freshEnd = null,
staleEnd = null;
return caches[cacheId] = {
put: function(key, value) {
var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
refresh(lruEntry);
if (isUndefined(value)) return;
if (!(key in data)) size++;
data[key] = value;
if (size > capacity) {
this.remove(staleEnd.key);
}
},
get: function(key) {
var lruEntry = lruHash[key];
if (!lruEntry) return;
refresh(lruEntry);
return data[key];
},
remove: function(key) {
var lruEntry = lruHash[key];
if (!lruEntry) return;
if (lruEntry == freshEnd) freshEnd = lruEntry.p;
if (lruEntry == staleEnd) staleEnd = lruEntry.n;
link(lruEntry.n,lruEntry.p);
delete lruHash[key];
delete data[key];
size--;
},
removeAll: function() {
data = {};
size = 0;
lruHash = {};
freshEnd = staleEnd = null;
},
destroy: function() {
data = null;
stats = null;
lruHash = null;
delete caches[cacheId];
},
info: function() {
return extend({}, stats, {size: size});
}
};
/**
* makes the `entry` the freshEnd of the LRU linked list
*/
function refresh(entry) {
if (entry != freshEnd) {
if (!staleEnd) {
staleEnd = entry;
} else if (staleEnd == entry) {
staleEnd = entry.n;
}
link(entry.n, entry.p);
link(entry, freshEnd);
freshEnd = entry;
freshEnd.n = null;
}
}
/**
* bidirectionally links two entries of the LRU linked list
*/
function link(nextEntry, prevEntry) {
if (nextEntry != prevEntry) {
if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
}
}
}
cacheFactory.info = function() {
var info = {};
forEach(caches, function(cache, cacheId) {
info[cacheId] = cache.info();
});
return info;
};
cacheFactory.get = function(cacheId) {
return caches[cacheId];
};
return cacheFactory;
};
}
/**
* @ngdoc object
* @name ng.$templateCache
*
* @description
* Cache used for storing html templates.
*
* See {@link ng.$cacheFactory $cacheFactory}.
*
*/
function $TemplateCacheProvider() {
this.$get = ['$cacheFactory', function($cacheFactory) {
return $cacheFactory('templates');
}];
}
/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
*
* DOM-related variables:
*
* - "node" - DOM Node
* - "element" - DOM Element or Node
* - "$node" or "$element" - jqLite-wrapped node or element
*
*
* Compiler related stuff:
*
* - "linkFn" - linking fn of a single directive
* - "nodeLinkFn" - function that aggregates all linking fns for a particular node
* - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node
* - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
*/
var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
/**
* @ngdoc function
* @name ng.$compile
* @function
*
* @description
* Compiles a piece of HTML string or DOM into a template and produces a template function, which
* can then be used to link {@link ng.$rootScope.Scope scope} and the template together.
*
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
* {@link ng.$compileProvider#directive directives}. For each match it
* executes corresponding template function and collects the
* instance functions into a single template function which is then returned.
*
* The template function can then be used once to produce the view or as it is the case with
* {@link ng.directive:ngRepeat repeater} many-times, in which
* case each call results in a view that is a DOM clone of the original template.
*
<doc:example module="compile">
<doc:source>
<script>
// declare a new module, and inject the $compileProvider
angular.module('compile', [], function($compileProvider) {
// configure new 'compile' directive by passing a directive
// factory function. The factory function injects the '$compile'
$compileProvider.directive('compile', function($compile) {
// directive factory creates a link function
return function(scope, element, attrs) {
scope.$watch(
function(scope) {
// watch the 'compile' expression for changes
return scope.$eval(attrs.compile);
},
function(value) {
// when the 'compile' expression changes
// assign it into the current DOM
element.html(value);
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
}
);
};
})
});
function Ctrl($scope) {
$scope.name = 'Angular';
$scope.html = 'Hello {{name}}';
}
</script>
<div ng-controller="Ctrl">
<input ng-model="name"> <br>
<textarea ng-model="html"></textarea> <br>
<div compile="html"></div>
</div>
</doc:source>
<doc:scenario>
it('should auto compile', function() {
expect(element('div[compile]').text()).toBe('Hello Angular');
input('html').enter('{{name}}!');
expect(element('div[compile]').text()).toBe('Angular!');
});
</doc:scenario>
</doc:example>
*
*
* @param {string|DOMElement} element Element or HTML string to compile into a template function.
* @param {function(angular.Scope[, cloneAttachFn]} transclude function available to directives.
* @param {number} maxPriority only apply directives lower then given priority (Only effects the
* root element(s), not their children)
* @returns {function(scope[, cloneAttachFn])} a link function which is used to bind template
* (a DOM element/tree) to a scope. Where:
*
* * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
* * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
* `template` and call the `cloneAttachFn` function allowing the caller to attach the
* cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
* called as: <br> `cloneAttachFn(clonedElement, scope)` where:
*
* * `clonedElement` - is a clone of the original `element` passed into the compiler.
* * `scope` - is the current scope with which the linking function is working with.
*
* Calling the linking function returns the element of the template. It is either the original element
* passed in, or the clone of the element if the `cloneAttachFn` is provided.
*
* After linking the view is not updated until after a call to $digest which typically is done by
* Angular automatically.
*
* If you need access to the bound view, there are two ways to do it:
*
* - If you are not asking the linking function to clone the template, create the DOM element(s)
* before you send them to the compiler and keep this reference around.
* <pre>
* var element = $compile('<p>{{total}}</p>')(scope);
* </pre>
*
* - if on the other hand, you need the element to be cloned, the view reference from the original
* example would not point to the clone, but rather to the original template that was cloned. In
* this case, you can access the clone via the cloneAttachFn:
* <pre>
* var templateHTML = angular.element('<p>{{total}}</p>'),
* scope = ....;
*
* var clonedElement = $compile(templateHTML)(scope, function(clonedElement, scope) {
* //attach the clone to DOM document at the right place
* });
*
* //now we have reference to the cloned DOM via `clone`
* </pre>
*
*
* For information on how the compiler works, see the
* {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
*/
/**
* @ngdoc service
* @name ng.$compileProvider
* @function
*
* @description
*/
$CompileProvider.$inject = ['$provide'];
function $CompileProvider($provide) {
var hasDirectives = {},
Suffix = 'Directive',
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ';
/**
* @ngdoc function
* @name ng.$compileProvider#directive
* @methodOf ng.$compileProvider
* @function
*
* @description
* Register a new directives with the compiler.
*
* @param {string} name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
* <code>ng-bind</code>).
* @param {function} directiveFactory An injectable directive factroy function. See {@link guide/directive} for more
* info.
* @returns {ng.$compileProvider} Self for chaining.
*/
this.directive = function registerDirective(name, directiveFactory) {
if (isString(name)) {
assertArg(directiveFactory, 'directive');
if (!hasDirectives.hasOwnProperty(name)) {
hasDirectives[name] = [];
$provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
function($injector, $exceptionHandler) {
var directives = [];
forEach(hasDirectives[name], function(directiveFactory) {
try {
var directive = $injector.invoke(directiveFactory);
if (isFunction(directive)) {
directive = { compile: valueFn(directive) };
} else if (!directive.compile && directive.link) {
directive.compile = valueFn(directive.link);
}
directive.priority = directive.priority || 0;
directive.name = directive.name || name;
directive.require = directive.require || (directive.controller && directive.name);
directive.restrict = directive.restrict || 'A';
directives.push(directive);
} catch (e) {
$exceptionHandler(e);
}
});
return directives;
}]);
}
hasDirectives[name].push(directiveFactory);
} else {
forEach(name, reverseParams(registerDirective));
}
return this;
};
this.$get = [
'$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
'$controller', '$rootScope',
function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse,
$controller, $rootScope) {
var Attributes = function(element, attr) {
this.$$element = element;
this.$attr = attr || {};
};
Attributes.prototype = {
$normalize: directiveNormalize,
/**
* Set a normalized attribute on the element in a way such that all directives
* can share the attribute. This function properly handles boolean attributes.
* @param {string} key Normalized key. (ie ngAttribute)
* @param {string|boolean} value The value to set. If `null` attribute will be deleted.
* @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
* Defaults to true.
* @param {string=} attrName Optional none normalized name. Defaults to key.
*/
$set: function(key, value, writeAttr, attrName) {
var booleanKey = getBooleanAttrName(this.$$element[0], key),
$$observers = this.$$observers;
if (booleanKey) {
this.$$element.prop(key, value);
attrName = booleanKey;
}
this[key] = value;
// translate normalized key to actual key
if (attrName) {
this.$attr[key] = attrName;
} else {
attrName = this.$attr[key];
if (!attrName) {
this.$attr[key] = attrName = snake_case(key, '-');
}
}
if (writeAttr !== false) {
if (value === null || value === undefined) {
this.$$element.removeAttr(attrName);
} else {
this.$$element.attr(attrName, value);
}
}
// fire observers
$$observers && forEach($$observers[key], function(fn) {
try {
fn(value);
} catch (e) {
$exceptionHandler(e);
}
});
},
/**
* Observe an interpolated attribute.
* The observer will never be called, if given attribute is not interpolated.
*
* @param {string} key Normalized key. (ie ngAttribute) .
* @param {function(*)} fn Function that will be called whenever the attribute value changes.
* @returns {function(*)} the `fn` Function passed in.
*/
$observe: function(key, fn) {
var attrs = this,
$$observers = (attrs.$$observers || (attrs.$$observers = {})),
listeners = ($$observers[key] || ($$observers[key] = []));
listeners.push(fn);
$rootScope.$evalAsync(function() {
if (!listeners.$$inter) {
// no one registered attribute interpolation function, so lets call it manually
fn(attrs[key]);
}
});
return fn;
}
};
var startSymbol = $interpolate.startSymbol(),
endSymbol = $interpolate.endSymbol(),
denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
? identity
: function denormalizeTemplate(template) {
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
};
return compile;
//================================
function compile($compileNodes, transcludeFn, maxPriority) {
if (!($compileNodes instanceof jqLite)) {
// jquery always rewraps, where as we need to preserve the original selector so that we can modify it.
$compileNodes = jqLite($compileNodes);
}
// We can not compile top level text elements since text nodes can be merged and we will
// not be able to attach scope data to them, so we will wrap them in <span>
forEach($compileNodes, function(node, index){
if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) {
$compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0];
}
});
var compositeLinkFn = compileNodes($compileNodes, transcludeFn, $compileNodes, maxPriority);
return function publicLinkFn(scope, cloneConnectFn){
assertArg(scope, 'scope');
// important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
// and sometimes changes the structure of the DOM.
var $linkNode = cloneConnectFn
? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
: $compileNodes;
$linkNode.data('$scope', scope);
safeAddClass($linkNode, 'ng-scope');
if (cloneConnectFn) cloneConnectFn($linkNode, scope);
if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
return $linkNode;
};
}
function wrongMode(localName, mode) {
throw Error("Unsupported '" + mode + "' for '" + localName + "'.");
}
function safeAddClass($element, className) {
try {
$element.addClass(className);
} catch(e) {
// ignore, since it means that we are trying to set class on
// SVG element, where class name is read-only.
}
}
/**
* Compile function matches each node in nodeList against the directives. Once all directives
* for a particular node are collected their compile functions are executed. The compile
* functions return values - the linking functions - are combined into a composite linking
* function, which is the a linking function for the node.
*
* @param {NodeList} nodeList an array of nodes to compile
* @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the
* scope argument is auto-generated to the new child of the transcluded parent scope.
* @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then the
* rootElement must be set the jqLite collection of the compile root. This is
* needed so that the jqLite collection items can be replaced with widgets.
* @param {number=} max directive priority
* @returns {?function} A composite linking function of all of the matched directives or null.
*/
function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) {
var linkFns = [],
nodeLinkFn, childLinkFn, directives, attrs, linkFnFound;
for(var i = 0; i < nodeList.length; i++) {
attrs = new Attributes();
// we must always refer to nodeList[i] since the nodes can be replaced underneath us.
directives = collectDirectives(nodeList[i], [], attrs, maxPriority);
nodeLinkFn = (directives.length)
? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement)
: null;
childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length)
? null
: compileNodes(nodeList[i].childNodes,
nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
linkFns.push(nodeLinkFn);
linkFns.push(childLinkFn);
linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn);
}
// return a linking function if we have found anything, null otherwise
return linkFnFound ? compositeLinkFn : null;
function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {
var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn, i, ii, n;
// copy nodeList so that linking doesn't break due to live list updates.
var stableNodeList = [];
for (i = 0, ii = nodeList.length; i < ii; i++) {
stableNodeList.push(nodeList[i]);
}
for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
node = stableNodeList[n];
nodeLinkFn = linkFns[i++];
childLinkFn = linkFns[i++];
if (nodeLinkFn) {
if (nodeLinkFn.scope) {
childScope = scope.$new(isObject(nodeLinkFn.scope));
jqLite(node).data('$scope', childScope);
} else {
childScope = scope;
}
childTranscludeFn = nodeLinkFn.transclude;
if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
nodeLinkFn(childLinkFn, childScope, node, $rootElement,
(function(transcludeFn) {
return function(cloneFn) {
var transcludeScope = scope.$new();
return transcludeFn(transcludeScope, cloneFn).
bind('$destroy', bind(transcludeScope, transcludeScope.$destroy));
};
})(childTranscludeFn || transcludeFn)
);
} else {
nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
}
} else if (childLinkFn) {
childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
}
}
}
}
/**
* Looks for directives on the given node and adds them to the directive collection which is
* sorted.
*
* @param node Node to search.
* @param directives An array to which the directives are added to. This array is sorted before
* the function returns.
* @param attrs The shared attrs object which is used to populate the normalized attributes.
* @param {number=} maxPriority Max directive priority.
*/
function collectDirectives(node, directives, attrs, maxPriority) {
var nodeType = node.nodeType,
attrsMap = attrs.$attr,
match,
className;
switch(nodeType) {
case 1: /* Element */
// use the node name: <directive>
addDirective(directives,
directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority);
// iterate over the attributes
for (var attr, name, nName, value, nAttrs = node.attributes,
j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
attr = nAttrs[j];
if (attr.specified) {
name = attr.name;
nName = directiveNormalize(name.toLowerCase());
attrsMap[nName] = name;
attrs[nName] = value = trim((msie && name == 'href')
? decodeURIComponent(node.getAttribute(name, 2))
: attr.value);
if (getBooleanAttrName(node, nName)) {
attrs[nName] = true; // presence means true
}
addAttrInterpolateDirective(node, directives, value, nName);
addDirective(directives, nName, 'A', maxPriority);
}
}
// use class as directive
className = node.className;
if (isString(className) && className !== '') {
while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
nName = directiveNormalize(match[2]);
if (addDirective(directives, nName, 'C', maxPriority)) {
attrs[nName] = trim(match[3]);
}
className = className.substr(match.index + match[0].length);
}
}
break;
case 3: /* Text Node */
addTextInterpolateDirective(directives, node.nodeValue);
break;
case 8: /* Comment */
try {
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
if (match) {
nName = directiveNormalize(match[1]);
if (addDirective(directives, nName, 'M', maxPriority)) {
attrs[nName] = trim(match[2]);
}
}
} catch (e) {
// turns out that under some circumstances IE9 throws errors when one attempts to read comment's node value.
// Just ignore it and continue. (Can't seem to reproduce in test case.)
}
break;
}
directives.sort(byPriority);
return directives;
}
/**
* Once the directives have been collected their compile functions is executed. This method
* is responsible for inlining directive templates as well as terminating the application
* of the directives if the terminal directive has been reached..
*
* @param {Array} directives Array of collected directives to execute their compile function.
* this needs to be pre-sorted by priority order.
* @param {Node} compileNode The raw DOM node to apply the compile functions to
* @param {Object} templateAttrs The shared attribute function
* @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the
* scope argument is auto-generated to the new child of the transcluded parent scope.
* @param {DOMElement} $rootElement If we are working on the root of the compile tree then this
* argument has the root jqLite array so that we can replace widgets on it.
* @returns linkFn
*/
function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, $rootElement) {
var terminalPriority = -Number.MAX_VALUE,
preLinkFns = [],
postLinkFns = [],
newScopeDirective = null,
newIsolateScopeDirective = null,
templateDirective = null,
$compileNode = templateAttrs.$$element = jqLite(compileNode),
directive,
directiveName,
$template,
transcludeDirective,
childTranscludeFn = transcludeFn,
controllerDirectives,
linkFn,
directiveValue;
// executes all directives on the current element
for(var i = 0, ii = directives.length; i < ii; i++) {
directive = directives[i];
$template = undefined;
if (terminalPriority > directive.priority) {
break; // prevent further processing of directives
}
if (directiveValue = directive.scope) {
assertNoDuplicate('isolated scope', newIsolateScopeDirective, directive, $compileNode);
if (isObject(directiveValue)) {
safeAddClass($compileNode, 'ng-isolate-scope');
newIsolateScopeDirective = directive;
}
safeAddClass($compileNode, 'ng-scope');
newScopeDirective = newScopeDirective || directive;
}
directiveName = directive.name;
if (directiveValue = directive.controller) {
controllerDirectives = controllerDirectives || {};
assertNoDuplicate("'" + directiveName + "' controller",
controllerDirectives[directiveName], directive, $compileNode);
controllerDirectives[directiveName] = directive;
}
if (directiveValue = directive.transclude) {
assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode);
transcludeDirective = directive;
terminalPriority = directive.priority;
if (directiveValue == 'element') {
$template = jqLite(compileNode);
$compileNode = templateAttrs.$$element =
jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' '));
compileNode = $compileNode[0];
replaceWith($rootElement, jqLite($template[0]), compileNode);
childTranscludeFn = compile($template, transcludeFn, terminalPriority);
} else {
$template = jqLite(JQLiteClone(compileNode)).contents();
$compileNode.html(''); // clear contents
childTranscludeFn = compile($template, transcludeFn);
}
}
if ((directiveValue = directive.template)) {
assertNoDuplicate('template', templateDirective, directive, $compileNode);
templateDirective = directive;
directiveValue = denormalizeTemplate(directiveValue);
if (directive.replace) {
$template = jqLite('<div>' +
trim(directiveValue) +
'</div>').contents();
compileNode = $template[0];
if ($template.length != 1 || compileNode.nodeType !== 1) {
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
}
replaceWith($rootElement, $compileNode, compileNode);
var newTemplateAttrs = {$attr: {}};
// combine directives from the original node and from the template:
// - take the array of directives for this element
// - split it into two parts, those that were already applied and those that weren't
// - collect directives from the template, add them to the second group and sort them
// - append the second group with new directives to the first group
directives = directives.concat(
collectDirectives(
compileNode,
directives.splice(i + 1, directives.length - (i + 1)),
newTemplateAttrs
)
);
mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
ii = directives.length;
} else {
$compileNode.html(directiveValue);
}
}
if (directive.templateUrl) {
assertNoDuplicate('template', templateDirective, directive, $compileNode);
templateDirective = directive;
nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i),
nodeLinkFn, $compileNode, templateAttrs, $rootElement, directive.replace,
childTranscludeFn);
ii = directives.length;
} else if (directive.compile) {
try {
linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
if (isFunction(linkFn)) {
addLinkFns(null, linkFn);
} else if (linkFn) {
addLinkFns(linkFn.pre, linkFn.post);
}
} catch (e) {
$exceptionHandler(e, startingTag($compileNode));
}
}
if (directive.terminal) {
nodeLinkFn.terminal = true;
terminalPriority = Math.max(terminalPriority, directive.priority);
}
}
nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope;
nodeLinkFn.transclude = transcludeDirective && childTranscludeFn;
// might be normal or delayed nodeLinkFn depending on if templateUrl is present
return nodeLinkFn;
////////////////////
function addLinkFns(pre, post) {
if (pre) {
pre.require = directive.require;
preLinkFns.push(pre);
}
if (post) {
post.require = directive.require;
postLinkFns.push(post);
}
}
function getControllers(require, $element) {
var value, retrievalMethod = 'data', optional = false;
if (isString(require)) {
while((value = require.charAt(0)) == '^' || value == '?') {
require = require.substr(1);
if (value == '^') {
retrievalMethod = 'inheritedData';
}
optional = optional || value == '?';
}
value = $element[retrievalMethod]('$' + require + 'Controller');
if (!value && !optional) {
throw Error("No controller: " + require);
}
return value;
} else if (isArray(require)) {
value = [];
forEach(require, function(require) {
value.push(getControllers(require, $element));
});
}
return value;
}
function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
var attrs, $element, i, ii, linkFn, controller;
if (compileNode === linkNode) {
attrs = templateAttrs;
} else {
attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
}
$element = attrs.$$element;
if (newIsolateScopeDirective) {
var LOCAL_REGEXP = /^\s*([@=&])\s*(\w*)\s*$/;
var parentScope = scope.$parent || scope;
forEach(newIsolateScopeDirective.scope, function(definiton, scopeName) {
var match = definiton.match(LOCAL_REGEXP) || [],
attrName = match[2]|| scopeName,
mode = match[1], // @, =, or &
lastValue,
parentGet, parentSet;
switch (mode) {
case '@': {
attrs.$observe(attrName, function(value) {
scope[scopeName] = value;
});
attrs.$$observers[attrName].$$scope = parentScope;
break;
}
case '=': {
parentGet = $parse(attrs[attrName]);
parentSet = parentGet.assign || function() {
// reset the change, or we will throw this exception on every $digest
lastValue = scope[scopeName] = parentGet(parentScope);
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + attrs[attrName] +
' (directive: ' + newIsolateScopeDirective.name + ')');
};
lastValue = scope[scopeName] = parentGet(parentScope);
scope.$watch(function parentValueWatch() {
var parentValue = parentGet(parentScope);
if (parentValue !== scope[scopeName]) {
// we are out of sync and need to copy
if (parentValue !== lastValue) {
// parent changed and it has precedence
lastValue = scope[scopeName] = parentValue;
} else {
// if the parent can be assigned then do so
parentSet(parentScope, parentValue = lastValue = scope[scopeName]);
}
}
return parentValue;
});
break;
}
case '&': {
parentGet = $parse(attrs[attrName]);
scope[scopeName] = function(locals) {
return parentGet(parentScope, locals);
}
break;
}
default: {
throw Error('Invalid isolate scope definition for directive ' +
newIsolateScopeDirective.name + ': ' + definiton);
}
}
});
}
if (controllerDirectives) {
forEach(controllerDirectives, function(directive) {
var locals = {
$scope: scope,
$element: $element,
$attrs: attrs,
$transclude: boundTranscludeFn
};
controller = directive.controller;
if (controller == '@') {
controller = attrs[directive.name];
}
$element.data(
'$' + directive.name + 'Controller',
$controller(controller, locals));
});
}
// PRELINKING
for(i = 0, ii = preLinkFns.length; i < ii; i++) {
try {
linkFn = preLinkFns[i];
linkFn(scope, $element, attrs,
linkFn.require && getControllers(linkFn.require, $element));
} catch (e) {
$exceptionHandler(e, startingTag($element));
}
}
// RECURSION
childLinkFn && childLinkFn(scope, linkNode.childNodes, undefined, boundTranscludeFn);
// POSTLINKING
for(i = 0, ii = postLinkFns.length; i < ii; i++) {
try {
linkFn = postLinkFns[i];
linkFn(scope, $element, attrs,
linkFn.require && getControllers(linkFn.require, $element));
} catch (e) {
$exceptionHandler(e, startingTag($element));
}
}
}
}
/**
* looks up the directive and decorates it with exception handling and proper parameters. We
* call this the boundDirective.
*
* @param {string} name name of the directive to look up.
* @param {string} location The directive must be found in specific format.
* String containing any of theses characters:
*
* * `E`: element name
* * `A': attribute
* * `C`: class
* * `M`: comment
* @returns true if directive was added.
*/
function addDirective(tDirectives, name, location, maxPriority) {
var match = false;
if (hasDirectives.hasOwnProperty(name)) {
for(var directive, directives = $injector.get(name + Suffix),
i = 0, ii = directives.length; i<ii; i++) {
try {
directive = directives[i];
if ( (maxPriority === undefined || maxPriority > directive.priority) &&
directive.restrict.indexOf(location) != -1) {
tDirectives.push(directive);
match = true;
}
} catch(e) { $exceptionHandler(e); }
}
}
return match;
}
/**
* When the element is replaced with HTML template then the new attributes
* on the template need to be merged with the existing attributes in the DOM.
* The desired effect is to have both of the attributes present.
*
* @param {object} dst destination attributes (original DOM)
* @param {object} src source attributes (from the directive template)
*/
function mergeTemplateAttributes(dst, src) {
var srcAttr = src.$attr,
dstAttr = dst.$attr,
$element = dst.$$element;
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) != '$') {
if (src[key]) {
value += (key === 'style' ? ';' : ' ') + src[key];
}
dst.$set(key, value, true, srcAttr[key]);
}
});
// copy the new attributes on the old attrs object
forEach(src, function(value, key) {
if (key == 'class') {
safeAddClass($element, value);
dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
} else if (key == 'style') {
$element.attr('style', $element.attr('style') + ';' + value);
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
dst[key] = value;
dstAttr[key] = srcAttr[key];
}
});
}
function compileTemplateUrl(directives, beforeTemplateNodeLinkFn, $compileNode, tAttrs,
$rootElement, replace, childTranscludeFn) {
var linkQueue = [],
afterTemplateNodeLinkFn,
afterTemplateChildLinkFn,
beforeTemplateCompileNode = $compileNode[0],
origAsyncDirective = directives.shift(),
// The fact that we have to copy and patch the directive seems wrong!
derivedSyncDirective = extend({}, origAsyncDirective, {
controller: null, templateUrl: null, transclude: null, scope: null
});
$compileNode.html('');
$http.get(origAsyncDirective.templateUrl, {cache: $templateCache}).
success(function(content) {
var compileNode, tempTemplateAttrs, $template;
content = denormalizeTemplate(content);
if (replace) {
$template = jqLite('<div>' + trim(content) + '</div>').contents();
compileNode = $template[0];
if ($template.length != 1 || compileNode.nodeType !== 1) {
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + content);
}
tempTemplateAttrs = {$attr: {}};
replaceWith($rootElement, $compileNode, compileNode);
collectDirectives(compileNode, directives, tempTemplateAttrs);
mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
} else {
compileNode = beforeTemplateCompileNode;
$compileNode.html(content);
}
directives.unshift(derivedSyncDirective);
afterTemplateNodeLinkFn = applyDirectivesToNode(directives, $compileNode, tAttrs, childTranscludeFn);
afterTemplateChildLinkFn = compileNodes($compileNode.contents(), childTranscludeFn);
while(linkQueue.length) {
var controller = linkQueue.pop(),
linkRootElement = linkQueue.pop(),
beforeTemplateLinkNode = linkQueue.pop(),
scope = linkQueue.pop(),
linkNode = compileNode;
if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
// it was cloned therefore we have to clone as well.
linkNode = JQLiteClone(compileNode);
replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
}
afterTemplateNodeLinkFn(function() {
beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, controller);
}, scope, linkNode, $rootElement, controller);
}
linkQueue = null;
}).
error(function(response, code, headers, config) {
throw Error('Failed to load template: ' + config.url);
});
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, controller) {
if (linkQueue) {
linkQueue.push(scope);
linkQueue.push(node);
linkQueue.push(rootElement);
linkQueue.push(controller);
} else {
afterTemplateNodeLinkFn(function() {
beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, controller);
}, scope, node, rootElement, controller);
}
};
}
/**
* Sorting function for bound directives.
*/
function byPriority(a, b) {
return b.priority - a.priority;
}
function assertNoDuplicate(what, previousDirective, directive, element) {
if (previousDirective) {
throw Error('Multiple directives [' + previousDirective.name + ', ' +
directive.name + '] asking for ' + what + ' on: ' + startingTag(element));
}
}
function addTextInterpolateDirective(directives, text) {
var interpolateFn = $interpolate(text, true);
if (interpolateFn) {
directives.push({
priority: 0,
compile: valueFn(function textInterpolateLinkFn(scope, node) {
var parent = node.parent(),
bindings = parent.data('$binding') || [];
bindings.push(interpolateFn);
safeAddClass(parent.data('$binding', bindings), 'ng-binding');
scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
node[0].nodeValue = value;
});
})
});
}
}
function addAttrInterpolateDirective(node, directives, value, name) {
var interpolateFn = $interpolate(value, true);
// no interpolation found -> ignore
if (!interpolateFn) return;
directives.push({
priority: 100,
compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) {
var $$observers = (attr.$$observers || (attr.$$observers = {}));
if (name === 'class') {
// we need to interpolate classes again, in the case the element was replaced
// and therefore the two class attrs got merged - we want to interpolate the result
interpolateFn = $interpolate(attr[name], true);
}
attr[name] = undefined;
($$observers[name] || ($$observers[name] = [])).$$inter = true;
(attr.$$observers && attr.$$observers[name].$$scope || scope).
$watch(interpolateFn, function interpolateFnWatchAction(value) {
attr.$set(name, value);
});
})
});
}
/**
* This is a special jqLite.replaceWith, which can replace items which
* have no parents, provided that the containing jqLite collection is provided.
*
* @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
* in the root of the tree.
* @param {JqLite} $element The jqLite element which we are going to replace. We keep the shell,
* but replace its DOM node reference.
* @param {Node} newNode The new DOM node.
*/
function replaceWith($rootElement, $element, newNode) {
var oldNode = $element[0],
parent = oldNode.parentNode,
i, ii;
if ($rootElement) {
for(i = 0, ii = $rootElement.length; i < ii; i++) {
if ($rootElement[i] == oldNode) {
$rootElement[i] = newNode;
break;
}
}
}
if (parent) {
parent.replaceChild(newNode, oldNode);
}
newNode[jqLite.expando] = oldNode[jqLite.expando];
$element[0] = newNode;
}
}];
}
var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i;
/**
* Converts all accepted directives format into proper directive name.
* All of these will become 'myDirective':
* my:DiRective
* my-directive
* x-my-directive
* data-my:directive
*
* Also there is special case for Moz prefix starting with upper case letter.
* @param name Name to normalize
*/
function directiveNormalize(name) {
return camelCase(name.replace(PREFIX_REGEXP, ''));
}
/**
* @ngdoc object
* @name ng.$compile.directive.Attributes
* @description
*
* A shared object between directive compile / linking functions which contains normalized DOM element
* attributes. The the values reflect current binding state `{{ }}`. The normalization is needed
* since all of these are treated as equivalent in Angular:
*
* <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
*/
/**
* @ngdoc property
* @name ng.$compile.directive.Attributes#$attr
* @propertyOf ng.$compile.directive.Attributes
* @returns {object} A map of DOM element attribute names to the normalized name. This is
* needed to do reverse lookup from normalized name back to actual name.
*/
/**
* @ngdoc function
* @name ng.$compile.directive.Attributes#$set
* @methodOf ng.$compile.directive.Attributes
* @function
*
* @description
* Set DOM element attribute value.
*
*
* @param {string} name Normalized element attribute name of the property to modify. The name is
* revers translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
* property to the original name.
* @param {string} value Value to set the attribute to.
*/
/**
* Closure compiler type information
*/
function nodesetLinkingFn(
/* angular.Scope */ scope,
/* NodeList */ nodeList,
/* Element */ rootElement,
/* function(Function) */ boundTranscludeFn
){}
function directiveLinkingFn(
/* nodesetLinkingFn */ nodesetLinkingFn,
/* angular.Scope */ scope,
/* Node */ node,
/* Element */ rootElement,
/* function(Function) */ boundTranscludeFn
){}
/**
* @ngdoc object
* @name ng.$controllerProvider
* @description
* The {@link ng.$controller $controller service} is used by Angular to create new
* controllers.
*
* This provider allows controller registration via the
* {@link ng.$controllerProvider#register register} method.
*/
function $ControllerProvider() {
var controllers = {};
/**
* @ngdoc function
* @name ng.$controllerProvider#register
* @methodOf ng.$controllerProvider
* @param {string} name Controller name
* @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
* annotations in the array notation).
*/
this.register = function(name, constructor) {
if (isObject(name)) {
extend(controllers, name)
} else {
controllers[name] = constructor;
}
};
this.$get = ['$injector', '$window', function($injector, $window) {
/**
* @ngdoc function
* @name ng.$controller
* @requires $injector
*
* @param {Function|string} constructor If called with a function then it's considered to be the
* controller constructor function. Otherwise it's considered to be a string which is used
* to retrieve the controller constructor using the following steps:
*
* * check if a controller with given name is registered via `$controllerProvider`
* * check if evaluating the string on the current scope returns a constructor
* * check `window[constructor]` on the global `window` object
*
* @param {Object} locals Injection locals for Controller.
* @return {Object} Instance of given controller.
*
* @description
* `$controller` service is responsible for instantiating controllers.
*
* It's just simple call to {@link AUTO.$injector $injector}, but extracted into
* a service, so that one can override this service with {@link https://gist.github.com/1649788
* BC version}.
*/
return function(constructor, locals) {
if(isString(constructor)) {
var name = constructor;
constructor = controllers.hasOwnProperty(name)
? controllers[name]
: getter(locals.$scope, name, true) || getter($window, name, true);
assertArgFn(constructor, name, true);
}
return $injector.instantiate(constructor, locals);
};
}];
}
/**
* @ngdoc object
* @name ng.$document
* @requires $window
*
* @description
* A {@link angular.element jQuery (lite)}-wrapped reference to the browser's `window.document`
* element.
*/
function $DocumentProvider(){
this.$get = ['$window', function(window){
return jqLite(window.document);
}];
}
/**
* @ngdoc function
* @name ng.$exceptionHandler
* @requires $log
*
* @description
* Any uncaught exception in angular expressions is delegated to this service.
* The default implementation simply delegates to `$log.error` which logs it into
* the browser console.
*
* In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
* {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
*
* @param {Error} exception Exception associated with the error.
* @param {string=} cause optional information about the context in which
* the error was thrown.
*
*/
function $ExceptionHandlerProvider() {
this.$get = ['$log', function($log){
return function(exception, cause) {
$log.error.apply($log, arguments);
};
}];
}
/**
* @ngdoc object
* @name ng.$interpolateProvider
* @function
*
* @description
*
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
*/
function $InterpolateProvider() {
var startSymbol = '{{';
var endSymbol = '}}';
/**
* @ngdoc method
* @name ng.$interpolateProvider#startSymbol
* @methodOf ng.$interpolateProvider
* @description
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
*
* @param {string=} value new value to set the starting symbol to.
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
*/
this.startSymbol = function(value){
if (value) {
startSymbol = value;
return this;
} else {
return startSymbol;
}
};
/**
* @ngdoc method
* @name ng.$interpolateProvider#endSymbol
* @methodOf ng.$interpolateProvider
* @description
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
*
* @param {string=} value new value to set the ending symbol to.
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
*/
this.endSymbol = function(value){
if (value) {
endSymbol = value;
return this;
} else {
return endSymbol;
}
};
this.$get = ['$parse', function($parse) {
var startSymbolLength = startSymbol.length,
endSymbolLength = endSymbol.length;
/**
* @ngdoc function
* @name ng.$interpolate
* @function
*
* @requires $parse
*
* @description
*
* Compiles a string with markup into an interpolation function. This service is used by the
* HTML {@link ng.$compile $compile} service for data binding. See
* {@link ng.$interpolateProvider $interpolateProvider} for configuring the
* interpolation markup.
*
*
<pre>
var $interpolate = ...; // injected
var exp = $interpolate('Hello {{name}}!');
expect(exp({name:'Angular'}).toEqual('Hello Angular!');
</pre>
*
*
* @param {string} text The text with markup to interpolate.
* @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
* embedded expression in order to return an interpolation function. Strings with no
* embedded expression will return null for the interpolation function.
* @returns {function(context)} an interpolation function which is used to compute the interpolated
* string. The function has these parameters:
*
* * `context`: an object against which any expressions embedded in the strings are evaluated
* against.
*
*/
function $interpolate(text, mustHaveExpression) {
var startIndex,
endIndex,
index = 0,
parts = [],
length = text.length,
hasInterpolation = false,
fn,
exp,
concat = [];
while(index < length) {
if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) &&
((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) {
(index != startIndex) && parts.push(text.substring(index, startIndex));
parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex)));
fn.exp = exp;
index = endIndex + endSymbolLength;
hasInterpolation = true;
} else {
// we did not find anything, so we have to add the remainder to the parts array
(index != length) && parts.push(text.substring(index));
index = length;
}
}
if (!(length = parts.length)) {
// we added, nothing, must have been an empty string.
parts.push('');
length = 1;
}
if (!mustHaveExpression || hasInterpolation) {
concat.length = length;
fn = function(context) {
for(var i = 0, ii = length, part; i<ii; i++) {
if (typeof (part = parts[i]) == 'function') {
part = part(context);
if (part == null || part == undefined) {
part = '';
} else if (typeof part != 'string') {
part = toJson(part);
}
}
concat[i] = part;
}
return concat.join('');
};
fn.exp = text;
fn.parts = parts;
return fn;
}
}
/**
* @ngdoc method
* @name ng.$interpolate#startSymbol
* @methodOf ng.$interpolate
* @description
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
*
* Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change
* the symbol.
*
* @returns {string} start symbol.
*/
$interpolate.startSymbol = function() {
return startSymbol;
}
/**
* @ngdoc method
* @name ng.$interpolate#endSymbol
* @methodOf ng.$interpolate
* @description
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
*
* Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change
* the symbol.
*
* @returns {string} start symbol.
*/
$interpolate.endSymbol = function() {
return endSymbol;
}
return $interpolate;
}];
}
var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,
HASH_MATCH = PATH_MATCH,
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
/**
* Encode path using encodeUriSegment, ignoring forward slashes
*
* @param {string} path Path to encode
* @returns {string}
*/
function encodePath(path) {
var segments = path.split('/'),
i = segments.length;
while (i--) {
segments[i] = encodeUriSegment(segments[i]);
}
return segments.join('/');
}
function stripHash(url) {
return url.split('#')[0];
}
function matchUrl(url, obj) {
var match = URL_MATCH.exec(url);
match = {
protocol: match[1],
host: match[3],
port: int(match[5]) || DEFAULT_PORTS[match[1]] || null,
path: match[6] || '/',
search: match[8],
hash: match[10]
};
if (obj) {
obj.$$protocol = match.protocol;
obj.$$host = match.host;
obj.$$port = match.port;
}
return match;
}
function composeProtocolHostPort(protocol, host, port) {
return protocol + '://' + host + (port == DEFAULT_PORTS[protocol] ? '' : ':' + port);
}
function pathPrefixFromBase(basePath) {
return basePath.substr(0, basePath.lastIndexOf('/'));
}
function convertToHtml5Url(url, basePath, hashPrefix) {
var match = matchUrl(url);
// already html5 url
if (decodeURIComponent(match.path) != basePath || isUndefined(match.hash) ||
match.hash.indexOf(hashPrefix) !== 0) {
return url;
// convert hashbang url -> html5 url
} else {
return composeProtocolHostPort(match.protocol, match.host, match.port) +
pathPrefixFromBase(basePath) + match.hash.substr(hashPrefix.length);
}
}
function convertToHashbangUrl(url, basePath, hashPrefix) {
var match = matchUrl(url);
// already hashbang url
if (decodeURIComponent(match.path) == basePath) {
return url;
// convert html5 url -> hashbang url
} else {
var search = match.search && '?' + match.search || '',
hash = match.hash && '#' + match.hash || '',
pathPrefix = pathPrefixFromBase(basePath),
path = match.path.substr(pathPrefix.length);
if (match.path.indexOf(pathPrefix) !== 0) {
throw Error('Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !');
}
return composeProtocolHostPort(match.protocol, match.host, match.port) + basePath +
'#' + hashPrefix + path + search + hash;
}
}
/**
* LocationUrl represents an url
* This object is exposed as $location service when HTML5 mode is enabled and supported
*
* @constructor
* @param {string} url HTML5 url
* @param {string} pathPrefix
*/
function LocationUrl(url, pathPrefix, appBaseUrl) {
pathPrefix = pathPrefix || '';
/**
* Parse given html5 (regular) url string into properties
* @param {string} newAbsoluteUrl HTML5 url
* @private
*/
this.$$parse = function(newAbsoluteUrl) {
var match = matchUrl(newAbsoluteUrl, this);
if (match.path.indexOf(pathPrefix) !== 0) {
throw Error('Invalid url "' + newAbsoluteUrl + '", missing path prefix "' + pathPrefix + '" !');
}
this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length));
this.$$search = parseKeyValue(match.search);
this.$$hash = match.hash && decodeURIComponent(match.hash) || '';
this.$$compose();
};
/**
* Compose url and update `absUrl` property
* @private
*/
this.$$compose = function() {
var search = toKeyValue(this.$$search),
hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) +
pathPrefix + this.$$url;
};
this.$$rewriteAppUrl = function(absoluteLinkUrl) {
if(absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
return absoluteLinkUrl;
}
}
this.$$parse(url);
}
/**
* LocationHashbangUrl represents url
* This object is exposed as $location service when html5 history api is disabled or not supported
*
* @constructor
* @param {string} url Legacy url
* @param {string} hashPrefix Prefix for hash part (containing path and search)
*/
function LocationHashbangUrl(url, hashPrefix, appBaseUrl) {
var basePath;
/**
* Parse given hashbang url into properties
* @param {string} url Hashbang url
* @private
*/
this.$$parse = function(url) {
var match = matchUrl(url, this);
if (match.hash && match.hash.indexOf(hashPrefix) !== 0) {
throw Error('Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !');
}
basePath = match.path + (match.search ? '?' + match.search : '');
match = HASH_MATCH.exec((match.hash || '').substr(hashPrefix.length));
if (match[1]) {
this.$$path = (match[1].charAt(0) == '/' ? '' : '/') + decodeURIComponent(match[1]);
} else {
this.$$path = '';
}
this.$$search = parseKeyValue(match[3]);
this.$$hash = match[5] && decodeURIComponent(match[5]) || '';
this.$$compose();
};
/**
* Compose hashbang url and update `absUrl` property
* @private
*/
this.$$compose = function() {
var search = toKeyValue(this.$$search),
hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) +
basePath + (this.$$url ? '#' + hashPrefix + this.$$url : '');
};
this.$$rewriteAppUrl = function(absoluteLinkUrl) {
if(absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
return absoluteLinkUrl;
}
}
this.$$parse(url);
}
LocationUrl.prototype = {
/**
* Has any change been replacing ?
* @private
*/
$$replace: false,
/**
* @ngdoc method
* @name ng.$location#absUrl
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return full url representation with all segments encoded according to rules specified in
* {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}.
*
* @return {string} full url
*/
absUrl: locationGetter('$$absUrl'),
/**
* @ngdoc method
* @name ng.$location#url
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return url (e.g. `/path?a=b#hash`) when called without any parameter.
*
* Change path, search and hash, when called with parameter and return `$location`.
*
* @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
* @return {string} url
*/
url: function(url, replace) {
if (isUndefined(url))
return this.$$url;
var match = PATH_MATCH.exec(url);
if (match[1]) this.path(decodeURIComponent(match[1]));
if (match[2] || match[1]) this.search(match[3] || '');
this.hash(match[5] || '', replace);
return this;
},
/**
* @ngdoc method
* @name ng.$location#protocol
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return protocol of current url.
*
* @return {string} protocol of current url
*/
protocol: locationGetter('$$protocol'),
/**
* @ngdoc method
* @name ng.$location#host
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return host of current url.
*
* @return {string} host of current url.
*/
host: locationGetter('$$host'),
/**
* @ngdoc method
* @name ng.$location#port
* @methodOf ng.$location
*
* @description
* This method is getter only.
*
* Return port of current url.
*
* @return {Number} port
*/
port: locationGetter('$$port'),
/**
* @ngdoc method
* @name ng.$location#path
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return path of current url when called without any parameter.
*
* Change path when called with parameter and return `$location`.
*
* Note: Path should always begin with forward slash (/), this method will add the forward slash
* if it is missing.
*
* @param {string=} path New path
* @return {string} path
*/
path: locationGetterSetter('$$path', function(path) {
return path.charAt(0) == '/' ? path : '/' + path;
}),
/**
* @ngdoc method
* @name ng.$location#search
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return search part (as object) of current url when called without any parameter.
*
* Change search part when called with parameter and return `$location`.
*
* @param {string|object<string,string>=} search New search params - string or hash object
* @param {string=} paramValue If `search` is a string, then `paramValue` will override only a
* single search parameter. If the value is `null`, the parameter will be deleted.
*
* @return {string} search
*/
search: function(search, paramValue) {
if (isUndefined(search))
return this.$$search;
if (isDefined(paramValue)) {
if (paramValue === null) {
delete this.$$search[search];
} else {
this.$$search[search] = paramValue;
}
} else {
this.$$search = isString(search) ? parseKeyValue(search) : search;
}
this.$$compose();
return this;
},
/**
* @ngdoc method
* @name ng.$location#hash
* @methodOf ng.$location
*
* @description
* This method is getter / setter.
*
* Return hash fragment when called without any parameter.
*
* Change hash fragment when called with parameter and return `$location`.
*
* @param {string=} hash New hash fragment
* @return {string} hash
*/
hash: locationGetterSetter('$$hash', identity),
/**
* @ngdoc method
* @name ng.$location#replace
* @methodOf ng.$location
*
* @description
* If called, all changes to $location during current `$digest` will be replacing current history
* record, instead of adding new one.
*/
replace: function() {
this.$$replace = true;
return this;
}
};
LocationHashbangUrl.prototype = inherit(LocationUrl.prototype);
function LocationHashbangInHtml5Url(url, hashPrefix, appBaseUrl, baseExtra) {
LocationHashbangUrl.apply(this, arguments);
this.$$rewriteAppUrl = function(absoluteLinkUrl) {
if (absoluteLinkUrl.indexOf(appBaseUrl) == 0) {
return appBaseUrl + baseExtra + '#' + hashPrefix + absoluteLinkUrl.substr(appBaseUrl.length);
}
}
}
LocationHashbangInHtml5Url.prototype = inherit(LocationHashbangUrl.prototype);
function locationGetter(property) {
return function() {
return this[property];
};
}
function locationGetterSetter(property, preprocess) {
return function(value) {
if (isUndefined(value))
return this[property];
this[property] = preprocess(value);
this.$$compose();
return this;
};
}
/**
* @ngdoc object
* @name ng.$location
*
* @requires $browser
* @requires $sniffer
* @requires $rootElement
*
* @description
* The $location service parses the URL in the browser address bar (based on the
* {@link https://developer.mozilla.org/en/window.location window.location}) and makes the URL
* available to your application. Changes to the URL in the address bar are reflected into
* $location service and changes to $location are reflected into the browser address bar.
*
* **The $location service:**
*
* - Exposes the current URL in the browser address bar, so you can
* - Watch and observe the URL.
* - Change the URL.
* - Synchronizes the URL with the browser when the user
* - Changes the address bar.
* - Clicks the back or forward button (or clicks a History link).
* - Clicks on a link.
* - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
*
* For more information see {@link guide/dev_guide.services.$location Developer Guide: Angular
* Services: Using $location}
*/
/**
* @ngdoc object
* @name ng.$locationProvider
* @description
* Use the `$locationProvider` to configure how the application deep linking paths are stored.
*/
function $LocationProvider(){
var hashPrefix = '',
html5Mode = false;
/**
* @ngdoc property
* @name ng.$locationProvider#hashPrefix
* @methodOf ng.$locationProvider
* @description
* @param {string=} prefix Prefix for hash part (containing path and search)
* @returns {*} current value if used as getter or itself (chaining) if used as setter
*/
this.hashPrefix = function(prefix) {
if (isDefined(prefix)) {
hashPrefix = prefix;
return this;
} else {
return hashPrefix;
}
};
/**
* @ngdoc property
* @name ng.$locationProvider#html5Mode
* @methodOf ng.$locationProvider
* @description
* @param {string=} mode Use HTML5 strategy if available.
* @returns {*} current value if used as getter or itself (chaining) if used as setter
*/
this.html5Mode = function(mode) {
if (isDefined(mode)) {
html5Mode = mode;
return this;
} else {
return html5Mode;
}
};
this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement',
function( $rootScope, $browser, $sniffer, $rootElement) {
var $location,
basePath,
pathPrefix,
initUrl = $browser.url(),
initUrlParts = matchUrl(initUrl),
appBaseUrl;
if (html5Mode) {
basePath = $browser.baseHref() || '/';
pathPrefix = pathPrefixFromBase(basePath);
appBaseUrl =
composeProtocolHostPort(initUrlParts.protocol, initUrlParts.host, initUrlParts.port) +
pathPrefix + '/';
if ($sniffer.history) {
$location = new LocationUrl(
convertToHtml5Url(initUrl, basePath, hashPrefix),
pathPrefix, appBaseUrl);
} else {
$location = new LocationHashbangInHtml5Url(
convertToHashbangUrl(initUrl, basePath, hashPrefix),
hashPrefix, appBaseUrl, basePath.substr(pathPrefix.length + 1));
}
} else {
appBaseUrl =
composeProtocolHostPort(initUrlParts.protocol, initUrlParts.host, initUrlParts.port) +
(initUrlParts.path || '') +
(initUrlParts.search ? ('?' + initUrlParts.search) : '') +
'#' + hashPrefix + '/';
$location = new LocationHashbangUrl(initUrl, hashPrefix, appBaseUrl);
}
$rootElement.bind('click', function(event) {
// TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
// currently we open nice url link and redirect then
if (event.ctrlKey || event.metaKey || event.which == 2) return;
var elm = jqLite(event.target);
// traverse the DOM up to find first A tag
while (lowercase(elm[0].nodeName) !== 'a') {
// ignore rewriting if no A tag (reached root element, or no parent - removed from document)
if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
}
var absHref = elm.prop('href'),
rewrittenUrl = $location.$$rewriteAppUrl(absHref);
if (absHref && !elm.attr('target') && rewrittenUrl) {
// update location manually
$location.$$parse(rewrittenUrl);
$rootScope.$apply();
event.preventDefault();
// hack to work around FF6 bug 684208 when scenario runner clicks on links
window.angular['ff-684208-preventDefault'] = true;
}
});
// rewrite hashbang url <> html5 url
if ($location.absUrl() != initUrl) {
$browser.url($location.absUrl(), true);
}
// update $location when $browser url changes
$browser.onUrlChange(function(newUrl) {
if ($location.absUrl() != newUrl) {
$rootScope.$evalAsync(function() {
var oldUrl = $location.absUrl();
$location.$$parse(newUrl);
afterLocationChange(oldUrl);
});
if (!$rootScope.$$phase) $rootScope.$digest();
}
});
// update browser
var changeCounter = 0;
$rootScope.$watch(function $locationWatch() {
var oldUrl = $browser.url();
var currentReplace = $location.$$replace;
if (!changeCounter || oldUrl != $location.absUrl()) {
changeCounter++;
$rootScope.$evalAsync(function() {
if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl).
defaultPrevented) {
$location.$$parse(oldUrl);
} else {
$browser.url($location.absUrl(), currentReplace);
afterLocationChange(oldUrl);
}
});
}
$location.$$replace = false;
return changeCounter;
});
return $location;
function afterLocationChange(oldUrl) {
$rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl);
}
}];
}
/**
* @ngdoc object
* @name ng.$log
* @requires $window
*
* @description
* Simple service for logging. Default implementation writes the message
* into the browser's console (if present).
*
* The main purpose of this service is to simplify debugging and troubleshooting.
*
* @example
<example>
<file name="script.js">
function LogCtrl($scope, $log) {
$scope.$log = $log;
$scope.message = 'Hello World!';
}
</file>
<file name="index.html">
<div ng-controller="LogCtrl">
<p>Reload this page with open console, enter text and hit the log button...</p>
Message:
<input type="text" ng-model="message"/>
<button ng-click="$log.log(message)">log</button>
<button ng-click="$log.warn(message)">warn</button>
<button ng-click="$log.info(message)">info</button>
<button ng-click="$log.error(message)">error</button>
</div>
</file>
</example>
*/
function $LogProvider(){
this.$get = ['$window', function($window){
return {
/**
* @ngdoc method
* @name ng.$log#log
* @methodOf ng.$log
*
* @description
* Write a log message
*/
log: consoleLog('log'),
/**
* @ngdoc method
* @name ng.$log#warn
* @methodOf ng.$log
*
* @description
* Write a warning message
*/
warn: consoleLog('warn'),
/**
* @ngdoc method
* @name ng.$log#info
* @methodOf ng.$log
*
* @description
* Write an information message
*/
info: consoleLog('info'),
/**
* @ngdoc method
* @name ng.$log#error
* @methodOf ng.$log
*
* @description
* Write an error message
*/
error: consoleLog('error')
};
function formatError(arg) {
if (arg instanceof Error) {
if (arg.stack) {
arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
? 'Error: ' + arg.message + '\n' + arg.stack
: arg.stack;
} else if (arg.sourceURL) {
arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
}
}
return arg;
}
function consoleLog(type) {
var console = $window.console || {},
logFn = console[type] || console.log || noop;
if (logFn.apply) {
return function() {
var args = [];
forEach(arguments, function(arg) {
args.push(formatError(arg));
});
return logFn.apply(console, args);
};
}
// we are IE which either doesn't have window.console => this is noop and we do nothing,
// or we are IE where console.log doesn't have apply so we log at least first 2 args
return function(arg1, arg2) {
logFn(arg1, arg2);
}
}
}];
}
var OPERATORS = {
'null':function(){return null;},
'true':function(){return true;},
'false':function(){return false;},
undefined:noop,
'+':function(self, locals, a,b){
a=a(self, locals); b=b(self, locals);
if (isDefined(a)) {
if (isDefined(b)) {
return a + b;
}
return a;
}
return isDefined(b)?b:undefined;},
'-':function(self, locals, a,b){a=a(self, locals); b=b(self, locals); return (isDefined(a)?a:0)-(isDefined(b)?b:0);},
'*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},
'/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},
'%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},
'^':function(self, locals, a,b){return a(self, locals)^b(self, locals);},
'=':noop,
'==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},
'!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},
'<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},
'>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},
'<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},
'>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},
'&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},
'||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},
'&':function(self, locals, a,b){return a(self, locals)&b(self, locals);},
// '|':function(self, locals, a,b){return a|b;},
'|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));},
'!':function(self, locals, a){return !a(self, locals);}
};
var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
function lex(text, csp){
var tokens = [],
token,
index = 0,
json = [],
ch,
lastCh = ':'; // can start regexp
while (index < text.length) {
ch = text.charAt(index);
if (is('"\'')) {
readString(ch);
} else if (isNumber(ch) || is('.') && isNumber(peek())) {
readNumber();
} else if (isIdent(ch)) {
readIdent();
// identifiers can only be if the preceding char was a { or ,
if (was('{,') && json[0]=='{' &&
(token=tokens[tokens.length-1])) {
token.json = token.text.indexOf('.') == -1;
}
} else if (is('(){}[].,;:')) {
tokens.push({
index:index,
text:ch,
json:(was(':[,') && is('{[')) || is('}]:,')
});
if (is('{[')) json.unshift(ch);
if (is('}]')) json.shift();
index++;
} else if (isWhitespace(ch)) {
index++;
continue;
} else {
var ch2 = ch + peek(),
fn = OPERATORS[ch],
fn2 = OPERATORS[ch2];
if (fn2) {
tokens.push({index:index, text:ch2, fn:fn2});
index += 2;
} else if (fn) {
tokens.push({index:index, text:ch, fn:fn, json: was('[,:') && is('+-')});
index += 1;
} else {
throwError("Unexpected next character ", index, index+1);
}
}
lastCh = ch;
}
return tokens;
function is(chars) {
return chars.indexOf(ch) != -1;
}
function was(chars) {
return chars.indexOf(lastCh) != -1;
}
function peek() {
return index + 1 < text.length ? text.charAt(index + 1) : false;
}
function isNumber(ch) {
return '0' <= ch && ch <= '9';
}
function isWhitespace(ch) {
return ch == ' ' || ch == '\r' || ch == '\t' ||
ch == '\n' || ch == '\v' || ch == '\u00A0'; // IE treats non-breaking space as \u00A0
}
function isIdent(ch) {
return 'a' <= ch && ch <= 'z' ||
'A' <= ch && ch <= 'Z' ||
'_' == ch || ch == '$';
}
function isExpOperator(ch) {
return ch == '-' || ch == '+' || isNumber(ch);
}
function throwError(error, start, end) {
end = end || index;
throw Error("Lexer Error: " + error + " at column" +
(isDefined(start)
? "s " + start + "-" + index + " [" + text.substring(start, end) + "]"
: " " + end) +
" in expression [" + text + "].");
}
function readNumber() {
var number = "";
var start = index;
while (index < text.length) {
var ch = lowercase(text.charAt(index));
if (ch == '.' || isNumber(ch)) {
number += ch;
} else {
var peekCh = peek();
if (ch == 'e' && isExpOperator(peekCh)) {
number += ch;
} else if (isExpOperator(ch) &&
peekCh && isNumber(peekCh) &&
number.charAt(number.length - 1) == 'e') {
number += ch;
} else if (isExpOperator(ch) &&
(!peekCh || !isNumber(peekCh)) &&
number.charAt(number.length - 1) == 'e') {
throwError('Invalid exponent');
} else {
break;
}
}
index++;
}
number = 1 * number;
tokens.push({index:start, text:number, json:true,
fn:function() {return number;}});
}
function readIdent() {
var ident = "",
start = index,
lastDot, peekIndex, methodName;
while (index < text.length) {
var ch = text.charAt(index);
if (ch == '.' || isIdent(ch) || isNumber(ch)) {
if (ch == '.') lastDot = index;
ident += ch;
} else {
break;
}
index++;
}
//check if this is not a method invocation and if it is back out to last dot
if (lastDot) {
peekIndex = index;
while(peekIndex < text.length) {
var ch = text.charAt(peekIndex);
if (ch == '(') {
methodName = ident.substr(lastDot - start + 1);
ident = ident.substr(0, lastDot - start);
index = peekIndex;
break;
}
if(isWhitespace(ch)) {
peekIndex++;
} else {
break;
}
}
}
var token = {
index:start,
text:ident
};
if (OPERATORS.hasOwnProperty(ident)) {
token.fn = token.json = OPERATORS[ident];
} else {
var getter = getterFn(ident, csp);
token.fn = extend(function(self, locals) {
return (getter(self, locals));
}, {
assign: function(self, value) {
return setter(self, ident, value);
}
});
}
tokens.push(token);
if (methodName) {
tokens.push({
index:lastDot,
text: '.',
json: false
});
tokens.push({
index: lastDot + 1,
text: methodName,
json: false
});
}
}
function readString(quote) {
var start = index;
index++;
var string = "";
var rawString = quote;
var escape = false;
while (index < text.length) {
var ch = text.charAt(index);
rawString += ch;
if (escape) {
if (ch == 'u') {
var hex = text.substring(index + 1, index + 5);
if (!hex.match(/[\da-f]{4}/i))
throwError( "Invalid unicode escape [\\u" + hex + "]");
index += 4;
string += String.fromCharCode(parseInt(hex, 16));
} else {
var rep = ESCAPE[ch];
if (rep) {
string += rep;
} else {
string += ch;
}
}
escape = false;
} else if (ch == '\\') {
escape = true;
} else if (ch == quote) {
index++;
tokens.push({
index:start,
text:rawString,
string:string,
json:true,
fn:function() { return string; }
});
return;
} else {
string += ch;
}
index++;
}
throwError("Unterminated quote", start);
}
}
/////////////////////////////////////////
function parser(text, json, $filter, csp){
var ZERO = valueFn(0),
value,
tokens = lex(text, csp),
assignment = _assignment,
functionCall = _functionCall,
fieldAccess = _fieldAccess,
objectIndex = _objectIndex,
filterChain = _filterChain;
if(json){
// The extra level of aliasing is here, just in case the lexer misses something, so that
// we prevent any accidental execution in JSON.
assignment = logicalOR;
functionCall =
fieldAccess =
objectIndex =
filterChain =
function() { throwError("is not valid json", {text:text, index:0}); };
value = primary();
} else {
value = statements();
}
if (tokens.length !== 0) {
throwError("is an unexpected token", tokens[0]);
}
return value;
///////////////////////////////////
function throwError(msg, token) {
throw Error("Syntax Error: Token '" + token.text +
"' " + msg + " at column " +
(token.index + 1) + " of the expression [" +
text + "] starting at [" + text.substring(token.index) + "].");
}
function peekToken() {
if (tokens.length === 0)
throw Error("Unexpected end of expression: " + text);
return tokens[0];
}
function peek(e1, e2, e3, e4) {
if (tokens.length > 0) {
var token = tokens[0];
var t = token.text;
if (t==e1 || t==e2 || t==e3 || t==e4 ||
(!e1 && !e2 && !e3 && !e4)) {
return token;
}
}
return false;
}
function expect(e1, e2, e3, e4){
var token = peek(e1, e2, e3, e4);
if (token) {
if (json && !token.json) {
throwError("is not valid json", token);
}
tokens.shift();
return token;
}
return false;
}
function consume(e1){
if (!expect(e1)) {
throwError("is unexpected, expecting [" + e1 + "]", peek());
}
}
function unaryFn(fn, right) {
return function(self, locals) {
return fn(self, locals, right);
};
}
function binaryFn(left, fn, right) {
return function(self, locals) {
return fn(self, locals, left, right);
};
}
function statements() {
var statements = [];
while(true) {
if (tokens.length > 0 && !peek('}', ')', ';', ']'))
statements.push(filterChain());
if (!expect(';')) {
// optimize for the common case where there is only one statement.
// TODO(size): maybe we should not support multiple statements?
return statements.length == 1
? statements[0]
: function(self, locals){
var value;
for ( var i = 0; i < statements.length; i++) {
var statement = statements[i];
if (statement)
value = statement(self, locals);
}
return value;
};
}
}
}
function _filterChain() {
var left = expression();
var token;
while(true) {
if ((token = expect('|'))) {
left = binaryFn(left, token.fn, filter());
} else {
return left;
}
}
}
function filter() {
var token = expect();
var fn = $filter(token.text);
var argsFn = [];
while(true) {
if ((token = expect(':'))) {
argsFn.push(expression());
} else {
var fnInvoke = function(self, locals, input){
var args = [input];
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](self, locals));
}
return fn.apply(self, args);
};
return function() {
return fnInvoke;
};
}
}
}
function expression() {
return assignment();
}
function _assignment() {
var left = logicalOR();
var right;
var token;
if ((token = expect('='))) {
if (!left.assign) {
throwError("implies assignment but [" +
text.substring(0, token.index) + "] can not be assigned to", token);
}
right = logicalOR();
return function(self, locals){
return left.assign(self, right(self, locals), locals);
};
} else {
return left;
}
}
function logicalOR() {
var left = logicalAND();
var token;
while(true) {
if ((token = expect('||'))) {
left = binaryFn(left, token.fn, logicalAND());
} else {
return left;
}
}
}
function logicalAND() {
var left = equality();
var token;
if ((token = expect('&&'))) {
left = binaryFn(left, token.fn, logicalAND());
}
return left;
}
function equality() {
var left = relational();
var token;
if ((token = expect('==','!='))) {
left = binaryFn(left, token.fn, equality());
}
return left;
}
function relational() {
var left = additive();
var token;
if ((token = expect('<', '>', '<=', '>='))) {
left = binaryFn(left, token.fn, relational());
}
return left;
}
function additive() {
var left = multiplicative();
var token;
while ((token = expect('+','-'))) {
left = binaryFn(left, token.fn, multiplicative());
}
return left;
}
function multiplicative() {
var left = unary();
var token;
while ((token = expect('*','/','%'))) {
left = binaryFn(left, token.fn, unary());
}
return left;
}
function unary() {
var token;
if (expect('+')) {
return primary();
} else if ((token = expect('-'))) {
return binaryFn(ZERO, token.fn, unary());
} else if ((token = expect('!'))) {
return unaryFn(token.fn, unary());
} else {
return primary();
}
}
function primary() {
var primary;
if (expect('(')) {
primary = filterChain();
consume(')');
} else if (expect('[')) {
primary = arrayDeclaration();
} else if (expect('{')) {
primary = object();
} else {
var token = expect();
primary = token.fn;
if (!primary) {
throwError("not a primary expression", token);
}
}
var next, context;
while ((next = expect('(', '[', '.'))) {
if (next.text === '(') {
primary = functionCall(primary, context);
context = null;
} else if (next.text === '[') {
context = primary;
primary = objectIndex(primary);
} else if (next.text === '.') {
context = primary;
primary = fieldAccess(primary);
} else {
throwError("IMPOSSIBLE");
}
}
return primary;
}
function _fieldAccess(object) {
var field = expect().text;
var getter = getterFn(field, csp);
return extend(
function(self, locals) {
return getter(object(self, locals), locals);
},
{
assign:function(self, value, locals) {
return setter(object(self, locals), field, value);
}
}
);
}
function _objectIndex(obj) {
var indexFn = expression();
consume(']');
return extend(
function(self, locals){
var o = obj(self, locals),
i = indexFn(self, locals),
v, p;
if (!o) return undefined;
v = o[i];
if (v && v.then) {
p = v;
if (!('$$v' in v)) {
p.$$v = undefined;
p.then(function(val) { p.$$v = val; });
}
v = v.$$v;
}
return v;
}, {
assign:function(self, value, locals){
return obj(self, locals)[indexFn(self, locals)] = value;
}
});
}
function _functionCall(fn, contextGetter) {
var argsFn = [];
if (peekToken().text != ')') {
do {
argsFn.push(expression());
} while (expect(','));
}
consume(')');
return function(self, locals){
var args = [],
context = contextGetter ? contextGetter(self, locals) : self;
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](self, locals));
}
var fnPtr = fn(self, locals) || noop;
// IE stupidity!
return fnPtr.apply
? fnPtr.apply(context, args)
: fnPtr(args[0], args[1], args[2], args[3], args[4]);
};
}
// This is used with json array declaration
function arrayDeclaration () {
var elementFns = [];
if (peekToken().text != ']') {
do {
elementFns.push(expression());
} while (expect(','));
}
consume(']');
return function(self, locals){
var array = [];
for ( var i = 0; i < elementFns.length; i++) {
array.push(elementFns[i](self, locals));
}
return array;
};
}
function object () {
var keyValues = [];
if (peekToken().text != '}') {
do {
var token = expect(),
key = token.string || token.text;
consume(":");
var value = expression();
keyValues.push({key:key, value:value});
} while (expect(','));
}
consume('}');
return function(self, locals){
var object = {};
for ( var i = 0; i < keyValues.length; i++) {
var keyValue = keyValues[i];
var value = keyValue.value(self, locals);
object[keyValue.key] = value;
}
return object;
};
}
}
//////////////////////////////////////////////////
// Parser helper functions
//////////////////////////////////////////////////
function setter(obj, path, setValue) {
var element = path.split('.');
for (var i = 0; element.length > 1; i++) {
var key = element.shift();
var propertyObj = obj[key];
if (!propertyObj) {
propertyObj = {};
obj[key] = propertyObj;
}
obj = propertyObj;
}
obj[element.shift()] = setValue;
return setValue;
}
/**
* Return the value accesible from the object by path. Any undefined traversals are ignored
* @param {Object} obj starting object
* @param {string} path path to traverse
* @param {boolean=true} bindFnToScope
* @returns value as accesbile by path
*/
//TODO(misko): this function needs to be removed
function getter(obj, path, bindFnToScope) {
if (!path) return obj;
var keys = path.split('.');
var key;
var lastInstance = obj;
var len = keys.length;
for (var i = 0; i < len; i++) {
key = keys[i];
if (obj) {
obj = (lastInstance = obj)[key];
}
}
if (!bindFnToScope && isFunction(obj)) {
return bind(lastInstance, obj);
}
return obj;
}
var getterFnCache = {};
/**
* Implementation of the "Black Hole" variant from:
* - http://jsperf.com/angularjs-parse-getter/4
* - http://jsperf.com/path-evaluation-simplified/7
*/
function cspSafeGetterFn(key0, key1, key2, key3, key4) {
return function(scope, locals) {
var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope,
promise;
if (pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key0];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key1 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key1];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key2 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key2];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key3 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key3];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
if (!key4 || pathVal === null || pathVal === undefined) return pathVal;
pathVal = pathVal[key4];
if (pathVal && pathVal.then) {
if (!("$$v" in pathVal)) {
promise = pathVal;
promise.$$v = undefined;
promise.then(function(val) { promise.$$v = val; });
}
pathVal = pathVal.$$v;
}
return pathVal;
};
};
function getterFn(path, csp) {
if (getterFnCache.hasOwnProperty(path)) {
return getterFnCache[path];
}
var pathKeys = path.split('.'),
pathKeysLength = pathKeys.length,
fn;
if (csp) {
fn = (pathKeysLength < 6)
? cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4])
: function(scope, locals) {
var i = 0, val
do {
val = cspSafeGetterFn(
pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++]
)(scope, locals);
locals = undefined; // clear after first iteration
scope = val;
} while (i < pathKeysLength);
return val;
}
} else {
var code = 'var l, fn, p;\n';
forEach(pathKeys, function(key, index) {
code += 'if(s === null || s === undefined) return s;\n' +
'l=s;\n' +
's='+ (index
// we simply dereference 's' on any .dot notation
? 's'
// but if we are first then we check locals first, and if so read it first
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
'if (s && s.then) {\n' +
' if (!("$$v" in s)) {\n' +
' p=s;\n' +
' p.$$v = undefined;\n' +
' p.then(function(v) {p.$$v=v;});\n' +
'}\n' +
' s=s.$$v\n' +
'}\n';
});
code += 'return s;';
fn = Function('s', 'k', code); // s=scope, k=locals
fn.toString = function() { return code; };
}
return getterFnCache[path] = fn;
}
///////////////////////////////////
/**
* @ngdoc function
* @name ng.$parse
* @function
*
* @description
*
* Converts Angular {@link guide/expression expression} into a function.
*
* <pre>
* var getter = $parse('user.name');
* var setter = getter.assign;
* var context = {user:{name:'angular'}};
* var locals = {user:{name:'local'}};
*
* expect(getter(context)).toEqual('angular');
* setter(context, 'newValue');
* expect(context.user.name).toEqual('newValue');
* expect(getter(context, locals)).toEqual('local');
* </pre>
*
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
*
* * `context`: an object against which any expressions embedded in the strings are evaluated
* against (Topically a scope object).
* * `locals`: local variables context object, useful for overriding values in `context`.
*
* The return function also has an `assign` property, if the expression is assignable, which
* allows one to set values to expressions.
*
*/
function $ParseProvider() {
var cache = {};
this.$get = ['$filter', '$sniffer', function($filter, $sniffer) {
return function(exp) {
switch(typeof exp) {
case 'string':
return cache.hasOwnProperty(exp)
? cache[exp]
: cache[exp] = parser(exp, false, $filter, $sniffer.csp);
case 'function':
return exp;
default:
return noop;
}
};
}];
}
/**
* @ngdoc service
* @name ng.$q
* @requires $rootScope
*
* @description
* A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
*
* [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
* interface for interacting with an object that represents the result of an action that is
* performed asynchronously, and may or may not be finished at any given point in time.
*
* From the perspective of dealing with error handling, deferred and promise apis are to
* asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
*
* <pre>
* // for the purpose of this example let's assume that variables `$q` and `scope` are
* // available in the current lexical scope (they could have been injected or passed in).
*
* function asyncGreet(name) {
* var deferred = $q.defer();
*
* setTimeout(function() {
* // since this fn executes async in a future turn of the event loop, we need to wrap
* // our code into an $apply call so that the model changes are properly observed.
* scope.$apply(function() {
* if (okToGreet(name)) {
* deferred.resolve('Hello, ' + name + '!');
* } else {
* deferred.reject('Greeting ' + name + ' is not allowed.');
* }
* });
* }, 1000);
*
* return deferred.promise;
* }
*
* var promise = asyncGreet('Robin Hood');
* promise.then(function(greeting) {
* alert('Success: ' + greeting);
* }, function(reason) {
* alert('Failed: ' + reason);
* });
* </pre>
*
* At first it might not be obvious why this extra complexity is worth the trouble. The payoff
* comes in the way of
* [guarantees that promise and deferred apis make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md).
*
* Additionally the promise api allows for composition that is very hard to do with the
* traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
* For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
* section on serial or parallel joining of promises.
*
*
* # The Deferred API
*
* A new instance of deferred is constructed by calling `$q.defer()`.
*
* The purpose of the deferred object is to expose the associated Promise instance as well as apis
* that can be used for signaling the successful or unsuccessful completion of the task.
*
* **Methods**
*
* - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
* constructed via `$q.reject`, the promise will be rejected instead.
* - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
* resolving it with a rejection constructed via `$q.reject`.
*
* **Properties**
*
* - promise – `{Promise}` – promise object associated with this deferred.
*
*
* # The Promise API
*
* A new promise instance is created when a deferred instance is created and can be retrieved by
* calling `deferred.promise`.
*
* The purpose of the promise object is to allow for interested parties to get access to the result
* of the deferred task when it completes.
*
* **Methods**
*
* - `then(successCallback, errorCallback)` – regardless of when the promise was or will be resolved
* or rejected calls one of the success or error callbacks asynchronously as soon as the result
* is available. The callbacks are called with a single argument the result or rejection reason.
*
* This method *returns a new promise* which is resolved or rejected via the return value of the
* `successCallback` or `errorCallback`.
*
*
* # Chaining promises
*
* Because calling `then` api of a promise returns a new derived promise, it is easily possible
* to create a chain of promises:
*
* <pre>
* promiseB = promiseA.then(function(result) {
* return result + 1;
* });
*
* // promiseB will be resolved immediately after promiseA is resolved and it's value will be
* // the result of promiseA incremented by 1
* </pre>
*
* It is possible to create chains of any length and since a promise can be resolved with another
* promise (which will defer its resolution further), it is possible to pause/defer resolution of
* the promises at any point in the chain. This makes it possible to implement powerful apis like
* $http's response interceptors.
*
*
* # Differences between Kris Kowal's Q and $q
*
* There are three main differences:
*
* - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
* mechanism in angular, which means faster propagation of resolution or rejection into your
* models and avoiding unnecessary browser repaints, which would result in flickering UI.
* - $q promises are recognized by the templating engine in angular, which means that in templates
* you can treat promises attached to a scope as if they were the resulting values.
* - Q has many more features that $q, but that comes at a cost of bytes. $q is tiny, but contains
* all the important functionality needed for common async tasks.
*
* # Testing
*
* <pre>
* it('should simulate promise', inject(function($q, $rootSCope) {
* var deferred = $q.defer();
* var promise = deferred.promise;
* var resolvedValue;
*
* promise.then(function(value) { resolvedValue = value; });
* expect(resolvedValue).toBeUndefined();
*
* // Simulate resolving of promise
* defered.resolve(123);
* // Note that the 'then' function does not get called synchronously.
* // This is because we want the promise API to always be async, whether or not
* // it got called synchronously or asynchronously.
* expect(resolvedValue).toBeUndefined();
*
* // Propagate promise resolution to 'then' functions using $apply().
* $rootScope.$apply();
* expect(resolvedValue).toEqual(123);
* });
* </pre>
*/
function $QProvider() {
this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
return qFactory(function(callback) {
$rootScope.$evalAsync(callback);
}, $exceptionHandler);
}];
}
/**
* Constructs a promise manager.
*
* @param {function(function)} nextTick Function for executing functions in the next turn.
* @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
* debugging purposes.
* @returns {object} Promise manager.
*/
function qFactory(nextTick, exceptionHandler) {
/**
* @ngdoc
* @name ng.$q#defer
* @methodOf ng.$q
* @description
* Creates a `Deferred` object which represents a task which will finish in the future.
*
* @returns {Deferred} Returns a new instance of deferred.
*/
var defer = function() {
var pending = [],
value, deferred;
deferred = {
resolve: function(val) {
if (pending) {
var callbacks = pending;
pending = undefined;
value = ref(val);
if (callbacks.length) {
nextTick(function() {
var callback;
for (var i = 0, ii = callbacks.length; i < ii; i++) {
callback = callbacks[i];
value.then(callback[0], callback[1]);
}
});
}
}
},
reject: function(reason) {
deferred.resolve(reject(reason));
},
promise: {
then: function(callback, errback) {
var result = defer();
var wrappedCallback = function(value) {
try {
result.resolve((callback || defaultCallback)(value));
} catch(e) {
exceptionHandler(e);
result.reject(e);
}
};
var wrappedErrback = function(reason) {
try {
result.resolve((errback || defaultErrback)(reason));
} catch(e) {
exceptionHandler(e);
result.reject(e);
}
};
if (pending) {
pending.push([wrappedCallback, wrappedErrback]);
} else {
value.then(wrappedCallback, wrappedErrback);
}
return result.promise;
}
}
};
return deferred;
};
var ref = function(value) {
if (value && value.then) return value;
return {
then: function(callback) {
var result = defer();
nextTick(function() {
result.resolve(callback(value));
});
return result.promise;
}
};
};
/**
* @ngdoc
* @name ng.$q#reject
* @methodOf ng.$q
* @description
* Creates a promise that is resolved as rejected with the specified `reason`. This api should be
* used to forward rejection in a chain of promises. If you are dealing with the last promise in
* a promise chain, you don't need to worry about it.
*
* When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
* `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
* a promise error callback and you want to forward the error to the promise derived from the
* current promise, you have to "rethrow" the error by returning a rejection constructed via
* `reject`.
*
* <pre>
* promiseB = promiseA.then(function(result) {
* // success: do something and resolve promiseB
* // with the old or a new result
* return result;
* }, function(reason) {
* // error: handle the error if possible and
* // resolve promiseB with newPromiseOrValue,
* // otherwise forward the rejection to promiseB
* if (canHandle(reason)) {
* // handle the error and recover
* return newPromiseOrValue;
* }
* return $q.reject(reason);
* });
* </pre>
*
* @param {*} reason Constant, message, exception or an object representing the rejection reason.
* @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
*/
var reject = function(reason) {
return {
then: function(callback, errback) {
var result = defer();
nextTick(function() {
result.resolve((errback || defaultErrback)(reason));
});
return result.promise;
}
};
};
/**
* @ngdoc
* @name ng.$q#when
* @methodOf ng.$q
* @description
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
* This is useful when you are dealing with on object that might or might not be a promise, or if
* the promise comes from a source that can't be trusted.
*
* @param {*} value Value or a promise
* @returns {Promise} Returns a single promise that will be resolved with an array of values,
* each value coresponding to the promise at the same index in the `promises` array. If any of
* the promises is resolved with a rejection, this resulting promise will be resolved with the
* same rejection.
*/
var when = function(value, callback, errback) {
var result = defer(),
done;
var wrappedCallback = function(value) {
try {
return (callback || defaultCallback)(value);
} catch (e) {
exceptionHandler(e);
return reject(e);
}
};
var wrappedErrback = function(reason) {
try {
return (errback || defaultErrback)(reason);
} catch (e) {
exceptionHandler(e);
return reject(e);
}
};
nextTick(function() {
ref(value).then(function(value) {
if (done) return;
done = true;
result.resolve(ref(value).then(wrappedCallback, wrappedErrback));
}, function(reason) {
if (done) return;
done = true;
result.resolve(wrappedErrback(reason));
});
});
return result.promise;
};
function defaultCallback(value) {
return value;
}
function defaultErrback(reason) {
return reject(reason);
}
/**
* @ngdoc
* @name ng.$q#all
* @methodOf ng.$q
* @description
* Combines multiple promises into a single promise that is resolved when all of the input
* promises are resolved.
*
* @param {Array.<Promise>} promises An array of promises.
* @returns {Promise} Returns a single promise that will be resolved with an array of values,
* each value coresponding to the promise at the same index in the `promises` array. If any of
* the promises is resolved with a rejection, this resulting promise will be resolved with the
* same rejection.
*/
function all(promises) {
var deferred = defer(),
counter = promises.length,
results = [];
if (counter) {
forEach(promises, function(promise, index) {
ref(promise).then(function(value) {
if (index in results) return;
results[index] = value;
if (!(--counter)) deferred.resolve(results);
}, function(reason) {
if (index in results) return;
deferred.reject(reason);
});
});
} else {
deferred.resolve(results);
}
return deferred.promise;
}
return {
defer: defer,
reject: reject,
when: when,
all: all
};
}
/**
* @ngdoc object
* @name ng.$routeProvider
* @function
*
* @description
*
* Used for configuring routes. See {@link ng.$route $route} for an example.
*/
function $RouteProvider(){
var routes = {};
/**
* @ngdoc method
* @name ng.$routeProvider#when
* @methodOf ng.$routeProvider
*
* @param {string} path Route path (matched against `$location.path`). If `$location.path`
* contains redundant trailing slash or is missing one, the route will still match and the
* `$location.path` will be updated to add or drop the trailing slash to exactly match the
* route definition.
*
* `path` can contain named groups starting with a colon (`:name`). All characters up to the
* next slash are matched and stored in `$routeParams` under the given `name` when the route
* matches.
*
* @param {Object} route Mapping information to be assigned to `$route.current` on route
* match.
*
* Object properties:
*
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
* created scope or the name of a {@link angular.Module#controller registered controller}
* if passed as a string.
* - `template` – `{string=}` – html template as a string that should be used by
* {@link ng.directive:ngView ngView} or
* {@link ng.directive:ngInclude ngInclude} directives.
* this property takes precedence over `templateUrl`.
* - `templateUrl` – `{string=}` – path to an html template that should be used by
* {@link ng.directive:ngView ngView}.
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
* be injected into the controller. If any of these dependencies are promises, they will be
* resolved and converted to a value before the controller is instantiated and the
* `$routeChangeSuccess` event is fired. The map object is:
*
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
* Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
* and the return value is treated as the dependency. If the result is a promise, it is resolved
* before its value is injected into the controller.
*
* - `redirectTo` – {(string|function())=} – value to update
* {@link ng.$location $location} path with and trigger route redirection.
*
* If `redirectTo` is a function, it will be called with the following parameters:
*
* - `{Object.<string>}` - route parameters extracted from the current
* `$location.path()` by applying the current route templateUrl.
* - `{string}` - current `$location.path()`
* - `{Object}` - current `$location.search()`
*
* The custom `redirectTo` function is expected to return a string which will be used
* to update `$location.path()` and `$location.search()`.
*
* - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search()
* changes.
*
* If the option is set to `false` and url in the browser changes, then
* `$routeUpdate` event is broadcasted on the root scope.
*
* @returns {Object} self
*
* @description
* Adds a new route definition to the `$route` service.
*/
this.when = function(path, route) {
routes[path] = extend({reloadOnSearch: true}, route);
// create redirection for trailing slashes
if (path) {
var redirectPath = (path[path.length-1] == '/')
? path.substr(0, path.length-1)
: path +'/';
routes[redirectPath] = {redirectTo: path};
}
return this;
};
/**
* @ngdoc method
* @name ng.$routeProvider#otherwise
* @methodOf ng.$routeProvider
*
* @description
* Sets route definition that will be used on route change when no other route definition
* is matched.
*
* @param {Object} params Mapping information to be assigned to `$route.current`.
* @returns {Object} self
*/
this.otherwise = function(params) {
this.when(null, params);
return this;
};
this.$get = ['$rootScope', '$location', '$routeParams', '$q', '$injector', '$http', '$templateCache',
function( $rootScope, $location, $routeParams, $q, $injector, $http, $templateCache) {
/**
* @ngdoc object
* @name ng.$route
* @requires $location
* @requires $routeParams
*
* @property {Object} current Reference to the current route definition.
* The route definition contains:
*
* - `controller`: The controller constructor as define in route definition.
* - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
* controller instantiation. The `locals` contain
* the resolved values of the `resolve` map. Additionally the `locals` also contain:
*
* - `$scope` - The current route scope.
* - `$template` - The current route template HTML.
*
* @property {Array.<Object>} routes Array of all configured routes.
*
* @description
* Is used for deep-linking URLs to controllers and views (HTML partials).
* It watches `$location.url()` and tries to map the path to an existing route definition.
*
* You can define routes through {@link ng.$routeProvider $routeProvider}'s API.
*
* The `$route` service is typically used in conjunction with {@link ng.directive:ngView ngView}
* directive and the {@link ng.$routeParams $routeParams} service.
*
* @example
This example shows how changing the URL hash causes the `$route` to match a route against the
URL, and the `ngView` pulls in the partial.
Note that this example is using {@link ng.directive:script inlined templates}
to get it working on jsfiddle as well.
<example module="ngView">
<file name="index.html">
<div ng-controller="MainCntl">
Choose:
<a href="Book/Moby">Moby</a> |
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
<a href="Book/Gatsby">Gatsby</a> |
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
<a href="Book/Scarlet">Scarlet Letter</a><br/>
<div ng-view></div>
<hr />
<pre>$location.path() = {{$location.path()}}</pre>
<pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
<pre>$route.current.params = {{$route.current.params}}</pre>
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
<pre>$routeParams = {{$routeParams}}</pre>
</div>
</file>
<file name="book.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
</file>
<file name="chapter.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
Chapter Id: {{params.chapterId}}
</file>
<file name="script.js">
angular.module('ngView', [], function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl,
resolve: {
// I will cause a 1 second delay
delay: function($q, $timeout) {
var delay = $q.defer();
$timeout(delay.resolve, 1000);
return delay.promise;
}
}
});
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
templateUrl: 'chapter.html',
controller: ChapterCntl
});
// configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(true);
});
function MainCntl($scope, $route, $routeParams, $location) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
}
function BookCntl($scope, $routeParams) {
$scope.name = "BookCntl";
$scope.params = $routeParams;
}
function ChapterCntl($scope, $routeParams) {
$scope.name = "ChapterCntl";
$scope.params = $routeParams;
}
</file>
<file name="scenario.js">
it('should load and compile correct template', function() {
element('a:contains("Moby: Ch1")').click();
var content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element('a:contains("Scarlet")').click();
sleep(2); // promises are not part of scenario waiting
content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</file>
</example>
*/
/**
* @ngdoc event
* @name ng.$route#$routeChangeStart
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
* Broadcasted before a route change. At this point the route services starts
* resolving all of the dependencies needed for the route change to occurs.
* Typically this involves fetching the view template as well as any dependencies
* defined in `resolve` route property. Once all of the dependencies are resolved
* `$routeChangeSuccess` is fired.
*
* @param {Route} next Future route information.
* @param {Route} current Current route information.
*/
/**
* @ngdoc event
* @name ng.$route#$routeChangeSuccess
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
* Broadcasted after a route dependencies are resolved.
* {@link ng.directive:ngView ngView} listens for the directive
* to instantiate the controller and render the view.
*
* @param {Route} current Current route information.
* @param {Route} previous Previous route information.
*/
/**
* @ngdoc event
* @name ng.$route#$routeChangeError
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
* Broadcasted if any of the resolve promises are rejected.
*
* @param {Route} current Current route information.
* @param {Route} previous Previous route information.
* @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
*/
/**
* @ngdoc event
* @name ng.$route#$routeUpdate
* @eventOf ng.$route
* @eventType broadcast on root scope
* @description
*
* The `reloadOnSearch` property has been set to false, and we are reusing the same
* instance of the Controller.
*/
var forceReload = false,
$route = {
routes: routes,
/**
* @ngdoc method
* @name ng.$route#reload
* @methodOf ng.$route
*
* @description
* Causes `$route` service to reload the current route even if
* {@link ng.$location $location} hasn't changed.
*
* As a result of that, {@link ng.directive:ngView ngView}
* creates new scope, reinstantiates the controller.
*/
reload: function() {
forceReload = true;
$rootScope.$evalAsync(updateRoute);
}
};
$rootScope.$on('$locationChangeSuccess', updateRoute);
return $route;
/////////////////////////////////////////////////////
/**
* @param on {string} current url
* @param when {string} route when template to match the url against
* @return {?Object}
*/
function switchRouteMatcher(on, when) {
// TODO(i): this code is convoluted and inefficient, we should construct the route matching
// regex only once and then reuse it
// Escape regexp special characters.
when = '^' + when.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + '$';
var regex = '',
params = [],
dst = {};
var re = /:(\w+)/g,
paramMatch,
lastMatchedIndex = 0;
while ((paramMatch = re.exec(when)) !== null) {
// Find each :param in `when` and replace it with a capturing group.
// Append all other sections of when unchanged.
regex += when.slice(lastMatchedIndex, paramMatch.index);
regex += '([^\\/]*)';
params.push(paramMatch[1]);
lastMatchedIndex = re.lastIndex;
}
// Append trailing path part.
regex += when.substr(lastMatchedIndex);
var match = on.match(new RegExp(regex));
if (match) {
forEach(params, function(name, index) {
dst[name] = match[index + 1];
});
}
return match ? dst : null;
}
function updateRoute() {
var next = parseRoute(),
last = $route.current;
if (next && last && next.$route === last.$route
&& equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
last.params = next.params;
copy(last.params, $routeParams);
$rootScope.$broadcast('$routeUpdate', last);
} else if (next || last) {
forceReload = false;
$rootScope.$broadcast('$routeChangeStart', next, last);
$route.current = next;
if (next) {
if (next.redirectTo) {
if (isString(next.redirectTo)) {
$location.path(interpolate(next.redirectTo, next.params)).search(next.params)
.replace();
} else {
$location.url(next.redirectTo(next.pathParams, $location.path(), $location.search()))
.replace();
}
}
}
$q.when(next).
then(function() {
if (next) {
var keys = [],
values = [],
template;
forEach(next.resolve || {}, function(value, key) {
keys.push(key);
values.push(isString(value) ? $injector.get(value) : $injector.invoke(value));
});
if (isDefined(template = next.template)) {
} else if (isDefined(template = next.templateUrl)) {
template = $http.get(template, {cache: $templateCache}).
then(function(response) { return response.data; });
}
if (isDefined(template)) {
keys.push('$template');
values.push(template);
}
return $q.all(values).then(function(values) {
var locals = {};
forEach(values, function(value, index) {
locals[keys[index]] = value;
});
return locals;
});
}
}).
// after route change
then(function(locals) {
if (next == $route.current) {
if (next) {
next.locals = locals;
copy(next.params, $routeParams);
}
$rootScope.$broadcast('$routeChangeSuccess', next, last);
}
}, function(error) {
if (next == $route.current) {
$rootScope.$broadcast('$routeChangeError', next, last, error);
}
});
}
}
/**
* @returns the current active route, by matching it against the URL
*/
function parseRoute() {
// Match a route
var params, match;
forEach(routes, function(route, path) {
if (!match && (params = switchRouteMatcher($location.path(), path))) {
match = inherit(route, {
params: extend({}, $location.search(), params),
pathParams: params});
match.$route = route;
}
});
// No route matched; fallback to "otherwise" route
return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
}
/**
* @returns interpolation of the redirect path with the parametrs
*/
function interpolate(string, params) {
var result = [];
forEach((string||'').split(':'), function(segment, i) {
if (i == 0) {
result.push(segment);
} else {
var segmentMatch = segment.match(/(\w+)(.*)/);
var key = segmentMatch[1];
result.push(params[key]);
result.push(segmentMatch[2] || '');
delete params[key];
}
});
return result.join('');
}
}];
}
/**
* @ngdoc object
* @name ng.$routeParams
* @requires $route
*
* @description
* Current set of route parameters. The route parameters are a combination of the
* {@link ng.$location $location} `search()`, and `path()`. The `path` parameters
* are extracted when the {@link ng.$route $route} path is matched.
*
* In case of parameter name collision, `path` params take precedence over `search` params.
*
* The service guarantees that the identity of the `$routeParams` object will remain unchanged
* (but its properties will likely change) even when a route change occurs.
*
* @example
* <pre>
* // Given:
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
* // Route: /Chapter/:chapterId/Section/:sectionId
* //
* // Then
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
* </pre>
*/
function $RouteParamsProvider() {
this.$get = valueFn({});
}
/**
* DESIGN NOTES
*
* The design decisions behind the scope ware heavily favored for speed and memory consumption.
*
* The typical use of scope is to watch the expressions, which most of the time return the same
* value as last time so we optimize the operation.
*
* Closures construction is expensive from speed as well as memory:
* - no closures, instead ups prototypical inheritance for API
* - Internal state needs to be stored on scope directly, which means that private state is
* exposed as $$____ properties
*
* Loop operations are optimized by using while(count--) { ... }
* - this means that in order to keep the same order of execution as addition we have to add
* items to the array at the begging (shift) instead of at the end (push)
*
* Child scopes are created and removed often
* - Using array would be slow since inserts in meddle are expensive so we use linked list
*
* There are few watches then a lot of observers. This is why you don't want the observer to be
* implemented in the same way as watch. Watch requires return of initialization function which
* are expensive to construct.
*/
/**
* @ngdoc object
* @name ng.$rootScopeProvider
* @description
*
* Provider for the $rootScope service.
*/
/**
* @ngdoc function
* @name ng.$rootScopeProvider#digestTtl
* @methodOf ng.$rootScopeProvider
* @description
*
* Sets the number of digest iteration the scope should attempt to execute before giving up and
* assuming that the model is unstable.
*
* The current default is 10 iterations.
*
* @param {number} limit The number of digest iterations.
*/
/**
* @ngdoc object
* @name ng.$rootScope
* @description
*
* Every application has a single root {@link ng.$rootScope.Scope scope}.
* All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
* event processing life-cycle. See {@link guide/scope developer guide on scopes}.
*/
function $RootScopeProvider(){
var TTL = 10;
this.digestTtl = function(value) {
if (arguments.length) {
TTL = value;
}
return TTL;
};
this.$get = ['$injector', '$exceptionHandler', '$parse',
function( $injector, $exceptionHandler, $parse) {
/**
* @ngdoc function
* @name ng.$rootScope.Scope
*
* @description
* A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
* {@link AUTO.$injector $injector}. Child scopes are created using the
* {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
* compiled HTML template is executed.)
*
* Here is a simple scope snippet to show how you can interact with the scope.
* <pre>
angular.injector(['ng']).invoke(function($rootScope) {
var scope = $rootScope.$new();
scope.salutation = 'Hello';
scope.name = 'World';
expect(scope.greeting).toEqual(undefined);
scope.$watch('name', function() {
scope.greeting = scope.salutation + ' ' + scope.name + '!';
}); // initialize the watch
expect(scope.greeting).toEqual(undefined);
scope.name = 'Misko';
// still old value, since watches have not been called yet
expect(scope.greeting).toEqual(undefined);
scope.$digest(); // fire all the watches
expect(scope.greeting).toEqual('Hello Misko!');
});
* </pre>
*
* # Inheritance
* A scope can inherit from a parent scope, as in this example:
* <pre>
var parent = $rootScope;
var child = parent.$new();
parent.salutation = "Hello";
child.name = "World";
expect(child.salutation).toEqual('Hello');
child.salutation = "Welcome";
expect(child.salutation).toEqual('Welcome');
expect(parent.salutation).toEqual('Hello');
* </pre>
*
*
* @param {Object.<string, function()>=} providers Map of service factory which need to be provided
* for the current scope. Defaults to {@link ng}.
* @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
* append/override services provided by `providers`. This is handy when unit-testing and having
* the need to override a default service.
* @returns {Object} Newly created scope.
*
*/
function Scope() {
this.$id = nextUid();
this.$$phase = this.$parent = this.$$watchers =
this.$$nextSibling = this.$$prevSibling =
this.$$childHead = this.$$childTail = null;
this['this'] = this.$root = this;
this.$$destroyed = false;
this.$$asyncQueue = [];
this.$$listeners = {};
}
/**
* @ngdoc property
* @name ng.$rootScope.Scope#$id
* @propertyOf ng.$rootScope.Scope
* @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for
* debugging.
*/
Scope.prototype = {
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$new
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Creates a new child {@link ng.$rootScope.Scope scope}.
*
* The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and
* {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the scope
* hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
*
* {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is desired for
* the scope and its child scopes to be permanently detached from the parent and thus stop
* participating in model change detection and listener notification by invoking.
*
* @param {boolean} isolate if true then the scope does not prototypically inherit from the
* parent scope. The scope is isolated, as it can not see parent scope properties.
* When creating widgets it is useful for the widget to not accidentally read parent
* state.
*
* @returns {Object} The newly created child scope.
*
*/
$new: function(isolate) {
var Child,
child;
if (isFunction(isolate)) {
// TODO: remove at some point
throw Error('API-CHANGE: Use $controller to instantiate controllers.');
}
if (isolate) {
child = new Scope();
child.$root = this.$root;
} else {
Child = function() {}; // should be anonymous; This is so that when the minifier munges
// the name it does not become random set of chars. These will then show up as class
// name in the debugger.
Child.prototype = this;
child = new Child();
child.$id = nextUid();
}
child['this'] = child;
child.$$listeners = {};
child.$parent = this;
child.$$asyncQueue = [];
child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
child.$$prevSibling = this.$$childTail;
if (this.$$childHead) {
this.$$childTail.$$nextSibling = child;
this.$$childTail = child;
} else {
this.$$childHead = this.$$childTail = child;
}
return child;
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$watch
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
*
* - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest $digest()} and
* should return the value which will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()}
* reruns when it detects changes the `watchExpression` can execute multiple times per
* {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
* - The `listener` is called only when the value from the current `watchExpression` and the
* previous call to `watchExpression` are not equal (with the exception of the initial run,
* see below). The inequality is determined according to
* {@link angular.equals} function. To save the value of the object for later comparison, the
* {@link angular.copy} function is used. It also means that watching complex options will
* have adverse memory and performance implications.
* - The watch `listener` may change the model, which may trigger other `listener`s to fire. This
* is achieved by rerunning the watchers until no changes are detected. The rerun iteration
* limit is 10 to prevent an infinite loop deadlock.
*
*
* If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
* you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
* can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a change is
* detected, be prepared for multiple calls to your listener.)
*
* After a watcher is registered with the scope, the `listener` fn is called asynchronously
* (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
* watcher. In rare cases, this is undesirable because the listener is called when the result
* of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
* can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
* listener was called due to initialization.
*
*
* # Example
* <pre>
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
scope.name = 'misko';
scope.counter = 0;
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; });
expect(scope.counter).toEqual(0);
scope.$digest();
// no variable change
expect(scope.counter).toEqual(0);
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
* </pre>
*
*
*
* @param {(function()|string)} watchExpression Expression that is evaluated on each
* {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers a
* call to the `listener`.
*
* - `string`: Evaluated as {@link guide/expression expression}
* - `function(scope)`: called with current `scope` as a parameter.
* @param {(function()|string)=} listener Callback called whenever the return value of
* the `watchExpression` changes.
*
* - `string`: Evaluated as {@link guide/expression expression}
* - `function(newValue, oldValue, scope)`: called with current and previous values as parameters.
*
* @param {boolean=} objectEquality Compare object for equality rather than for reference.
* @returns {function()} Returns a deregistration function for this listener.
*/
$watch: function(watchExp, listener, objectEquality) {
var scope = this,
get = compileToFn(watchExp, 'watch'),
array = scope.$$watchers,
watcher = {
fn: listener,
last: initWatchVal,
get: get,
exp: watchExp,
eq: !!objectEquality
};
// in the case user pass string, we need to compile it, do we really need this ?
if (!isFunction(listener)) {
var listenFn = compileToFn(listener || noop, 'listener');
watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};
}
if (!array) {
array = scope.$$watchers = [];
}
// we use unshift since we use a while loop in $digest for speed.
// the while loop reads in reverse order.
array.unshift(watcher);
return function() {
arrayRemove(array, watcher);
};
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$digest
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Process all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and its children.
* Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change the model, the
* `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} until no more listeners are
* firing. This means that it is possible to get into an infinite loop. This function will throw
* `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 10.
*
* Usually you don't call `$digest()` directly in
* {@link ng.directive:ngController controllers} or in
* {@link ng.$compileProvider#directive directives}.
* Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
* {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
*
* If you want to be notified whenever `$digest()` is called,
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
* with no `listener`.
*
* You may have a need to call `$digest()` from within unit-tests, to simulate the scope
* life-cycle.
*
* # Example
* <pre>
var scope = ...;
scope.name = 'misko';
scope.counter = 0;
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) {
scope.counter = scope.counter + 1;
});
expect(scope.counter).toEqual(0);
scope.$digest();
// no variable change
expect(scope.counter).toEqual(0);
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
* </pre>
*
*/
$digest: function() {
var watch, value, last,
watchers,
asyncQueue,
length,
dirty, ttl = TTL,
next, current, target = this,
watchLog = [],
logIdx, logMsg;
beginPhase('$digest');
do {
dirty = false;
current = target;
do {
asyncQueue = current.$$asyncQueue;
while(asyncQueue.length) {
try {
current.$eval(asyncQueue.shift());
} catch (e) {
$exceptionHandler(e);
}
}
if ((watchers = current.$$watchers)) {
// process our watches
length = watchers.length;
while (length--) {
try {
watch = watchers[length];
// Most common watches are on primitives, in which case we can short
// circuit it with === operator, only when === fails do we use .equals
if ((value = watch.get(current)) !== (last = watch.last) &&
!(watch.eq
? equals(value, last)
: (typeof value == 'number' && typeof last == 'number'
&& isNaN(value) && isNaN(last)))) {
dirty = true;
watch.last = watch.eq ? copy(value) : value;
watch.fn(value, ((last === initWatchVal) ? value : last), current);
if (ttl < 5) {
logIdx = 4 - ttl;
if (!watchLog[logIdx]) watchLog[logIdx] = [];
logMsg = (isFunction(watch.exp))
? 'fn: ' + (watch.exp.name || watch.exp.toString())
: watch.exp;
logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
watchLog[logIdx].push(logMsg);
}
}
} catch (e) {
$exceptionHandler(e);
}
}
}
// Insanity Warning: scope depth-first traversal
// yes, this code is a bit crazy, but it works and we have tests to prove it!
// this piece should be kept in sync with the traversal in $broadcast
if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) {
while(current !== target && !(next = current.$$nextSibling)) {
current = current.$parent;
}
}
} while ((current = next));
if(dirty && !(ttl--)) {
clearPhase();
throw Error(TTL + ' $digest() iterations reached. Aborting!\n' +
'Watchers fired in the last 5 iterations: ' + toJson(watchLog));
}
} while (dirty || asyncQueue.length);
clearPhase();
},
/**
* @ngdoc event
* @name ng.$rootScope.Scope#$destroy
* @eventOf ng.$rootScope.Scope
* @eventType broadcast on scope being destroyed
*
* @description
* Broadcasted when a scope and its children are being destroyed.
*/
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$destroy
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Removes the current scope (and all of its children) from the parent scope. Removal implies
* that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
* propagate to the current scope and its children. Removal also implies that the current
* scope is eligible for garbage collection.
*
* The `$destroy()` is usually used by directives such as
* {@link ng.directive:ngRepeat ngRepeat} for managing the
* unrolling of the loop.
*
* Just before a scope is destroyed a `$destroy` event is broadcasted on this scope.
* Application code can register a `$destroy` event handler that will give it chance to
* perform any necessary cleanup.
*/
$destroy: function() {
// we can't destroy the root scope or a scope that has been already destroyed
if ($rootScope == this || this.$$destroyed) return;
var parent = this.$parent;
this.$broadcast('$destroy');
this.$$destroyed = true;
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
// This is bogus code that works around Chrome's GC leak
// see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
this.$$childTail = null;
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$eval
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Executes the `expression` on the current scope returning the result. Any exceptions in the
* expression are propagated (uncaught). This is useful when evaluating Angular expressions.
*
* # Example
* <pre>
var scope = ng.$rootScope.Scope();
scope.a = 1;
scope.b = 2;
expect(scope.$eval('a+b')).toEqual(3);
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
* </pre>
*
* @param {(string|function())=} expression An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
* - `function(scope)`: execute the function with the current `scope` parameter.
*
* @returns {*} The result of evaluating the expression.
*/
$eval: function(expr, locals) {
return $parse(expr)(this, locals);
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$evalAsync
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Executes the expression on the current scope at a later point in time.
*
* The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
*
* - it will execute in the current script execution context (before any DOM rendering).
* - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
* `expression` execution.
*
* Any exceptions from the execution of the expression are forwarded to the
* {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {(string|function())=} expression An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
* - `function(scope)`: execute the function with the current `scope` parameter.
*
*/
$evalAsync: function(expr) {
this.$$asyncQueue.push(expr);
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$apply
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* `$apply()` is used to execute an expression in angular from outside of the angular framework.
* (For example from browser DOM events, setTimeout, XHR or third party libraries).
* Because we are calling into the angular framework we need to perform proper scope life-cycle
* of {@link ng.$exceptionHandler exception handling},
* {@link ng.$rootScope.Scope#$digest executing watches}.
*
* ## Life cycle
*
* # Pseudo-Code of `$apply()`
* <pre>
function $apply(expr) {
try {
return $eval(expr);
} catch (e) {
$exceptionHandler(e);
} finally {
$root.$digest();
}
}
* </pre>
*
*
* Scope's `$apply()` method transitions through the following stages:
*
* 1. The {@link guide/expression expression} is executed using the
* {@link ng.$rootScope.Scope#$eval $eval()} method.
* 2. Any exceptions from the execution of the expression are forwarded to the
* {@link ng.$exceptionHandler $exceptionHandler} service.
* 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the expression
* was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
*
*
* @param {(string|function())=} exp An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
* - `function(scope)`: execute the function with current `scope` parameter.
*
* @returns {*} The result of evaluating the expression.
*/
$apply: function(expr) {
try {
beginPhase('$apply');
return this.$eval(expr);
} catch (e) {
$exceptionHandler(e);
} finally {
clearPhase();
try {
$rootScope.$digest();
} catch (e) {
$exceptionHandler(e);
throw e;
}
}
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$on
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for discussion of
* event life cycle.
*
* @param {string} name Event name to listen on.
* @param {function(event)} listener Function to call when the event is emitted.
* @returns {function()} Returns a deregistration function for this listener.
*
* The event listener function format is: `function(event, args...)`. The `event` object
* passed into the listener has the following attributes:
*
* - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
* - `currentScope` - `{Scope}`: the current scope which is handling the event.
* - `name` - `{string}`: Name of the event.
* - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel further event
* propagation (available only for events that were `$emit`-ed).
* - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
*/
$on: function(name, listener) {
var namedListeners = this.$$listeners[name];
if (!namedListeners) {
this.$$listeners[name] = namedListeners = [];
}
namedListeners.push(listener);
return function() {
namedListeners[indexOf(namedListeners, listener)] = null;
};
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$emit
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Dispatches an event `name` upwards through the scope hierarchy notifying the
* registered {@link ng.$rootScope.Scope#$on} listeners.
*
* The event life cycle starts at the scope on which `$emit` was called. All
* {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified.
* Afterwards, the event traverses upwards toward the root scope and calls all registered
* listeners along the way. The event will stop propagating if one of the listeners cancels it.
*
* Any exception emmited from the {@link ng.$rootScope.Scope#$on listeners} will be passed
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {string} name Event name to emit.
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
* @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
*/
$emit: function(name, args) {
var empty = [],
namedListeners,
scope = this,
stopPropagation = false,
event = {
name: name,
targetScope: scope,
stopPropagation: function() {stopPropagation = true;},
preventDefault: function() {
event.defaultPrevented = true;
},
defaultPrevented: false
},
listenerArgs = concat([event], arguments, 1),
i, length;
do {
namedListeners = scope.$$listeners[name] || empty;
event.currentScope = scope;
for (i=0, length=namedListeners.length; i<length; i++) {
// if listeners were deregistered, defragment the array
if (!namedListeners[i]) {
namedListeners.splice(i, 1);
i--;
length--;
continue;
}
try {
namedListeners[i].apply(null, listenerArgs);
if (stopPropagation) return event;
} catch (e) {
$exceptionHandler(e);
}
}
//traverse upwards
scope = scope.$parent;
} while (scope);
return event;
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$broadcast
* @methodOf ng.$rootScope.Scope
* @function
*
* @description
* Dispatches an event `name` downwards to all child scopes (and their children) notifying the
* registered {@link ng.$rootScope.Scope#$on} listeners.
*
* The event life cycle starts at the scope on which `$broadcast` was called. All
* {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified.
* Afterwards, the event propagates to all direct and indirect scopes of the current scope and
* calls all registered listeners along the way. The event cannot be canceled.
*
* Any exception emmited from the {@link ng.$rootScope.Scope#$on listeners} will be passed
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {string} name Event name to emit.
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
* @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
*/
$broadcast: function(name, args) {
var target = this,
current = target,
next = target,
event = {
name: name,
targetScope: target,
preventDefault: function() {
event.defaultPrevented = true;
},
defaultPrevented: false
},
listenerArgs = concat([event], arguments, 1),
listeners, i, length;
//down while you can, then up and next sibling or up and next sibling until back at root
do {
current = next;
event.currentScope = current;
listeners = current.$$listeners[name] || [];
for (i=0, length = listeners.length; i<length; i++) {
// if listeners were deregistered, defragment the array
if (!listeners[i]) {
listeners.splice(i, 1);
i--;
length--;
continue;
}
try {
listeners[i].apply(null, listenerArgs);
} catch(e) {
$exceptionHandler(e);
}
}
// Insanity Warning: scope depth-first traversal
// yes, this code is a bit crazy, but it works and we have tests to prove it!
// this piece should be kept in sync with the traversal in $digest
if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) {
while(current !== target && !(next = current.$$nextSibling)) {
current = current.$parent;
}
}
} while ((current = next));
return event;
}
};
var $rootScope = new Scope();
return $rootScope;
function beginPhase(phase) {
if ($rootScope.$$phase) {
throw Error($rootScope.$$phase + ' already in progress');
}
$rootScope.$$phase = phase;
}
function clearPhase() {
$rootScope.$$phase = null;
}
function compileToFn(exp, name) {
var fn = $parse(exp);
assertArgFn(fn, name);
return fn;
}
/**
* function used as an initial value for watchers.
* because it's uniqueue we can easily tell it apart from other values
*/
function initWatchVal() {}
}];
}
/**
* !!! This is an undocumented "private" service !!!
*
* @name ng.$sniffer
* @requires $window
*
* @property {boolean} history Does the browser support html5 history api ?
* @property {boolean} hashchange Does the browser support hashchange event ?
*
* @description
* This is very simple implementation of testing browser's features.
*/
function $SnifferProvider() {
this.$get = ['$window', function($window) {
var eventSupport = {},
android = int((/android (\d+)/.exec(lowercase($window.navigator.userAgent)) || [])[1]);
return {
// Android has history.pushState, but it does not update location correctly
// so let's not use the history API at all.
// http://code.google.com/p/android/issues/detail?id=17471
// https://github.com/angular/angular.js/issues/904
history: !!($window.history && $window.history.pushState && !(android < 4)),
hashchange: 'onhashchange' in $window &&
// IE8 compatible mode lies
(!$window.document.documentMode || $window.document.documentMode > 7),
hasEvent: function(event) {
// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
// it. In particular the event is not fired when backspace or delete key are pressed or
// when cut operation is performed.
if (event == 'input' && msie == 9) return false;
if (isUndefined(eventSupport[event])) {
var divElm = $window.document.createElement('div');
eventSupport[event] = 'on' + event in divElm;
}
return eventSupport[event];
},
// TODO(i): currently there is no way to feature detect CSP without triggering alerts
csp: false
};
}];
}
/**
* @ngdoc object
* @name ng.$window
*
* @description
* A reference to the browser's `window` object. While `window`
* is globally available in JavaScript, it causes testability problems, because
* it is a global variable. In angular we always refer to it through the
* `$window` service, so it may be overriden, removed or mocked for testing.
*
* All expressions are evaluated with respect to current scope so they don't
* suffer from window globality.
*
* @example
<doc:example>
<doc:source>
<input ng-init="$window = $service('$window'); greeting='Hello World!'" type="text" ng-model="greeting" />
<button ng-click="$window.alert(greeting)">ALERT</button>
</doc:source>
<doc:scenario>
</doc:scenario>
</doc:example>
*/
function $WindowProvider(){
this.$get = valueFn(window);
}
/**
* Parse headers into key value object
*
* @param {string} headers Raw headers as a string
* @returns {Object} Parsed headers as key value object
*/
function parseHeaders(headers) {
var parsed = {}, key, val, i;
if (!headers) return parsed;
forEach(headers.split('\n'), function(line) {
i = line.indexOf(':');
key = lowercase(trim(line.substr(0, i)));
val = trim(line.substr(i + 1));
if (key) {
if (parsed[key]) {
parsed[key] += ', ' + val;
} else {
parsed[key] = val;
}
}
});
return parsed;
}
/**
* Returns a function that provides access to parsed headers.
*
* Headers are lazy parsed when first requested.
* @see parseHeaders
*
* @param {(string|Object)} headers Headers to provide access to.
* @returns {function(string=)} Returns a getter function which if called with:
*
* - if called with single an argument returns a single header value or null
* - if called with no arguments returns an object containing all headers.
*/
function headersGetter(headers) {
var headersObj = isObject(headers) ? headers : undefined;
return function(name) {
if (!headersObj) headersObj = parseHeaders(headers);
if (name) {
return headersObj[lowercase(name)] || null;
}
return headersObj;
};
}
/**
* Chain all given functions
*
* This function is used for both request and response transforming
*
* @param {*} data Data to transform.
* @param {function(string=)} headers Http headers getter fn.
* @param {(function|Array.<function>)} fns Function or an array of functions.
* @returns {*} Transformed data.
*/
function transformData(data, headers, fns) {
if (isFunction(fns))
return fns(data, headers);
forEach(fns, function(fn) {
data = fn(data, headers);
});
return data;
}
function isSuccess(status) {
return 200 <= status && status < 300;
}
function $HttpProvider() {
var JSON_START = /^\s*(\[|\{[^\{])/,
JSON_END = /[\}\]]\s*$/,
PROTECTION_PREFIX = /^\)\]\}',?\n/;
var $config = this.defaults = {
// transform incoming response data
transformResponse: [function(data) {
if (isString(data)) {
// strip json vulnerability protection prefix
data = data.replace(PROTECTION_PREFIX, '');
if (JSON_START.test(data) && JSON_END.test(data))
data = fromJson(data, true);
}
return data;
}],
// transform outgoing request data
transformRequest: [function(d) {
return isObject(d) && !isFile(d) ? toJson(d) : d;
}],
// default headers
headers: {
common: {
'Accept': 'application/json, text/plain, */*',
'X-Requested-With': 'XMLHttpRequest'
},
post: {'Content-Type': 'application/json;charset=utf-8'},
put: {'Content-Type': 'application/json;charset=utf-8'}
}
};
var providerResponseInterceptors = this.responseInterceptors = [];
this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',
function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
var defaultCache = $cacheFactory('$http'),
responseInterceptors = [];
forEach(providerResponseInterceptors, function(interceptor) {
responseInterceptors.push(
isString(interceptor)
? $injector.get(interceptor)
: $injector.invoke(interceptor)
);
});
/**
* @ngdoc function
* @name ng.$http
* @requires $httpBackend
* @requires $browser
* @requires $cacheFactory
* @requires $rootScope
* @requires $q
* @requires $injector
*
* @description
* The `$http` service is a core Angular service that facilitates communication with the remote
* HTTP servers via browser's {@link https://developer.mozilla.org/en/xmlhttprequest
* XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}.
*
* For unit testing applications that use `$http` service, see
* {@link ngMock.$httpBackend $httpBackend mock}.
*
* For a higher level of abstraction, please check out the {@link ngResource.$resource
* $resource} service.
*
* The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
* the $q service. While for simple usage patters this doesn't matter much, for advanced usage,
* it is important to familiarize yourself with these apis and guarantees they provide.
*
*
* # General usage
* The `$http` service is a function which takes a single argument — a configuration object —
* that is used to generate an http request and returns a {@link ng.$q promise}
* with two $http specific methods: `success` and `error`.
*
* <pre>
* $http({method: 'GET', url: '/someUrl'}).
* success(function(data, status, headers, config) {
* // this callback will be called asynchronously
* // when the response is available
* }).
* error(function(data, status, headers, config) {
* // called asynchronously if an error occurs
* // or server returns response with an error status.
* });
* </pre>
*
* Since the returned value of calling the $http function is a Promise object, you can also use
* the `then` method to register callbacks, and these callbacks will receive a single argument –
* an object representing the response. See the api signature and type info below for more
* details.
*
* A response status code that falls in the [200, 300) range is considered a success status and
* will result in the success callback being called. Note that if the response is a redirect,
* XMLHttpRequest will transparently follow it, meaning that the error callback will not be
* called for such responses.
*
* # Shortcut methods
*
* Since all invocation of the $http service require definition of the http method and url and
* POST and PUT requests require response body/data to be provided as well, shortcut methods
* were created to simplify using the api:
*
* <pre>
* $http.get('/someUrl').success(successCallback);
* $http.post('/someUrl', data).success(successCallback);
* </pre>
*
* Complete list of shortcut methods:
*
* - {@link ng.$http#get $http.get}
* - {@link ng.$http#head $http.head}
* - {@link ng.$http#post $http.post}
* - {@link ng.$http#put $http.put}
* - {@link ng.$http#delete $http.delete}
* - {@link ng.$http#jsonp $http.jsonp}
*
*
* # Setting HTTP Headers
*
* The $http service will automatically add certain http headers to all requests. These defaults
* can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
* object, which currently contains this default configuration:
*
* - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
* - `Accept: application/json, text/plain, * / *`
* - `X-Requested-With: XMLHttpRequest`
* - `$httpProvider.defaults.headers.post`: (header defaults for HTTP POST requests)
* - `Content-Type: application/json`
* - `$httpProvider.defaults.headers.put` (header defaults for HTTP PUT requests)
* - `Content-Type: application/json`
*
* To add or overwrite these defaults, simply add or remove a property from this configuration
* objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
* with name equal to the lower-cased http method name, e.g.
* `$httpProvider.defaults.headers.get['My-Header']='value'`.
*
* Additionally, the defaults can be set at runtime via the `$http.defaults` object in a similar
* fassion as described above.
*
*
* # Transforming Requests and Responses
*
* Both requests and responses can be transformed using transform functions. By default, Angular
* applies these transformations:
*
* Request transformations:
*
* - if the `data` property of the request config object contains an object, serialize it into
* JSON format.
*
* Response transformations:
*
* - if XSRF prefix is detected, strip it (see Security Considerations section below)
* - if json response is detected, deserialize it using a JSON parser
*
* To override these transformation locally, specify transform functions as `transformRequest`
* and/or `transformResponse` properties of the config object. To globally override the default
* transforms, override the `$httpProvider.defaults.transformRequest` and
* `$httpProvider.defaults.transformResponse` properties of the `$httpProvider`.
*
*
* # Caching
*
* To enable caching set the configuration property `cache` to `true`. When the cache is
* enabled, `$http` stores the response from the server in local cache. Next time the
* response is served from the cache without sending a request to the server.
*
* Note that even if the response is served from cache, delivery of the data is asynchronous in
* the same way that real requests are.
*
* If there are multiple GET requests for the same url that should be cached using the same
* cache, but the cache is not populated yet, only one request to the server will be made and
* the remaining requests will be fulfilled using the response for the first request.
*
*
* # Response interceptors
*
* Before you start creating interceptors, be sure to understand the
* {@link ng.$q $q and deferred/promise APIs}.
*
* For purposes of global error handling, authentication or any kind of synchronous or
* asynchronous preprocessing of received responses, it is desirable to be able to intercept
* responses for http requests before they are handed over to the application code that
* initiated these requests. The response interceptors leverage the {@link ng.$q
* promise apis} to fulfil this need for both synchronous and asynchronous preprocessing.
*
* The interceptors are service factories that are registered with the $httpProvider by
* adding them to the `$httpProvider.responseInterceptors` array. The factory is called and
* injected with dependencies (if specified) and returns the interceptor — a function that
* takes a {@link ng.$q promise} and returns the original or a new promise.
*
* <pre>
* // register the interceptor as a service
* $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
* return function(promise) {
* return promise.then(function(response) {
* // do something on success
* }, function(response) {
* // do something on error
* if (canRecover(response)) {
* return responseOrNewPromise
* }
* return $q.reject(response);
* });
* }
* });
*
* $httpProvider.responseInterceptors.push('myHttpInterceptor');
*
*
* // register the interceptor via an anonymous factory
* $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {
* return function(promise) {
* // same as above
* }
* });
* </pre>
*
*
* # Security Considerations
*
* When designing web applications, consider security threats from:
*
* - {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
* JSON Vulnerability}
* - {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF}
*
* Both server and the client must cooperate in order to eliminate these threats. Angular comes
* pre-configured with strategies that address these issues, but for this to work backend server
* cooperation is required.
*
* ## JSON Vulnerability Protection
*
* A {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
* JSON Vulnerability} allows third party web-site to turn your JSON resource URL into
* {@link http://en.wikipedia.org/wiki/JSON#JSONP JSONP} request under some conditions. To
* counter this your server can prefix all JSON requests with following string `")]}',\n"`.
* Angular will automatically strip the prefix before processing it as JSON.
*
* For example if your server needs to return:
* <pre>
* ['one','two']
* </pre>
*
* which is vulnerable to attack, your server can return:
* <pre>
* )]}',
* ['one','two']
* </pre>
*
* Angular will strip the prefix, before processing the JSON.
*
*
* ## Cross Site Request Forgery (XSRF) Protection
*
* {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} is a technique by which
* an unauthorized site can gain your user's private data. Angular provides following mechanism
* to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
* called `XSRF-TOKEN` and sets it as the HTTP header `X-XSRF-TOKEN`. Since only JavaScript that
* runs on your domain could read the cookie, your server can be assured that the XHR came from
* JavaScript running on your domain.
*
* To take advantage of this, your server needs to set a token in a JavaScript readable session
* cookie called `XSRF-TOKEN` on first HTTP GET request. On subsequent non-GET requests the
* server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
* that only JavaScript running on your domain could have read the token. The token must be
* unique for each user and must be verifiable by the server (to prevent the JavaScript making
* up its own tokens). We recommend that the token is a digest of your site's authentication
* cookie with {@link http://en.wikipedia.org/wiki/Rainbow_table salt for added security}.
*
*
* @param {object} config Object describing the request to be made and how it should be
* processed. The object has following properties:
*
* - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
* - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
* - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned to
* `?key1=value1&key2=value2` after the url. If the value is not a string, it will be JSONified.
* - **data** – `{string|Object}` – Data to be sent as the request message data.
* - **headers** – `{Object}` – Map of strings representing HTTP headers to send to the server.
* - **transformRequest** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* request body and headers and returns its transformed (typically serialized) version.
* - **transformResponse** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* response body and headers and returns its transformed (typically deserialized) version.
* - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
* GET request, otherwise if a cache instance built with
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
* caching.
* - **timeout** – `{number}` – timeout in milliseconds.
* - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the
* XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
* requests with credentials} for more information.
*
* @returns {HttpPromise} Returns a {@link ng.$q promise} object with the
* standard `then` method and two http specific methods: `success` and `error`. The `then`
* method takes two arguments a success and an error callback which will be called with a
* response object. The `success` and `error` methods take a single argument - a function that
* will be called when the request succeeds or fails respectively. The arguments passed into
* these functions are destructured representation of the response object passed into the
* `then` method. The response object has these properties:
*
* - **data** – `{string|Object}` – The response body transformed with the transform functions.
* - **status** – `{number}` – HTTP status code of the response.
* - **headers** – `{function([headerName])}` – Header getter function.
* - **config** – `{Object}` – The configuration object that was used to generate the request.
*
* @property {Array.<Object>} pendingRequests Array of config objects for currently pending
* requests. This is primarily meant to be used for debugging purposes.
*
*
* @example
<example>
<file name="index.html">
<div ng-controller="FetchCtrl">
<select ng-model="method">
<option>GET</option>
<option>JSONP</option>
</select>
<input type="text" ng-model="url" size="80"/>
<button ng-click="fetch()">fetch</button><br>
<button ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
<button ng-click="updateModel('JSONP', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button>
<button ng-click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button>
<pre>http status code: {{status}}</pre>
<pre>http response data: {{data}}</pre>
</div>
</file>
<file name="script.js">
function FetchCtrl($scope, $http, $templateCache) {
$scope.method = 'GET';
$scope.url = 'http-hello.html';
$scope.fetch = function() {
$scope.code = null;
$scope.response = null;
$http({method: $scope.method, url: $scope.url, cache: $templateCache}).
success(function(data, status) {
$scope.status = status;
$scope.data = data;
}).
error(function(data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
};
$scope.updateModel = function(method, url) {
$scope.method = method;
$scope.url = url;
};
}
</file>
<file name="http-hello.html">
Hello, $http!
</file>
<file name="scenario.js">
it('should make an xhr GET request', function() {
element(':button:contains("Sample GET")').click();
element(':button:contains("fetch")').click();
expect(binding('status')).toBe('200');
expect(binding('data')).toMatch(/Hello, \$http!/);
});
it('should make a JSONP request to angularjs.org', function() {
element(':button:contains("Sample JSONP")').click();
element(':button:contains("fetch")').click();
expect(binding('status')).toBe('200');
expect(binding('data')).toMatch(/Super Hero!/);
});
it('should make JSONP request to invalid URL and invoke the error handler',
function() {
element(':button:contains("Invalid JSONP")').click();
element(':button:contains("fetch")').click();
expect(binding('status')).toBe('0');
expect(binding('data')).toBe('Request failed');
});
</file>
</example>
*/
function $http(config) {
config.method = uppercase(config.method);
var reqTransformFn = config.transformRequest || $config.transformRequest,
respTransformFn = config.transformResponse || $config.transformResponse,
defHeaders = $config.headers,
reqHeaders = extend({'X-XSRF-TOKEN': $browser.cookies()['XSRF-TOKEN']},
defHeaders.common, defHeaders[lowercase(config.method)], config.headers),
reqData = transformData(config.data, headersGetter(reqHeaders), reqTransformFn),
promise;
// strip content-type if data is undefined
if (isUndefined(config.data)) {
delete reqHeaders['Content-Type'];
}
// send request
promise = sendReq(config, reqData, reqHeaders);
// transform future response
promise = promise.then(transformResponse, transformResponse);
// apply interceptors
forEach(responseInterceptors, function(interceptor) {
promise = interceptor(promise);
});
promise.success = function(fn) {
promise.then(function(response) {
fn(response.data, response.status, response.headers, config);
});
return promise;
};
promise.error = function(fn) {
promise.then(null, function(response) {
fn(response.data, response.status, response.headers, config);
});
return promise;
};
return promise;
function transformResponse(response) {
// make a copy since the response must be cacheable
var resp = extend({}, response, {
data: transformData(response.data, response.headers, respTransformFn)
});
return (isSuccess(response.status))
? resp
: $q.reject(resp);
}
}
$http.pendingRequests = [];
/**
* @ngdoc method
* @name ng.$http#get
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `GET` request
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#delete
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `DELETE` request
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#head
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `HEAD` request
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#jsonp
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `JSONP` request
*
* @param {string} url Relative or absolute URL specifying the destination of the request.
* Should contain `JSON_CALLBACK` string.
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
createShortMethods('get', 'delete', 'head', 'jsonp');
/**
* @ngdoc method
* @name ng.$http#post
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `POST` request
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {*} data Request content
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
/**
* @ngdoc method
* @name ng.$http#put
* @methodOf ng.$http
*
* @description
* Shortcut method to perform `PUT` request
*
* @param {string} url Relative or absolute URL specifying the destination of the request
* @param {*} data Request content
* @param {Object=} config Optional configuration object
* @returns {HttpPromise} Future object
*/
createShortMethodsWithData('post', 'put');
/**
* @ngdoc property
* @name ng.$http#defaults
* @propertyOf ng.$http
*
* @description
* Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
* default headers as well as request and response transformations.
*
* See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
*/
$http.defaults = $config;
return $http;
function createShortMethods(names) {
forEach(arguments, function(name) {
$http[name] = function(url, config) {
return $http(extend(config || {}, {
method: name,
url: url
}));
};
});
}
function createShortMethodsWithData(name) {
forEach(arguments, function(name) {
$http[name] = function(url, data, config) {
return $http(extend(config || {}, {
method: name,
url: url,
data: data
}));
};
});
}
/**
* Makes the request
*
* !!! ACCESSES CLOSURE VARS:
* $httpBackend, $config, $log, $rootScope, defaultCache, $http.pendingRequests
*/
function sendReq(config, reqData, reqHeaders) {
var deferred = $q.defer(),
promise = deferred.promise,
cache,
cachedResp,
url = buildUrl(config.url, config.params);
$http.pendingRequests.push(config);
promise.then(removePendingReq, removePendingReq);
if (config.cache && config.method == 'GET') {
cache = isObject(config.cache) ? config.cache : defaultCache;
}
if (cache) {
cachedResp = cache.get(url);
if (cachedResp) {
if (cachedResp.then) {
// cached request has already been sent, but there is no response yet
cachedResp.then(removePendingReq, removePendingReq);
return cachedResp;
} else {
// serving from cache
if (isArray(cachedResp)) {
resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2]));
} else {
resolvePromise(cachedResp, 200, {});
}
}
} else {
// put the promise for the non-transformed response into cache as a placeholder
cache.put(url, promise);
}
}
// if we won't have the response in cache, send the request to the backend
if (!cachedResp) {
$httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
config.withCredentials);
}
return promise;
/**
* Callback registered to $httpBackend():
* - caches the response if desired
* - resolves the raw $http promise
* - calls $apply
*/
function done(status, response, headersString) {
if (cache) {
if (isSuccess(status)) {
cache.put(url, [status, response, parseHeaders(headersString)]);
} else {
// remove promise from the cache
cache.remove(url);
}
}
resolvePromise(response, status, headersString);
$rootScope.$apply();
}
/**
* Resolves the raw $http promise.
*/
function resolvePromise(response, status, headers) {
// normalize internal statuses to 0
status = Math.max(status, 0);
(isSuccess(status) ? deferred.resolve : deferred.reject)({
data: response,
status: status,
headers: headersGetter(headers),
config: config
});
}
function removePendingReq() {
var idx = indexOf($http.pendingRequests, config);
if (idx !== -1) $http.pendingRequests.splice(idx, 1);
}
}
function buildUrl(url, params) {
if (!params) return url;
var parts = [];
forEachSorted(params, function(value, key) {
if (value == null || value == undefined) return;
if (isObject(value)) {
value = toJson(value);
}
parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
});
return url + ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
}
}];
}
var XHR = window.XMLHttpRequest || function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {}
throw new Error("This browser does not support XMLHttpRequest.");
};
/**
* @ngdoc object
* @name ng.$httpBackend
* @requires $browser
* @requires $window
* @requires $document
*
* @description
* HTTP backend used by the {@link ng.$http service} that delegates to
* XMLHttpRequest object or JSONP and deals with browser incompatibilities.
*
* You should never need to use this service directly, instead use the higher-level abstractions:
* {@link ng.$http $http} or {@link ngResource.$resource $resource}.
*
* During testing this implementation is swapped with {@link ngMock.$httpBackend mock
* $httpBackend} which can be trained with responses.
*/
function $HttpBackendProvider() {
this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {
return createHttpBackend($browser, XHR, $browser.defer, $window.angular.callbacks,
$document[0], $window.location.protocol.replace(':', ''));
}];
}
function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) {
// TODO(vojta): fix the signature
return function(method, url, post, callback, headers, timeout, withCredentials) {
$browser.$$incOutstandingRequestCount();
url = url || $browser.url();
if (lowercase(method) == 'jsonp') {
var callbackId = '_' + (callbacks.counter++).toString(36);
callbacks[callbackId] = function(data) {
callbacks[callbackId].data = data;
};
jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
function() {
if (callbacks[callbackId].data) {
completeRequest(callback, 200, callbacks[callbackId].data);
} else {
completeRequest(callback, -2);
}
delete callbacks[callbackId];
});
} else {
var xhr = new XHR();
xhr.open(method, url, true);
forEach(headers, function(value, key) {
if (value) xhr.setRequestHeader(key, value);
});
var status;
// In IE6 and 7, this might be called synchronously when xhr.send below is called and the
// response is in the cache. the promise api will ensure that to the app code the api is
// always async
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
completeRequest(
callback, status || xhr.status, xhr.responseText, xhr.getAllResponseHeaders());
}
};
if (withCredentials) {
xhr.withCredentials = true;
}
xhr.send(post || '');
if (timeout > 0) {
$browserDefer(function() {
status = -1;
xhr.abort();
}, timeout);
}
}
function completeRequest(callback, status, response, headersString) {
// URL_MATCH is defined in src/service/location.js
var protocol = (url.match(URL_MATCH) || ['', locationProtocol])[1];
// fix status code for file protocol (it's always 0)
status = (protocol == 'file') ? (response ? 200 : 404) : status;
// normalize IE bug (http://bugs.jquery.com/ticket/1450)
status = status == 1223 ? 204 : status;
callback(status, response, headersString);
$browser.$$completeOutstandingRequest(noop);
}
};
function jsonpReq(url, done) {
// we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
// - fetches local scripts via XHR and evals them
// - adds and immediately removes script elements from the document
var script = rawDocument.createElement('script'),
doneWrapper = function() {
rawDocument.body.removeChild(script);
if (done) done();
};
script.type = 'text/javascript';
script.src = url;
if (msie) {
script.onreadystatechange = function() {
if (/loaded|complete/.test(script.readyState)) doneWrapper();
};
} else {
script.onload = script.onerror = doneWrapper;
}
rawDocument.body.appendChild(script);
}
}
/**
* @ngdoc object
* @name ng.$locale
*
* @description
* $locale service provides localization rules for various Angular components. As of right now the
* only public api is:
*
* * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
*/
function $LocaleProvider(){
this.$get = function() {
return {
id: 'en-us',
NUMBER_FORMATS: {
DECIMAL_SEP: '.',
GROUP_SEP: ',',
PATTERNS: [
{ // Decimal Pattern
minInt: 1,
minFrac: 0,
maxFrac: 3,
posPre: '',
posSuf: '',
negPre: '-',
negSuf: '',
gSize: 3,
lgSize: 3
},{ //Currency Pattern
minInt: 1,
minFrac: 2,
maxFrac: 2,
posPre: '\u00A4',
posSuf: '',
negPre: '(\u00A4',
negSuf: ')',
gSize: 3,
lgSize: 3
}
],
CURRENCY_SYM: '$'
},
DATETIME_FORMATS: {
MONTH: 'January,February,March,April,May,June,July,August,September,October,November,December'
.split(','),
SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
AMPMS: ['AM','PM'],
medium: 'MMM d, y h:mm:ss a',
short: 'M/d/yy h:mm a',
fullDate: 'EEEE, MMMM d, y',
longDate: 'MMMM d, y',
mediumDate: 'MMM d, y',
shortDate: 'M/d/yy',
mediumTime: 'h:mm:ss a',
shortTime: 'h:mm a'
},
pluralCat: function(num) {
if (num === 1) {
return 'one';
}
return 'other';
}
};
};
}
function $TimeoutProvider() {
this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',
function($rootScope, $browser, $q, $exceptionHandler) {
var deferreds = {};
/**
* @ngdoc function
* @name ng.$timeout
* @requires $browser
*
* @description
* Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
* block and delegates any exceptions to
* {@link ng.$exceptionHandler $exceptionHandler} service.
*
* The return value of registering a timeout function is a promise which will be resolved when
* the timeout is reached and the timeout function is executed.
*
* To cancel a the timeout request, call `$timeout.cancel(promise)`.
*
* In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
* synchronously flush the queue of deferred functions.
*
* @param {function()} fn A function, who's execution should be delayed.
* @param {number=} [delay=0] Delay in milliseconds.
* @param {boolean=} [invokeApply=true] If set to false skips model dirty checking, otherwise
* will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
* @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
* promise will be resolved with is the return value of the `fn` function.
*/
function timeout(fn, delay, invokeApply) {
var deferred = $q.defer(),
promise = deferred.promise,
skipApply = (isDefined(invokeApply) && !invokeApply),
timeoutId, cleanup;
timeoutId = $browser.defer(function() {
try {
deferred.resolve(fn());
} catch(e) {
deferred.reject(e);
$exceptionHandler(e);
}
if (!skipApply) $rootScope.$apply();
}, delay);
cleanup = function() {
delete deferreds[promise.$$timeoutId];
};
promise.$$timeoutId = timeoutId;
deferreds[timeoutId] = deferred;
promise.then(cleanup, cleanup);
return promise;
}
/**
* @ngdoc function
* @name ng.$timeout#cancel
* @methodOf ng.$timeout
*
* @description
* Cancels a task associated with the `promise`. As a result of this the promise will be
* resolved with a rejection.
*
* @param {Promise=} promise Promise returned by the `$timeout` function.
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
* canceled.
*/
timeout.cancel = function(promise) {
if (promise && promise.$$timeoutId in deferreds) {
deferreds[promise.$$timeoutId].reject('canceled');
return $browser.defer.cancel(promise.$$timeoutId);
}
return false;
};
return timeout;
}];
}
/**
* @ngdoc object
* @name ng.$filterProvider
* @description
*
* Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To
* achieve this a filter definition consists of a factory function which is annotated with dependencies and is
* responsible for creating a the filter function.
*
* <pre>
* // Filter registration
* function MyModule($provide, $filterProvider) {
* // create a service to demonstrate injection (not always needed)
* $provide.value('greet', function(name){
* return 'Hello ' + name + '!';
* });
*
* // register a filter factory which uses the
* // greet service to demonstrate DI.
* $filterProvider.register('greet', function(greet){
* // return the filter function which uses the greet service
* // to generate salutation
* return function(text) {
* // filters need to be forgiving so check input validity
* return text && greet(text) || text;
* };
* });
* }
* </pre>
*
* The filter function is registered with the `$injector` under the filter name suffixe with `Filter`.
* <pre>
* it('should be the same instance', inject(
* function($filterProvider) {
* $filterProvider.register('reverse', function(){
* return ...;
* });
* },
* function($filter, reverseFilter) {
* expect($filter('reverse')).toBe(reverseFilter);
* });
* </pre>
*
*
* For more information about how angular filters work, and how to create your own filters, see
* {@link guide/dev_guide.templates.filters Understanding Angular Filters} in the angular Developer
* Guide.
*/
/**
* @ngdoc method
* @name ng.$filterProvider#register
* @methodOf ng.$filterProvider
* @description
* Register filter factory function.
*
* @param {String} name Name of the filter.
* @param {function} fn The filter factory function which is injectable.
*/
/**
* @ngdoc function
* @name ng.$filter
* @function
* @description
* Filters are used for formatting data displayed to the user.
*
* The general syntax in templates is as follows:
*
* {{ expression | [ filter_name ] }}
*
* @param {String} name Name of the filter function to retrieve
* @return {Function} the filter function
*/
$FilterProvider.$inject = ['$provide'];
function $FilterProvider($provide) {
var suffix = 'Filter';
function register(name, factory) {
return $provide.factory(name + suffix, factory);
}
this.register = register;
this.$get = ['$injector', function($injector) {
return function(name) {
return $injector.get(name + suffix);
}
}];
////////////////////////////////////////
register('currency', currencyFilter);
register('date', dateFilter);
register('filter', filterFilter);
register('json', jsonFilter);
register('limitTo', limitToFilter);
register('lowercase', lowercaseFilter);
register('number', numberFilter);
register('orderBy', orderByFilter);
register('uppercase', uppercaseFilter);
}
/**
* @ngdoc filter
* @name ng.filter:filter
* @function
*
* @description
* Selects a subset of items from `array` and returns it as a new array.
*
* Note: This function is used to augment the `Array` type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.
*
* @param {Array} array The source array.
* @param {string|Object|function()} expression The predicate to be used for selecting items from
* `array`.
*
* Can be one of:
*
* - `string`: Predicate that results in a substring match using the value of `expression`
* string. All strings or objects with string properties in `array` that contain this string
* will be returned. The predicate can be negated by prefixing the string with `!`.
*
* - `Object`: A pattern object can be used to filter specific properties on objects contained
* by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
* which have property `name` containing "M" and property `phone` containing "1". A special
* property name `$` can be used (as in `{$:"text"}`) to accept a match against any
* property of the object. That's equivalent to the simple substring match with a `string`
* as described above.
*
* - `function`: A predicate function can be used to write arbitrary filters. The function is
* called for each element of `array`. The final result is an array of those elements that
* the predicate returned true for.
*
* @example
<doc:example>
<doc:source>
<div ng-init="friends = [{name:'John', phone:'555-1276'},
{name:'Mary', phone:'800-BIG-MARY'},
{name:'Mike', phone:'555-4321'},
{name:'Adam', phone:'555-5678'},
{name:'Julie', phone:'555-8765'}]"></div>
Search: <input ng-model="searchText">
<table id="searchTextResults">
<tr><th>Name</th><th>Phone</th><tr>
<tr ng-repeat="friend in friends | filter:searchText">
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
<tr>
</table>
<hr>
Any: <input ng-model="search.$"> <br>
Name only <input ng-model="search.name"><br>
Phone only <input ng-model="search.phone"å><br>
<table id="searchObjResults">
<tr><th>Name</th><th>Phone</th><tr>
<tr ng-repeat="friend in friends | filter:search">
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
<tr>
</table>
</doc:source>
<doc:scenario>
it('should search across all fields when filtering with a string', function() {
input('searchText').enter('m');
expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')).
toEqual(['Mary', 'Mike', 'Adam']);
input('searchText').enter('76');
expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')).
toEqual(['John', 'Julie']);
});
it('should search in specific fields when filtering with a predicate object', function() {
input('search.$').enter('i');
expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')).
toEqual(['Mary', 'Mike', 'Julie']);
});
</doc:scenario>
</doc:example>
*/
function filterFilter() {
return function(array, expression) {
if (!(array instanceof Array)) return array;
var predicates = [];
predicates.check = function(value) {
for (var j = 0; j < predicates.length; j++) {
if(!predicates[j](value)) {
return false;
}
}
return true;
};
var search = function(obj, text){
if (text.charAt(0) === '!') {
return !search(obj, text.substr(1));
}
switch (typeof obj) {
case "boolean":
case "number":
case "string":
return ('' + obj).toLowerCase().indexOf(text) > -1;
case "object":
for ( var objKey in obj) {
if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {
return true;
}
}
return false;
case "array":
for ( var i = 0; i < obj.length; i++) {
if (search(obj[i], text)) {
return true;
}
}
return false;
default:
return false;
}
};
switch (typeof expression) {
case "boolean":
case "number":
case "string":
expression = {$:expression};
case "object":
for (var key in expression) {
if (key == '$') {
(function() {
var text = (''+expression[key]).toLowerCase();
if (!text) return;
predicates.push(function(value) {
return search(value, text);
});
})();
} else {
(function() {
var path = key;
var text = (''+expression[key]).toLowerCase();
if (!text) return;
predicates.push(function(value) {
return search(getter(value, path), text);
});
})();
}
}
break;
case 'function':
predicates.push(expression);
break;
default:
return array;
}
var filtered = [];
for ( var j = 0; j < array.length; j++) {
var value = array[j];
if (predicates.check(value)) {
filtered.push(value);
}
}
return filtered;
}
}
/**
* @ngdoc filter
* @name ng.filter:currency
* @function
*
* @description
* Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
* symbol for current locale is used.
*
* @param {number} amount Input to filter.
* @param {string=} symbol Currency symbol or identifier to be displayed.
* @returns {string} Formatted number.
*
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.amount = 1234.56;
}
</script>
<div ng-controller="Ctrl">
<input type="number" ng-model="amount"> <br>
default currency symbol ($): {{amount | currency}}<br>
custom currency identifier (USD$): {{amount | currency:"USD$"}}
</div>
</doc:source>
<doc:scenario>
it('should init with 1234.56', function() {
expect(binding('amount | currency')).toBe('$1,234.56');
expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56');
});
it('should update', function() {
input('amount').enter('-1234');
expect(binding('amount | currency')).toBe('($1,234.00)');
expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)');
});
</doc:scenario>
</doc:example>
*/
currencyFilter.$inject = ['$locale'];
function currencyFilter($locale) {
var formats = $locale.NUMBER_FORMATS;
return function(amount, currencySymbol){
if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;
return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).
replace(/\u00A4/g, currencySymbol);
};
}
/**
* @ngdoc filter
* @name ng.filter:number
* @function
*
* @description
* Formats a number as text.
*
* If the input is not a number an empty string is returned.
*
* @param {number|string} number Number to format.
* @param {(number|string)=} [fractionSize=2] Number of decimal places to round the number to.
* @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.val = 1234.56789;
}
</script>
<div ng-controller="Ctrl">
Enter number: <input ng-model='val'><br>
Default formatting: {{val | number}}<br>
No fractions: {{val | number:0}}<br>
Negative number: {{-val | number:4}}
</div>
</doc:source>
<doc:scenario>
it('should format numbers', function() {
expect(binding('val | number')).toBe('1,234.568');
expect(binding('val | number:0')).toBe('1,235');
expect(binding('-val | number:4')).toBe('-1,234.5679');
});
it('should update', function() {
input('val').enter('3374.333');
expect(binding('val | number')).toBe('3,374.333');
expect(binding('val | number:0')).toBe('3,374');
expect(binding('-val | number:4')).toBe('-3,374.3330');
});
</doc:scenario>
</doc:example>
*/
numberFilter.$inject = ['$locale'];
function numberFilter($locale) {
var formats = $locale.NUMBER_FORMATS;
return function(number, fractionSize) {
return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
fractionSize);
};
}
var DECIMAL_SEP = '.';
function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
if (isNaN(number) || !isFinite(number)) return '';
var isNegative = number < 0;
number = Math.abs(number);
var numStr = number + '',
formatedText = '',
parts = [];
var hasExponent = false;
if (numStr.indexOf('e') !== -1) {
var match = numStr.match(/([\d\.]+)e(-?)(\d+)/);
if (match && match[2] == '-' && match[3] > fractionSize + 1) {
numStr = '0';
} else {
formatedText = numStr;
hasExponent = true;
}
}
if (!hasExponent) {
var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;
// determine fractionSize if it is not specified
if (isUndefined(fractionSize)) {
fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);
}
var pow = Math.pow(10, fractionSize);
number = Math.round(number * pow) / pow;
var fraction = ('' + number).split(DECIMAL_SEP);
var whole = fraction[0];
fraction = fraction[1] || '';
var pos = 0,
lgroup = pattern.lgSize,
group = pattern.gSize;
if (whole.length >= (lgroup + group)) {
pos = whole.length - lgroup;
for (var i = 0; i < pos; i++) {
if ((pos - i)%group === 0 && i !== 0) {
formatedText += groupSep;
}
formatedText += whole.charAt(i);
}
}
for (i = pos; i < whole.length; i++) {
if ((whole.length - i)%lgroup === 0 && i !== 0) {
formatedText += groupSep;
}
formatedText += whole.charAt(i);
}
// format fraction part.
while(fraction.length < fractionSize) {
fraction += '0';
}
if (fractionSize) formatedText += decimalSep + fraction.substr(0, fractionSize);
}
parts.push(isNegative ? pattern.negPre : pattern.posPre);
parts.push(formatedText);
parts.push(isNegative ? pattern.negSuf : pattern.posSuf);
return parts.join('');
}
function padNumber(num, digits, trim) {
var neg = '';
if (num < 0) {
neg = '-';
num = -num;
}
num = '' + num;
while(num.length < digits) num = '0' + num;
if (trim)
num = num.substr(num.length - digits);
return neg + num;
}
function dateGetter(name, size, offset, trim) {
return function(date) {
var value = date['get' + name]();
if (offset > 0 || value > -offset)
value += offset;
if (value === 0 && offset == -12 ) value = 12;
return padNumber(value, size, trim);
};
}
function dateStrGetter(name, shortForm) {
return function(date, formats) {
var value = date['get' + name]();
var get = uppercase(shortForm ? ('SHORT' + name) : name);
return formats[get][value];
};
}
function timeZoneGetter(date) {
var offset = date.getTimezoneOffset();
return padNumber(offset / 60, 2) + padNumber(Math.abs(offset % 60), 2);
}
function ampmGetter(date, formats) {
return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
}
var DATE_FORMATS = {
yyyy: dateGetter('FullYear', 4),
yy: dateGetter('FullYear', 2, 0, true),
y: dateGetter('FullYear', 1),
MMMM: dateStrGetter('Month'),
MMM: dateStrGetter('Month', true),
MM: dateGetter('Month', 2, 1),
M: dateGetter('Month', 1, 1),
dd: dateGetter('Date', 2),
d: dateGetter('Date', 1),
HH: dateGetter('Hours', 2),
H: dateGetter('Hours', 1),
hh: dateGetter('Hours', 2, -12),
h: dateGetter('Hours', 1, -12),
mm: dateGetter('Minutes', 2),
m: dateGetter('Minutes', 1),
ss: dateGetter('Seconds', 2),
s: dateGetter('Seconds', 1),
EEEE: dateStrGetter('Day'),
EEE: dateStrGetter('Day', true),
a: ampmGetter,
Z: timeZoneGetter
};
var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
NUMBER_STRING = /^\d+$/;
/**
* @ngdoc filter
* @name ng.filter:date
* @function
*
* @description
* Formats `date` to a string based on the requested `format`.
*
* `format` string can be composed of the following elements:
*
* * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
* * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
* * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
* * `'MMMM'`: Month in year (January-December)
* * `'MMM'`: Month in year (Jan-Dec)
* * `'MM'`: Month in year, padded (01-12)
* * `'M'`: Month in year (1-12)
* * `'dd'`: Day in month, padded (01-31)
* * `'d'`: Day in month (1-31)
* * `'EEEE'`: Day in Week,(Sunday-Saturday)
* * `'EEE'`: Day in Week, (Sun-Sat)
* * `'HH'`: Hour in day, padded (00-23)
* * `'H'`: Hour in day (0-23)
* * `'hh'`: Hour in am/pm, padded (01-12)
* * `'h'`: Hour in am/pm, (1-12)
* * `'mm'`: Minute in hour, padded (00-59)
* * `'m'`: Minute in hour (0-59)
* * `'ss'`: Second in minute, padded (00-59)
* * `'s'`: Second in minute (0-59)
* * `'a'`: am/pm marker
* * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-1200)
*
* `format` string can also be one of the following predefined
* {@link guide/i18n localizable formats}:
*
* * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
* (e.g. Sep 3, 2010 12:05:08 pm)
* * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 pm)
* * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US locale
* (e.g. Friday, September 3, 2010)
* * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010
* * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)
* * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
* * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)
* * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)
*
* `format` string can contain literal values. These need to be quoted with single quotes (e.g.
* `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence
* (e.g. `"h o''clock"`).
*
* @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
* number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and it's
* shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ).
* @param {string=} format Formatting rules (see Description). If not specified,
* `mediumDate` is used.
* @returns {string} Formatted string or the input if input is not recognized as date/millis.
*
* @example
<doc:example>
<doc:source>
<span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
{{1288323623006 | date:'medium'}}<br>
<span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}<br>
<span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}<br>
</doc:source>
<doc:scenario>
it('should format date', function() {
expect(binding("1288323623006 | date:'medium'")).
toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).
toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} \-?\d{4}/);
expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).
toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
});
</doc:scenario>
</doc:example>
*/
dateFilter.$inject = ['$locale'];
function dateFilter($locale) {
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
function jsonStringToDate(string){
var match;
if (match = string.match(R_ISO8601_STR)) {
var date = new Date(0),
tzHour = 0,
tzMin = 0;
if (match[9]) {
tzHour = int(match[9] + match[10]);
tzMin = int(match[9] + match[11]);
}
date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3]));
date.setUTCHours(int(match[4]||0) - tzHour, int(match[5]||0) - tzMin, int(match[6]||0), int(match[7]||0));
return date;
}
return string;
}
return function(date, format) {
var text = '',
parts = [],
fn, match;
format = format || 'mediumDate';
format = $locale.DATETIME_FORMATS[format] || format;
if (isString(date)) {
if (NUMBER_STRING.test(date)) {
date = int(date);
} else {
date = jsonStringToDate(date);
}
}
if (isNumber(date)) {
date = new Date(date);
}
if (!isDate(date)) {
return date;
}
while(format) {
match = DATE_FORMATS_SPLIT.exec(format);
if (match) {
parts = concat(parts, match, 1);
format = parts.pop();
} else {
parts.push(format);
format = null;
}
}
forEach(parts, function(value){
fn = DATE_FORMATS[value];
text += fn ? fn(date, $locale.DATETIME_FORMATS)
: value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
});
return text;
};
}
/**
* @ngdoc filter
* @name ng.filter:json
* @function
*
* @description
* Allows you to convert a JavaScript object into JSON string.
*
* This filter is mostly useful for debugging. When using the double curly {{value}} notation
* the binding is automatically converted to JSON.
*
* @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
* @returns {string} JSON string.
*
*
* @example:
<doc:example>
<doc:source>
<pre>{{ {'name':'value'} | json }}</pre>
</doc:source>
<doc:scenario>
it('should jsonify filtered objects', function() {
expect(binding("{'name':'value'}")).toMatch(/\{\n "name": ?"value"\n}/);
});
</doc:scenario>
</doc:example>
*
*/
function jsonFilter() {
return function(object) {
return toJson(object, true);
};
}
/**
* @ngdoc filter
* @name ng.filter:lowercase
* @function
* @description
* Converts string to lowercase.
* @see angular.lowercase
*/
var lowercaseFilter = valueFn(lowercase);
/**
* @ngdoc filter
* @name ng.filter:uppercase
* @function
* @description
* Converts string to uppercase.
* @see angular.uppercase
*/
var uppercaseFilter = valueFn(uppercase);
/**
* @ngdoc function
* @name ng.filter:limitTo
* @function
*
* @description
* Creates a new array containing only a specified number of elements in an array. The elements
* are taken from either the beginning or the end of the source array, as specified by the
* value and sign (positive or negative) of `limit`.
*
* Note: This function is used to augment the `Array` type in Angular expressions. See
* {@link ng.$filter} for more information about Angular arrays.
*
* @param {Array} array Source array to be limited.
* @param {string|Number} limit The length of the returned array. If the `limit` number is
* positive, `limit` number of items from the beginning of the source array are copied.
* If the number is negative, `limit` number of items from the end of the source array are
* copied. The `limit` will be trimmed if it exceeds `array.length`
* @returns {Array} A new sub-array of length `limit` or less if input array had less than `limit`
* elements.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.numbers = [1,2,3,4,5,6,7,8,9];
$scope.limit = 3;
}
</script>
<div ng-controller="Ctrl">
Limit {{numbers}} to: <input type="integer" ng-model="limit">
<p>Output: {{ numbers | limitTo:limit }}</p>
</div>
</doc:source>
<doc:scenario>
it('should limit the numer array to first three items', function() {
expect(element('.doc-example-live input[ng-model=limit]').val()).toBe('3');
expect(binding('numbers | limitTo:limit')).toEqual('[1,2,3]');
});
it('should update the output when -3 is entered', function() {
input('limit').enter(-3);
expect(binding('numbers | limitTo:limit')).toEqual('[7,8,9]');
});
it('should not exceed the maximum size of input array', function() {
input('limit').enter(100);
expect(binding('numbers | limitTo:limit')).toEqual('[1,2,3,4,5,6,7,8,9]');
});
</doc:scenario>
</doc:example>
*/
function limitToFilter(){
return function(array, limit) {
if (!(array instanceof Array)) return array;
limit = int(limit);
var out = [],
i, n;
// check that array is iterable
if (!array || !(array instanceof Array))
return out;
// if abs(limit) exceeds maximum length, trim it
if (limit > array.length)
limit = array.length;
else if (limit < -array.length)
limit = -array.length;
if (limit > 0) {
i = 0;
n = limit;
} else {
i = array.length + limit;
n = array.length;
}
for (; i<n; i++) {
out.push(array[i]);
}
return out;
}
}
/**
* @ngdoc function
* @name ng.filter:orderBy
* @function
*
* @description
* Orders a specified `array` by the `expression` predicate.
*
* Note: this function is used to augment the `Array` type in Angular expressions. See
* {@link ng.$filter} for more informaton about Angular arrays.
*
* @param {Array} array The array to sort.
* @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be
* used by the comparator to determine the order of elements.
*
* Can be one of:
*
* - `function`: Getter function. The result of this function will be sorted using the
* `<`, `=`, `>` operator.
* - `string`: An Angular expression which evaluates to an object to order by, such as 'name'
* to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control
* ascending or descending sort order (for example, +name or -name).
* - `Array`: An array of function or string predicates. The first predicate in the array
* is used for sorting, but when two items are equivalent, the next predicate is used.
*
* @param {boolean=} reverse Reverse the order the array.
* @returns {Array} Sorted copy of the source array.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.friends =
[{name:'John', phone:'555-1212', age:10},
{name:'Mary', phone:'555-9876', age:19},
{name:'Mike', phone:'555-4321', age:21},
{name:'Adam', phone:'555-5678', age:35},
{name:'Julie', phone:'555-8765', age:29}]
$scope.predicate = '-age';
}
</script>
<div ng-controller="Ctrl">
<pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
<hr/>
[ <a href="" ng-click="predicate=''">unsorted</a> ]
<table class="friend">
<tr>
<th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a>
(<a href ng-click="predicate = '-name'; reverse=false">^</a>)</th>
<th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
<th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th>
<tr>
<tr ng-repeat="friend in friends | orderBy:predicate:reverse">
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
<td>{{friend.age}}</td>
<tr>
</table>
</div>
</doc:source>
<doc:scenario>
it('should be reverse ordered by aged', function() {
expect(binding('predicate')).toBe('-age');
expect(repeater('table.friend', 'friend in friends').column('friend.age')).
toEqual(['35', '29', '21', '19', '10']);
expect(repeater('table.friend', 'friend in friends').column('friend.name')).
toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']);
});
it('should reorder the table when user selects different predicate', function() {
element('.doc-example-live a:contains("Name")').click();
expect(repeater('table.friend', 'friend in friends').column('friend.name')).
toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']);
expect(repeater('table.friend', 'friend in friends').column('friend.age')).
toEqual(['35', '10', '29', '19', '21']);
element('.doc-example-live a:contains("Phone")').click();
expect(repeater('table.friend', 'friend in friends').column('friend.phone')).
toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']);
expect(repeater('table.friend', 'friend in friends').column('friend.name')).
toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']);
});
</doc:scenario>
</doc:example>
*/
orderByFilter.$inject = ['$parse'];
function orderByFilter($parse){
return function(array, sortPredicate, reverseOrder) {
if (!(array instanceof Array)) return array;
if (!sortPredicate) return array;
sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
sortPredicate = map(sortPredicate, function(predicate){
var descending = false, get = predicate || identity;
if (isString(predicate)) {
if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
descending = predicate.charAt(0) == '-';
predicate = predicate.substring(1);
}
get = $parse(predicate);
}
return reverseComparator(function(a,b){
return compare(get(a),get(b));
}, descending);
});
var arrayCopy = [];
for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
return arrayCopy.sort(reverseComparator(comparator, reverseOrder));
function comparator(o1, o2){
for ( var i = 0; i < sortPredicate.length; i++) {
var comp = sortPredicate[i](o1, o2);
if (comp !== 0) return comp;
}
return 0;
}
function reverseComparator(comp, descending) {
return toBoolean(descending)
? function(a,b){return comp(b,a);}
: comp;
}
function compare(v1, v2){
var t1 = typeof v1;
var t2 = typeof v2;
if (t1 == t2) {
if (t1 == "string") v1 = v1.toLowerCase();
if (t1 == "string") v2 = v2.toLowerCase();
if (v1 === v2) return 0;
return v1 < v2 ? -1 : 1;
} else {
return t1 < t2 ? -1 : 1;
}
}
}
}
function ngDirective(directive) {
if (isFunction(directive)) {
directive = {
link: directive
}
}
directive.restrict = directive.restrict || 'AC';
return valueFn(directive);
}
/**
* @ngdoc directive
* @name ng.directive:a
* @restrict E
*
* @description
* Modifies the default behavior of html A tag, so that the default action is prevented when href
* attribute is empty.
*
* The reasoning for this change is to allow easy creation of action links with `ngClick` directive
* without changing the location or causing page reloads, e.g.:
* <a href="" ng-click="model.$save()">Save</a>
*/
var htmlAnchorDirective = valueFn({
restrict: 'E',
compile: function(element, attr) {
// turn <a href ng-click="..">link</a> into a link in IE
// but only if it doesn't have name attribute, in which case it's an anchor
if (!attr.href) {
attr.$set('href', '');
}
return function(scope, element) {
element.bind('click', function(event){
// if we have no href url, then don't navigate anywhere.
if (!element.attr('href')) {
event.preventDefault();
}
});
}
}
});
/**
* @ngdoc directive
* @name ng.directive:ngHref
* @restrict A
*
* @description
* Using Angular markup like {{hash}} in an href attribute makes
* the page open to a wrong URL, if the user clicks that link before
* angular has a chance to replace the {{hash}} with actual URL, the
* link will be broken and will most likely return a 404 error.
* The `ngHref` directive solves this problem.
*
* The buggy way to write it:
* <pre>
* <a href="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* The correct way to write it:
* <pre>
* <a ng-href="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* @element A
* @param {template} ngHref any string which can contain `{{}}` markup.
*
* @example
* This example uses `link` variable inside `href` attribute:
<doc:example>
<doc:source>
<input ng-model="value" /><br />
<a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
<a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
<a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
<a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
<a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
<a id="link-6" ng-href="{{value}}">link</a> (link, change location)
</doc:source>
<doc:scenario>
it('should execute ng-click but not reload when href without value', function() {
element('#link-1').click();
expect(input('value').val()).toEqual('1');
expect(element('#link-1').attr('href')).toBe("");
});
it('should execute ng-click but not reload when href empty string', function() {
element('#link-2').click();
expect(input('value').val()).toEqual('2');
expect(element('#link-2').attr('href')).toBe("");
});
it('should execute ng-click and change url when ng-href specified', function() {
expect(element('#link-3').attr('href')).toBe("/123");
element('#link-3').click();
expect(browser().window().path()).toEqual('/123');
});
it('should execute ng-click but not reload when href empty string and name specified', function() {
element('#link-4').click();
expect(input('value').val()).toEqual('4');
expect(element('#link-4').attr('href')).toBe('');
});
it('should execute ng-click but not reload when no href but name specified', function() {
element('#link-5').click();
expect(input('value').val()).toEqual('5');
expect(element('#link-5').attr('href')).toBe('');
});
it('should only change url when only ng-href', function() {
input('value').enter('6');
expect(element('#link-6').attr('href')).toBe('6');
element('#link-6').click();
expect(browser().location().url()).toEqual('/6');
});
</doc:scenario>
</doc:example>
*/
/**
* @ngdoc directive
* @name ng.directive:ngSrc
* @restrict A
*
* @description
* Using Angular markup like `{{hash}}` in a `src` attribute doesn't
* work right: The browser will fetch from the URL with the literal
* text `{{hash}}` until Angular replaces the expression inside
* `{{hash}}`. The `ngSrc` directive solves this problem.
*
* The buggy way to write it:
* <pre>
* <img src="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* The correct way to write it:
* <pre>
* <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>
* </pre>
*
* @element IMG
* @param {template} ngSrc any string which can contain `{{}}` markup.
*/
/**
* @ngdoc directive
* @name ng.directive:ngDisabled
* @restrict A
*
* @description
*
* The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:
* <pre>
* <div ng-init="scope = { isDisabled: false }">
* <button disabled="{{scope.isDisabled}}">Disabled</button>
* </div>
* </pre>
*
* The HTML specs do not require browsers to preserve the special attributes such as disabled.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngDisabled` directive.
*
* @example
<doc:example>
<doc:source>
Click me to toggle: <input type="checkbox" ng-model="checked"><br/>
<button ng-model="button" ng-disabled="checked">Button</button>
</doc:source>
<doc:scenario>
it('should toggle button', function() {
expect(element('.doc-example-live :button').prop('disabled')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live :button').prop('disabled')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element INPUT
* @param {expression} ngDisabled Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngChecked
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as checked.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngChecked` directive.
* @example
<doc:example>
<doc:source>
Check me to check both: <input type="checkbox" ng-model="master"><br/>
<input id="checkSlave" type="checkbox" ng-checked="master">
</doc:source>
<doc:scenario>
it('should check both checkBoxes', function() {
expect(element('.doc-example-live #checkSlave').prop('checked')).toBeFalsy();
input('master').check();
expect(element('.doc-example-live #checkSlave').prop('checked')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element INPUT
* @param {expression} ngChecked Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngMultiple
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as multiple.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngMultiple` directive.
*
* @example
<doc:example>
<doc:source>
Check me check multiple: <input type="checkbox" ng-model="checked"><br/>
<select id="select" ng-multiple="checked">
<option>Misko</option>
<option>Igor</option>
<option>Vojta</option>
<option>Di</option>
</select>
</doc:source>
<doc:scenario>
it('should toggle multiple', function() {
expect(element('.doc-example-live #select').prop('multiple')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live #select').prop('multiple')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element SELECT
* @param {expression} ngMultiple Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngReadonly
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as readonly.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduce the `ngReadonly` directive.
* @example
<doc:example>
<doc:source>
Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/>
<input type="text" ng-readonly="checked" value="I'm Angular"/>
</doc:source>
<doc:scenario>
it('should toggle readonly attr', function() {
expect(element('.doc-example-live :text').prop('readonly')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live :text').prop('readonly')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element INPUT
* @param {string} expression Angular expression that will be evaluated.
*/
/**
* @ngdoc directive
* @name ng.directive:ngSelected
* @restrict A
*
* @description
* The HTML specs do not require browsers to preserve the special attributes such as selected.
* (The presence of them means true and absence means false)
* This prevents the angular compiler from correctly retrieving the binding expression.
* To solve this problem, we introduced the `ngSelected` directive.
* @example
<doc:example>
<doc:source>
Check me to select: <input type="checkbox" ng-model="selected"><br/>
<select>
<option>Hello!</option>
<option id="greet" ng-selected="selected">Greetings!</option>
</select>
</doc:source>
<doc:scenario>
it('should select Greetings!', function() {
expect(element('.doc-example-live #greet').prop('selected')).toBeFalsy();
input('selected').check();
expect(element('.doc-example-live #greet').prop('selected')).toBeTruthy();
});
</doc:scenario>
</doc:example>
*
* @element OPTION
* @param {string} expression Angular expression that will be evaluated.
*/
var ngAttributeAliasDirectives = {};
// boolean attrs are evaluated
forEach(BOOLEAN_ATTR, function(propName, attrName) {
var normalized = directiveNormalize('ng-' + attrName);
ngAttributeAliasDirectives[normalized] = function() {
return {
priority: 100,
compile: function() {
return function(scope, element, attr) {
scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
attr.$set(attrName, !!value);
});
};
}
};
};
});
// ng-src, ng-href are interpolated
forEach(['src', 'href'], function(attrName) {
var normalized = directiveNormalize('ng-' + attrName);
ngAttributeAliasDirectives[normalized] = function() {
return {
priority: 99, // it needs to run after the attributes are interpolated
link: function(scope, element, attr) {
attr.$observe(normalized, function(value) {
if (!value)
return;
attr.$set(attrName, value);
// on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
// then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
// to set the property as well to achieve the desired effect
if (msie) element.prop(attrName, value);
});
}
};
};
});
var nullFormCtrl = {
$addControl: noop,
$removeControl: noop,
$setValidity: noop,
$setDirty: noop
};
/**
* @ngdoc object
* @name ng.directive:form.FormController
*
* @property {boolean} $pristine True if user has not interacted with the form yet.
* @property {boolean} $dirty True if user has already interacted with the form.
* @property {boolean} $valid True if all of the containing forms and controls are valid.
* @property {boolean} $invalid True if at least one containing control or form is invalid.
*
* @property {Object} $error Is an object hash, containing references to all invalid controls or
* forms, where:
*
* - keys are validation tokens (error names) — such as `required`, `url` or `email`),
* - values are arrays of controls or forms that are invalid with given error.
*
* @description
* `FormController` keeps track of all its controls and nested forms as well as state of them,
* such as being valid/invalid or dirty/pristine.
*
* Each {@link ng.directive:form form} directive creates an instance
* of `FormController`.
*
*/
//asks for $scope to fool the BC controller module
FormController.$inject = ['$element', '$attrs', '$scope'];
function FormController(element, attrs) {
var form = this,
parentForm = element.parent().controller('form') || nullFormCtrl,
invalidCount = 0, // used to easily determine if we are valid
errors = form.$error = {};
// init state
form.$name = attrs.name;
form.$dirty = false;
form.$pristine = true;
form.$valid = true;
form.$invalid = false;
parentForm.$addControl(form);
// Setup initial state of the control
element.addClass(PRISTINE_CLASS);
toggleValidCss(true);
// convenience method for easy toggling of classes
function toggleValidCss(isValid, validationErrorKey) {
validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
element.
removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey).
addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
}
form.$addControl = function(control) {
if (control.$name && !form.hasOwnProperty(control.$name)) {
form[control.$name] = control;
}
};
form.$removeControl = function(control) {
if (control.$name && form[control.$name] === control) {
delete form[control.$name];
}
forEach(errors, function(queue, validationToken) {
form.$setValidity(validationToken, true, control);
});
};
form.$setValidity = function(validationToken, isValid, control) {
var queue = errors[validationToken];
if (isValid) {
if (queue) {
arrayRemove(queue, control);
if (!queue.length) {
invalidCount--;
if (!invalidCount) {
toggleValidCss(isValid);
form.$valid = true;
form.$invalid = false;
}
errors[validationToken] = false;
toggleValidCss(true, validationToken);
parentForm.$setValidity(validationToken, true, form);
}
}
} else {
if (!invalidCount) {
toggleValidCss(isValid);
}
if (queue) {
if (includes(queue, control)) return;
} else {
errors[validationToken] = queue = [];
invalidCount++;
toggleValidCss(false, validationToken);
parentForm.$setValidity(validationToken, false, form);
}
queue.push(control);
form.$valid = false;
form.$invalid = true;
}
};
form.$setDirty = function() {
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
form.$dirty = true;
form.$pristine = false;
parentForm.$setDirty();
};
}
/**
* @ngdoc directive
* @name ng.directive:ngForm
* @restrict EAC
*
* @description
* Nestable alias of {@link ng.directive:form `form`} directive. HTML
* does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
* sub-group of controls needs to be determined.
*
* @param {string=} name|ngForm Name of the form. If specified, the form controller will be published into
* related scope, under this name.
*
*/
/**
* @ngdoc directive
* @name ng.directive:form
* @restrict E
*
* @description
* Directive that instantiates
* {@link ng.directive:form.FormController FormController}.
*
* If `name` attribute is specified, the form controller is published onto the current scope under
* this name.
*
* # Alias: {@link ng.directive:ngForm `ngForm`}
*
* In angular forms can be nested. This means that the outer form is valid when all of the child
* forms are valid as well. However browsers do not allow nesting of `<form>` elements, for this
* reason angular provides {@link ng.directive:ngForm `ngForm`} alias
* which behaves identical to `<form>` but allows form nesting.
*
*
* # CSS classes
* - `ng-valid` Is set if the form is valid.
* - `ng-invalid` Is set if the form is invalid.
* - `ng-pristine` Is set if the form is pristine.
* - `ng-dirty` Is set if the form is dirty.
*
*
* # Submitting a form and preventing default action
*
* Since the role of forms in client-side Angular applications is different than in classical
* roundtrip apps, it is desirable for the browser not to translate the form submission into a full
* page reload that sends the data to the server. Instead some javascript logic should be triggered
* to handle the form submission in application specific way.
*
* For this reason, Angular prevents the default action (form submission to the server) unless the
* `<form>` element has an `action` attribute specified.
*
* You can use one of the following two ways to specify what javascript method should be called when
* a form is submitted:
*
* - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
* - {@link ng.directive:ngClick ngClick} directive on the first
* button or input field of type submit (input[type=submit])
*
* To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This
* is because of the following form submission rules coming from the html spec:
*
* - If a form has only one input field then hitting enter in this field triggers form submit
* (`ngSubmit`)
* - if a form has has 2+ input fields and no buttons or input[type=submit] then hitting enter
* doesn't trigger submit
* - if a form has one or more input fields and one or more buttons or input[type=submit] then
* hitting enter in any of the input fields will trigger the click handler on the *first* button or
* input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
*
* @param {string=} name Name of the form. If specified, the form controller will be published into
* related scope, under this name.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.userType = 'guest';
}
</script>
<form name="myForm" ng-controller="Ctrl">
userType: <input name="input" ng-model="userType" required>
<span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
<tt>userType = {{userType}}</tt><br>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('userType')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('userType').enter('');
expect(binding('userType')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
var formDirectiveFactory = function(isNgForm) {
return ['$timeout', function($timeout) {
var formDirective = {
name: 'form',
restrict: 'E',
controller: FormController,
compile: function() {
return {
pre: function(scope, formElement, attr, controller) {
if (!attr.action) {
// we can't use jq events because if a form is destroyed during submission the default
// action is not prevented. see #1238
//
// IE 9 is not affected because it doesn't fire a submit event and try to do a full
// page reload if the form was destroyed by submission of the form via a click handler
// on a button in the form. Looks like an IE9 specific bug.
var preventDefaultListener = function(event) {
event.preventDefault
? event.preventDefault()
: event.returnValue = false; // IE
};
addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
// unregister the preventDefault listener so that we don't not leak memory but in a
// way that will achieve the prevention of the default action.
formElement.bind('$destroy', function() {
$timeout(function() {
removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
}, 0, false);
});
}
var parentFormCtrl = formElement.parent().controller('form'),
alias = attr.name || attr.ngForm;
if (alias) {
scope[alias] = controller;
}
if (parentFormCtrl) {
formElement.bind('$destroy', function() {
parentFormCtrl.$removeControl(controller);
if (alias) {
scope[alias] = undefined;
}
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
});
}
}
};
}
};
return isNgForm ? extend(copy(formDirective), {restrict: 'EAC'}) : formDirective;
}];
};
var formDirective = formDirectiveFactory();
var ngFormDirective = formDirectiveFactory(true);
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
var inputType = {
/**
* @ngdoc inputType
* @name ng.directive:input.text
*
* @description
* Standard HTML text input with angular data binding.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Adds `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.text = 'guest';
$scope.word = /^\w*$/;
}
</script>
<form name="myForm" ng-controller="Ctrl">
Single word: <input type="text" name="input" ng-model="text"
ng-pattern="word" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.pattern">
Single word only!</span>
<tt>text = {{text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('text')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if multi word', function() {
input('text').enter('hello world');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'text': textInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.number
*
* @description
* Text input with number validation and transformation. Sets the `number` validation
* error if not a valid number.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} min Sets the `min` validation error key if the value entered is less then `min`.
* @param {string=} max Sets the `max` validation error key if the value entered is greater then `min`.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.value = 12;
}
</script>
<form name="myForm" ng-controller="Ctrl">
Number: <input type="number" name="input" ng-model="value"
min="0" max="99" required>
<span class="error" ng-show="myForm.list.$error.required">
Required!</span>
<span class="error" ng-show="myForm.list.$error.number">
Not valid number!</span>
<tt>value = {{value}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('value')).toEqual('12');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('value').enter('');
expect(binding('value')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if over max', function() {
input('value').enter('123');
expect(binding('value')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'number': numberInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.url
*
* @description
* Text input with URL validation. Sets the `url` validation error key if the content is not a
* valid URL.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.text = 'http://google.com';
}
</script>
<form name="myForm" ng-controller="Ctrl">
URL: <input type="url" name="input" ng-model="text" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.url">
Not valid url!</span>
<tt>text = {{text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
<tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('text')).toEqual('http://google.com');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if not url', function() {
input('text').enter('xxx');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'url': urlInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.email
*
* @description
* Text input with email validation. Sets the `email` validation error key if not a valid email
* address.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.text = '[email protected]';
}
</script>
<form name="myForm" ng-controller="Ctrl">
Email: <input type="email" name="input" ng-model="text" required>
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.input.$error.email">
Not valid email!</span>
<tt>text = {{text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
<tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('text')).toEqual('[email protected]');
expect(binding('myForm.input.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('text').enter('');
expect(binding('text')).toEqual('');
expect(binding('myForm.input.$valid')).toEqual('false');
});
it('should be invalid if not email', function() {
input('text').enter('xxx');
expect(binding('myForm.input.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
'email': emailInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.radio
*
* @description
* HTML radio button.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string} value The value to which the expression should be set when selected.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.color = 'blue';
}
</script>
<form name="myForm" ng-controller="Ctrl">
<input type="radio" ng-model="color" value="red"> Red <br/>
<input type="radio" ng-model="color" value="green"> Green <br/>
<input type="radio" ng-model="color" value="blue"> Blue <br/>
<tt>color = {{color}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should change state', function() {
expect(binding('color')).toEqual('blue');
input('color').select('red');
expect(binding('color')).toEqual('red');
});
</doc:scenario>
</doc:example>
*/
'radio': radioInputType,
/**
* @ngdoc inputType
* @name ng.directive:input.checkbox
*
* @description
* HTML checkbox.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} ngTrueValue The value to which the expression should be set when selected.
* @param {string=} ngFalseValue The value to which the expression should be set when not selected.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.value1 = true;
$scope.value2 = 'YES'
}
</script>
<form name="myForm" ng-controller="Ctrl">
Value1: <input type="checkbox" ng-model="value1"> <br/>
Value2: <input type="checkbox" ng-model="value2"
ng-true-value="YES" ng-false-value="NO"> <br/>
<tt>value1 = {{value1}}</tt><br/>
<tt>value2 = {{value2}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should change state', function() {
expect(binding('value1')).toEqual('true');
expect(binding('value2')).toEqual('YES');
input('value1').check();
input('value2').check();
expect(binding('value1')).toEqual('false');
expect(binding('value2')).toEqual('NO');
});
</doc:scenario>
</doc:example>
*/
'checkbox': checkboxInputType,
'hidden': noop,
'button': noop,
'submit': noop,
'reset': noop
};
function isEmpty(value) {
return isUndefined(value) || value === '' || value === null || value !== value;
}
function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
var listener = function() {
var value = trim(element.val());
if (ctrl.$viewValue !== value) {
scope.$apply(function() {
ctrl.$setViewValue(value);
});
}
};
// if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
// input event on backspace, delete or cut
if ($sniffer.hasEvent('input')) {
element.bind('input', listener);
} else {
var timeout;
element.bind('keydown', function(event) {
var key = event.keyCode;
// ignore
// command modifiers arrows
if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
if (!timeout) {
timeout = $browser.defer(function() {
listener();
timeout = null;
});
}
});
// if user paste into input using mouse, we need "change" event to catch it
element.bind('change', listener);
}
ctrl.$render = function() {
element.val(isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);
};
// pattern validator
var pattern = attr.ngPattern,
patternValidator;
var validate = function(regexp, value) {
if (isEmpty(value) || regexp.test(value)) {
ctrl.$setValidity('pattern', true);
return value;
} else {
ctrl.$setValidity('pattern', false);
return undefined;
}
};
if (pattern) {
if (pattern.match(/^\/(.*)\/$/)) {
pattern = new RegExp(pattern.substr(1, pattern.length - 2));
patternValidator = function(value) {
return validate(pattern, value)
};
} else {
patternValidator = function(value) {
var patternObj = scope.$eval(pattern);
if (!patternObj || !patternObj.test) {
throw new Error('Expected ' + pattern + ' to be a RegExp but was ' + patternObj);
}
return validate(patternObj, value);
};
}
ctrl.$formatters.push(patternValidator);
ctrl.$parsers.push(patternValidator);
}
// min length validator
if (attr.ngMinlength) {
var minlength = int(attr.ngMinlength);
var minLengthValidator = function(value) {
if (!isEmpty(value) && value.length < minlength) {
ctrl.$setValidity('minlength', false);
return undefined;
} else {
ctrl.$setValidity('minlength', true);
return value;
}
};
ctrl.$parsers.push(minLengthValidator);
ctrl.$formatters.push(minLengthValidator);
}
// max length validator
if (attr.ngMaxlength) {
var maxlength = int(attr.ngMaxlength);
var maxLengthValidator = function(value) {
if (!isEmpty(value) && value.length > maxlength) {
ctrl.$setValidity('maxlength', false);
return undefined;
} else {
ctrl.$setValidity('maxlength', true);
return value;
}
};
ctrl.$parsers.push(maxLengthValidator);
ctrl.$formatters.push(maxLengthValidator);
}
}
function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
ctrl.$parsers.push(function(value) {
var empty = isEmpty(value);
if (empty || NUMBER_REGEXP.test(value)) {
ctrl.$setValidity('number', true);
return value === '' ? null : (empty ? value : parseFloat(value));
} else {
ctrl.$setValidity('number', false);
return undefined;
}
});
ctrl.$formatters.push(function(value) {
return isEmpty(value) ? '' : '' + value;
});
if (attr.min) {
var min = parseFloat(attr.min);
var minValidator = function(value) {
if (!isEmpty(value) && value < min) {
ctrl.$setValidity('min', false);
return undefined;
} else {
ctrl.$setValidity('min', true);
return value;
}
};
ctrl.$parsers.push(minValidator);
ctrl.$formatters.push(minValidator);
}
if (attr.max) {
var max = parseFloat(attr.max);
var maxValidator = function(value) {
if (!isEmpty(value) && value > max) {
ctrl.$setValidity('max', false);
return undefined;
} else {
ctrl.$setValidity('max', true);
return value;
}
};
ctrl.$parsers.push(maxValidator);
ctrl.$formatters.push(maxValidator);
}
ctrl.$formatters.push(function(value) {
if (isEmpty(value) || isNumber(value)) {
ctrl.$setValidity('number', true);
return value;
} else {
ctrl.$setValidity('number', false);
return undefined;
}
});
}
function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
var urlValidator = function(value) {
if (isEmpty(value) || URL_REGEXP.test(value)) {
ctrl.$setValidity('url', true);
return value;
} else {
ctrl.$setValidity('url', false);
return undefined;
}
};
ctrl.$formatters.push(urlValidator);
ctrl.$parsers.push(urlValidator);
}
function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
var emailValidator = function(value) {
if (isEmpty(value) || EMAIL_REGEXP.test(value)) {
ctrl.$setValidity('email', true);
return value;
} else {
ctrl.$setValidity('email', false);
return undefined;
}
};
ctrl.$formatters.push(emailValidator);
ctrl.$parsers.push(emailValidator);
}
function radioInputType(scope, element, attr, ctrl) {
// make the name unique, if not defined
if (isUndefined(attr.name)) {
element.attr('name', nextUid());
}
element.bind('click', function() {
if (element[0].checked) {
scope.$apply(function() {
ctrl.$setViewValue(attr.value);
});
}
});
ctrl.$render = function() {
var value = attr.value;
element[0].checked = (value == ctrl.$viewValue);
};
attr.$observe('value', ctrl.$render);
}
function checkboxInputType(scope, element, attr, ctrl) {
var trueValue = attr.ngTrueValue,
falseValue = attr.ngFalseValue;
if (!isString(trueValue)) trueValue = true;
if (!isString(falseValue)) falseValue = false;
element.bind('click', function() {
scope.$apply(function() {
ctrl.$setViewValue(element[0].checked);
});
});
ctrl.$render = function() {
element[0].checked = ctrl.$viewValue;
};
ctrl.$formatters.push(function(value) {
return value === trueValue;
});
ctrl.$parsers.push(function(value) {
return value ? trueValue : falseValue;
});
}
/**
* @ngdoc directive
* @name ng.directive:textarea
* @restrict E
*
* @description
* HTML textarea element control with angular data-binding. The data-binding and validation
* properties of this element are exactly the same as those of the
* {@link ng.directive:input input element}.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*/
/**
* @ngdoc directive
* @name ng.directive:input
* @restrict E
*
* @description
* HTML input element control with angular data-binding. Input control follows HTML5 input types
* and polyfills the HTML5 validation behavior for older browsers.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} required Sets `required` validation error key if the value is not entered.
* @param {boolean=} ngRequired Sets `required` attribute if set to true
* @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
* minlength.
* @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
* maxlength.
* @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
* RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
* patterns defined as scope expressions.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.user = {name: 'guest', last: 'visitor'};
}
</script>
<div ng-controller="Ctrl">
<form name="myForm">
User name: <input type="text" name="userName" ng-model="user.name" required>
<span class="error" ng-show="myForm.userName.$error.required">
Required!</span><br>
Last name: <input type="text" name="lastName" ng-model="user.last"
ng-minlength="3" ng-maxlength="10">
<span class="error" ng-show="myForm.lastName.$error.minlength">
Too short!</span>
<span class="error" ng-show="myForm.lastName.$error.maxlength">
Too long!</span><br>
</form>
<hr>
<tt>user = {{user}}</tt><br/>
<tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>
<tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>
<tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>
<tt>myForm.userName.$error = {{myForm.lastName.$error}}</tt><br>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
<tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>
<tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>
</div>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('user')).toEqual('{"name":"guest","last":"visitor"}');
expect(binding('myForm.userName.$valid')).toEqual('true');
expect(binding('myForm.$valid')).toEqual('true');
});
it('should be invalid if empty when required', function() {
input('user.name').enter('');
expect(binding('user')).toEqual('{"last":"visitor"}');
expect(binding('myForm.userName.$valid')).toEqual('false');
expect(binding('myForm.$valid')).toEqual('false');
});
it('should be valid if empty when min length is set', function() {
input('user.last').enter('');
expect(binding('user')).toEqual('{"name":"guest","last":""}');
expect(binding('myForm.lastName.$valid')).toEqual('true');
expect(binding('myForm.$valid')).toEqual('true');
});
it('should be invalid if less than required min length', function() {
input('user.last').enter('xx');
expect(binding('user')).toEqual('{"name":"guest"}');
expect(binding('myForm.lastName.$valid')).toEqual('false');
expect(binding('myForm.lastName.$error')).toMatch(/minlength/);
expect(binding('myForm.$valid')).toEqual('false');
});
it('should be invalid if longer than max length', function() {
input('user.last').enter('some ridiculously long name');
expect(binding('user'))
.toEqual('{"name":"guest"}');
expect(binding('myForm.lastName.$valid')).toEqual('false');
expect(binding('myForm.lastName.$error')).toMatch(/maxlength/);
expect(binding('myForm.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {
return {
restrict: 'E',
require: '?ngModel',
link: function(scope, element, attr, ctrl) {
if (ctrl) {
(inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer,
$browser);
}
}
};
}];
var VALID_CLASS = 'ng-valid',
INVALID_CLASS = 'ng-invalid',
PRISTINE_CLASS = 'ng-pristine',
DIRTY_CLASS = 'ng-dirty';
/**
* @ngdoc object
* @name ng.directive:ngModel.NgModelController
*
* @property {string} $viewValue Actual string value in the view.
* @property {*} $modelValue The value in the model, that the control is bound to.
* @property {Array.<Function>} $parsers Whenever the control reads value from the DOM, it executes
* all of these functions to sanitize / convert the value as well as validate.
*
* @property {Array.<Function>} $formatters Whenever the model value changes, it executes all of
* these functions to convert the value as well as validate.
*
* @property {Object} $error An bject hash with all errors as keys.
*
* @property {boolean} $pristine True if user has not interacted with the control yet.
* @property {boolean} $dirty True if user has already interacted with the control.
* @property {boolean} $valid True if there is no error.
* @property {boolean} $invalid True if at least one error on the control.
*
* @description
*
* `NgModelController` provides API for the `ng-model` directive. The controller contains
* services for data-binding, validation, CSS update, value formatting and parsing. It
* specifically does not contain any logic which deals with DOM rendering or listening to
* DOM events. The `NgModelController` is meant to be extended by other directives where, the
* directive provides DOM manipulation and the `NgModelController` provides the data-binding.
*
* This example shows how to use `NgModelController` with a custom control to achieve
* data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
* collaborate together to achieve the desired result.
*
* <example module="customControl">
<file name="style.css">
[contenteditable] {
border: 1px solid black;
background-color: white;
min-height: 20px;
}
.ng-invalid {
border: 1px solid red;
}
</file>
<file name="script.js">
angular.module('customControl', []).
directive('contenteditable', function() {
return {
restrict: 'A', // only activate on element attribute
require: '?ngModel', // get a hold of NgModelController
link: function(scope, element, attrs, ngModel) {
if(!ngModel) return; // do nothing if no ng-model
// Specify how UI should be updated
ngModel.$render = function() {
element.html(ngModel.$viewValue || '');
};
// Listen for change events to enable binding
element.bind('blur keyup change', function() {
scope.$apply(read);
});
read(); // initialize
// Write data to the model
function read() {
ngModel.$setViewValue(element.html());
}
}
};
});
</file>
<file name="index.html">
<form name="myForm">
<div contenteditable
name="myWidget" ng-model="userContent"
required>Change me!</div>
<span ng-show="myForm.myWidget.$error.required">Required!</span>
<hr>
<textarea ng-model="userContent"></textarea>
</form>
</file>
<file name="scenario.js">
it('should data-bind and become invalid', function() {
var contentEditable = element('[contenteditable]');
expect(contentEditable.text()).toEqual('Change me!');
input('userContent').enter('');
expect(contentEditable.text()).toEqual('');
expect(contentEditable.prop('className')).toMatch(/ng-invalid-required/);
});
</file>
* </example>
*
*/
var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse',
function($scope, $exceptionHandler, $attr, $element, $parse) {
this.$viewValue = Number.NaN;
this.$modelValue = Number.NaN;
this.$parsers = [];
this.$formatters = [];
this.$viewChangeListeners = [];
this.$pristine = true;
this.$dirty = false;
this.$valid = true;
this.$invalid = false;
this.$name = $attr.name;
var ngModelGet = $parse($attr.ngModel),
ngModelSet = ngModelGet.assign;
if (!ngModelSet) {
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + $attr.ngModel +
' (' + startingTag($element) + ')');
}
/**
* @ngdoc function
* @name ng.directive:ngModel.NgModelController#$render
* @methodOf ng.directive:ngModel.NgModelController
*
* @description
* Called when the view needs to be updated. It is expected that the user of the ng-model
* directive will implement this method.
*/
this.$render = noop;
var parentForm = $element.inheritedData('$formController') || nullFormCtrl,
invalidCount = 0, // used to easily determine if we are valid
$error = this.$error = {}; // keep invalid keys here
// Setup initial state of the control
$element.addClass(PRISTINE_CLASS);
toggleValidCss(true);
// convenience method for easy toggling of classes
function toggleValidCss(isValid, validationErrorKey) {
validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
$element.
removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey).
addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
}
/**
* @ngdoc function
* @name ng.directive:ngModel.NgModelController#$setValidity
* @methodOf ng.directive:ngModel.NgModelController
*
* @description
* Change the validity state, and notifies the form when the control changes validity. (i.e. it
* does not notify form if given validator is already marked as invalid).
*
* This method should be called by validators - i.e. the parser or formatter functions.
*
* @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign
* to `$error[validationErrorKey]=isValid` so that it is available for data-binding.
* The `validationErrorKey` should be in camelCase and will get converted into dash-case
* for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
* class and can be bound to as `{{someForm.someControl.$error.myError}}` .
* @param {boolean} isValid Whether the current state is valid (true) or invalid (false).
*/
this.$setValidity = function(validationErrorKey, isValid) {
if ($error[validationErrorKey] === !isValid) return;
if (isValid) {
if ($error[validationErrorKey]) invalidCount--;
if (!invalidCount) {
toggleValidCss(true);
this.$valid = true;
this.$invalid = false;
}
} else {
toggleValidCss(false);
this.$invalid = true;
this.$valid = false;
invalidCount++;
}
$error[validationErrorKey] = !isValid;
toggleValidCss(isValid, validationErrorKey);
parentForm.$setValidity(validationErrorKey, isValid, this);
};
/**
* @ngdoc function
* @name ng.directive:ngModel.NgModelController#$setViewValue
* @methodOf ng.directive:ngModel.NgModelController
*
* @description
* Read a value from view.
*
* This method should be called from within a DOM event handler.
* For example {@link ng.directive:input input} or
* {@link ng.directive:select select} directives call it.
*
* It internally calls all `formatters` and if resulted value is valid, updates the model and
* calls all registered change listeners.
*
* @param {string} value Value from the view.
*/
this.$setViewValue = function(value) {
this.$viewValue = value;
// change to dirty
if (this.$pristine) {
this.$dirty = true;
this.$pristine = false;
$element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
parentForm.$setDirty();
}
forEach(this.$parsers, function(fn) {
value = fn(value);
});
if (this.$modelValue !== value) {
this.$modelValue = value;
ngModelSet($scope, value);
forEach(this.$viewChangeListeners, function(listener) {
try {
listener();
} catch(e) {
$exceptionHandler(e);
}
})
}
};
// model -> value
var ctrl = this;
$scope.$watch(function ngModelWatch() {
var value = ngModelGet($scope);
// if scope model value and ngModel value are out of sync
if (ctrl.$modelValue !== value) {
var formatters = ctrl.$formatters,
idx = formatters.length;
ctrl.$modelValue = value;
while(idx--) {
value = formatters[idx](value);
}
if (ctrl.$viewValue !== value) {
ctrl.$viewValue = value;
ctrl.$render();
}
}
});
}];
/**
* @ngdoc directive
* @name ng.directive:ngModel
*
* @element input
*
* @description
* Is directive that tells Angular to do two-way data binding. It works together with `input`,
* `select`, `textarea`. You can easily write your own directives to use `ngModel` as well.
*
* `ngModel` is responsible for:
*
* - binding the view into the model, which other directives such as `input`, `textarea` or `select`
* require,
* - providing validation behavior (i.e. required, number, email, url),
* - keeping state of the control (valid/invalid, dirty/pristine, validation errors),
* - setting related css class onto the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`),
* - register the control with parent {@link ng.directive:form form}.
*
* For basic examples, how to use `ngModel`, see:
*
* - {@link ng.directive:input input}
* - {@link ng.directive:input.text text}
* - {@link ng.directive:input.checkbox checkbox}
* - {@link ng.directive:input.radio radio}
* - {@link ng.directive:input.number number}
* - {@link ng.directive:input.email email}
* - {@link ng.directive:input.url url}
* - {@link ng.directive:select select}
* - {@link ng.directive:textarea textarea}
*
*/
var ngModelDirective = function() {
return {
require: ['ngModel', '^?form'],
controller: NgModelController,
link: function(scope, element, attr, ctrls) {
// notify others, especially parent forms
var modelCtrl = ctrls[0],
formCtrl = ctrls[1] || nullFormCtrl;
formCtrl.$addControl(modelCtrl);
element.bind('$destroy', function() {
formCtrl.$removeControl(modelCtrl);
});
}
};
};
/**
* @ngdoc directive
* @name ng.directive:ngChange
* @restrict E
*
* @description
* Evaluate given expression when user changes the input.
* The expression is not evaluated when the value change is coming from the model.
*
* Note, this directive requires `ngModel` to be present.
*
* @element input
*
* @example
* <doc:example>
* <doc:source>
* <script>
* function Controller($scope) {
* $scope.counter = 0;
* $scope.change = function() {
* $scope.counter++;
* };
* }
* </script>
* <div ng-controller="Controller">
* <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
* <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
* <label for="ng-change-example2">Confirmed</label><br />
* debug = {{confirmed}}<br />
* counter = {{counter}}
* </div>
* </doc:source>
* <doc:scenario>
* it('should evaluate the expression if changing from view', function() {
* expect(binding('counter')).toEqual('0');
* element('#ng-change-example1').click();
* expect(binding('counter')).toEqual('1');
* expect(binding('confirmed')).toEqual('true');
* });
*
* it('should not evaluate the expression if changing from model', function() {
* element('#ng-change-example2').click();
* expect(binding('counter')).toEqual('0');
* expect(binding('confirmed')).toEqual('true');
* });
* </doc:scenario>
* </doc:example>
*/
var ngChangeDirective = valueFn({
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attr.ngChange);
});
}
});
var requiredDirective = function() {
return {
require: '?ngModel',
link: function(scope, elm, attr, ctrl) {
if (!ctrl) return;
attr.required = true; // force truthy in case we are on non input element
var validator = function(value) {
if (attr.required && (isEmpty(value) || value === false)) {
ctrl.$setValidity('required', false);
return;
} else {
ctrl.$setValidity('required', true);
return value;
}
};
ctrl.$formatters.push(validator);
ctrl.$parsers.unshift(validator);
attr.$observe('required', function() {
validator(ctrl.$viewValue);
});
}
};
};
/**
* @ngdoc directive
* @name ng.directive:ngList
*
* @description
* Text input that converts between comma-separated string into an array of strings.
*
* @element input
* @param {string=} ngList optional delimiter that should be used to split the value. If
* specified in form `/something/` then the value will be converted into a regular expression.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.names = ['igor', 'misko', 'vojta'];
}
</script>
<form name="myForm" ng-controller="Ctrl">
List: <input name="namesInput" ng-model="names" ng-list required>
<span class="error" ng-show="myForm.list.$error.required">
Required!</span>
<tt>names = {{names}}</tt><br/>
<tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
<tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
</form>
</doc:source>
<doc:scenario>
it('should initialize to model', function() {
expect(binding('names')).toEqual('["igor","misko","vojta"]');
expect(binding('myForm.namesInput.$valid')).toEqual('true');
});
it('should be invalid if empty', function() {
input('names').enter('');
expect(binding('names')).toEqual('[]');
expect(binding('myForm.namesInput.$valid')).toEqual('false');
});
</doc:scenario>
</doc:example>
*/
var ngListDirective = function() {
return {
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
var match = /\/(.*)\//.exec(attr.ngList),
separator = match && new RegExp(match[1]) || attr.ngList || ',';
var parse = function(viewValue) {
var list = [];
if (viewValue) {
forEach(viewValue.split(separator), function(value) {
if (value) list.push(trim(value));
});
}
return list;
};
ctrl.$parsers.push(parse);
ctrl.$formatters.push(function(value) {
if (isArray(value)) {
return value.join(', ');
}
return undefined;
});
}
};
};
var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
var ngValueDirective = function() {
return {
priority: 100,
compile: function(tpl, tplAttr) {
if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
return function(scope, elm, attr) {
attr.$set('value', scope.$eval(attr.ngValue));
};
} else {
return function(scope, elm, attr) {
scope.$watch(attr.ngValue, function valueWatchAction(value) {
attr.$set('value', value, false);
});
};
}
}
};
};
/**
* @ngdoc directive
* @name ng.directive:ngBind
*
* @description
* The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
* with the value of a given expression, and to update the text content when the value of that
* expression changes.
*
* Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
* `{{ expression }}` which is similar but less verbose.
*
* Once scenario in which the use of `ngBind` is prefered over `{{ expression }}` binding is when
* it's desirable to put bindings into template that is momentarily displayed by the browser in its
* raw state before Angular compiles it. Since `ngBind` is an element attribute, it makes the
* bindings invisible to the user while the page is loading.
*
* An alternative solution to this problem would be using the
* {@link ng.directive:ngCloak ngCloak} directive.
*
*
* @element ANY
* @param {expression} ngBind {@link guide/expression Expression} to evaluate.
*
* @example
* Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.name = 'Whirled';
}
</script>
<div ng-controller="Ctrl">
Enter name: <input type="text" ng-model="name"><br>
Hello <span ng-bind="name"></span>!
</div>
</doc:source>
<doc:scenario>
it('should check ng-bind', function() {
expect(using('.doc-example-live').binding('name')).toBe('Whirled');
using('.doc-example-live').input('name').enter('world');
expect(using('.doc-example-live').binding('name')).toBe('world');
});
</doc:scenario>
</doc:example>
*/
var ngBindDirective = ngDirective(function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBind);
scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
element.text(value == undefined ? '' : value);
});
});
/**
* @ngdoc directive
* @name ng.directive:ngBindTemplate
*
* @description
* The `ngBindTemplate` directive specifies that the element
* text should be replaced with the template in ngBindTemplate.
* Unlike ngBind the ngBindTemplate can contain multiple `{{` `}}`
* expressions. (This is required since some HTML elements
* can not have SPAN elements such as TITLE, or OPTION to name a few.)
*
* @element ANY
* @param {string} ngBindTemplate template of form
* <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
*
* @example
* Try it here: enter text in text box and watch the greeting change.
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.salutation = 'Hello';
$scope.name = 'World';
}
</script>
<div ng-controller="Ctrl">
Salutation: <input type="text" ng-model="salutation"><br>
Name: <input type="text" ng-model="name"><br>
<pre ng-bind-template="{{salutation}} {{name}}!"></pre>
</div>
</doc:source>
<doc:scenario>
it('should check ng-bind', function() {
expect(using('.doc-example-live').binding('salutation')).
toBe('Hello');
expect(using('.doc-example-live').binding('name')).
toBe('World');
using('.doc-example-live').input('salutation').enter('Greetings');
using('.doc-example-live').input('name').enter('user');
expect(using('.doc-example-live').binding('salutation')).
toBe('Greetings');
expect(using('.doc-example-live').binding('name')).
toBe('user');
});
</doc:scenario>
</doc:example>
*/
var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
return function(scope, element, attr) {
// TODO: move this to scenario runner
var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
element.addClass('ng-binding').data('$binding', interpolateFn);
attr.$observe('ngBindTemplate', function(value) {
element.text(value);
});
}
}];
/**
* @ngdoc directive
* @name ng.directive:ngBindHtmlUnsafe
*
* @description
* Creates a binding that will innerHTML the result of evaluating the `expression` into the current
* element. *The innerHTML-ed content will not be sanitized!* You should use this directive only if
* {@link ngSanitize.directive:ngBindHtml ngBindHtml} directive is too
* restrictive and when you absolutely trust the source of the content you are binding to.
*
* See {@link ngSanitize.$sanitize $sanitize} docs for examples.
*
* @element ANY
* @param {expression} ngBindHtmlUnsafe {@link guide/expression Expression} to evaluate.
*/
var ngBindHtmlUnsafeDirective = [function() {
return function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe);
scope.$watch(attr.ngBindHtmlUnsafe, function ngBindHtmlUnsafeWatchAction(value) {
element.html(value || '');
});
};
}];
function classDirective(name, selector) {
name = 'ngClass' + name;
return ngDirective(function(scope, element, attr) {
scope.$watch(attr[name], ngClassWatchAction, true);
attr.$observe('class', function(value) {
var ngClass = scope.$eval(attr[name]);
ngClassWatchAction(ngClass, ngClass);
});
if (name !== 'ngClass') {
scope.$watch('$index', function($index, old$index) {
var mod = $index % 2;
if (mod !== old$index % 2) {
if (mod == selector) {
addClass(scope.$eval(attr[name]));
} else {
removeClass(scope.$eval(attr[name]));
}
}
});
}
function ngClassWatchAction(newVal, oldVal) {
if (selector === true || scope.$index % 2 === selector) {
if (oldVal && (newVal !== oldVal)) {
removeClass(oldVal);
}
addClass(newVal);
}
}
function removeClass(classVal) {
if (isObject(classVal) && !isArray(classVal)) {
classVal = map(classVal, function(v, k) { if (v) return k });
}
element.removeClass(isArray(classVal) ? classVal.join(' ') : classVal);
}
function addClass(classVal) {
if (isObject(classVal) && !isArray(classVal)) {
classVal = map(classVal, function(v, k) { if (v) return k });
}
if (classVal) {
element.addClass(isArray(classVal) ? classVal.join(' ') : classVal);
}
}
});
}
/**
* @ngdoc directive
* @name ng.directive:ngClass
*
* @description
* The `ngClass` allows you to set CSS class on HTML element dynamically by databinding an
* expression that represents all classes to be added.
*
* The directive won't add duplicate classes if a particular class was already set.
*
* When the expression changes, the previously added classes are removed and only then the classes
* new classes are added.
*
* @element ANY
* @param {expression} ngClass {@link guide/expression Expression} to eval. The result
* of the evaluation can be a string representing space delimited class
* names, an array, or a map of class names to boolean values.
*
* @example
<example>
<file name="index.html">
<input type="button" value="set" ng-click="myVar='my-class'">
<input type="button" value="clear" ng-click="myVar=''">
<br>
<span ng-class="myVar">Sample Text</span>
</file>
<file name="style.css">
.my-class {
color: red;
}
</file>
<file name="scenario.js">
it('should check ng-class', function() {
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
using('.doc-example-live').element(':button:first').click();
expect(element('.doc-example-live span').prop('className')).
toMatch(/my-class/);
using('.doc-example-live').element(':button:last').click();
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
});
</file>
</example>
*/
var ngClassDirective = classDirective('', true);
/**
* @ngdoc directive
* @name ng.directive:ngClassOdd
*
* @description
* The `ngClassOdd` and `ngClassEven` directives work exactly as
* {@link ng.directive:ngClass ngClass}, except it works in
* conjunction with `ngRepeat` and takes affect only on odd (even) rows.
*
* This directive can be applied only within a scope of an
* {@link ng.directive:ngRepeat ngRepeat}.
*
* @element ANY
* @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
* of the evaluation can be a string representing space delimited class names or an array.
*
* @example
<example>
<file name="index.html">
<ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
<li ng-repeat="name in names">
<span ng-class-odd="'odd'" ng-class-even="'even'">
{{name}}
</span>
</li>
</ol>
</file>
<file name="style.css">
.odd {
color: red;
}
.even {
color: blue;
}
</file>
<file name="scenario.js">
it('should check ng-class-odd and ng-class-even', function() {
expect(element('.doc-example-live li:first span').prop('className')).
toMatch(/odd/);
expect(element('.doc-example-live li:last span').prop('className')).
toMatch(/even/);
});
</file>
</example>
*/
var ngClassOddDirective = classDirective('Odd', 0);
/**
* @ngdoc directive
* @name ng.directive:ngClassEven
*
* @description
* The `ngClassOdd` and `ngClassEven` works exactly as
* {@link ng.directive:ngClass ngClass}, except it works in
* conjunction with `ngRepeat` and takes affect only on odd (even) rows.
*
* This directive can be applied only within a scope of an
* {@link ng.directive:ngRepeat ngRepeat}.
*
* @element ANY
* @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
* result of the evaluation can be a string representing space delimited class names or an array.
*
* @example
<example>
<file name="index.html">
<ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
<li ng-repeat="name in names">
<span ng-class-odd="'odd'" ng-class-even="'even'">
{{name}}
</span>
</li>
</ol>
</file>
<file name="style.css">
.odd {
color: red;
}
.even {
color: blue;
}
</file>
<file name="scenario.js">
it('should check ng-class-odd and ng-class-even', function() {
expect(element('.doc-example-live li:first span').prop('className')).
toMatch(/odd/);
expect(element('.doc-example-live li:last span').prop('className')).
toMatch(/even/);
});
</file>
</example>
*/
var ngClassEvenDirective = classDirective('Even', 1);
/**
* @ngdoc directive
* @name ng.directive:ngCloak
*
* @description
* The `ngCloak` directive is used to prevent the Angular html template from being briefly
* displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
* directive to avoid the undesirable flicker effect caused by the html template display.
*
* The directive can be applied to the `<body>` element, but typically a fine-grained application is
* prefered in order to benefit from progressive rendering of the browser view.
*
* `ngCloak` works in cooperation with a css rule that is embedded within `angular.js` and
* `angular.min.js` files. Following is the css rule:
*
* <pre>
* [ng\:cloak], [ng-cloak], .ng-cloak {
* display: none;
* }
* </pre>
*
* When this css rule is loaded by the browser, all html elements (including their children) that
* are tagged with the `ng-cloak` directive are hidden. When Angular comes across this directive
* during the compilation of the template it deletes the `ngCloak` element attribute, which
* makes the compiled element visible.
*
* For the best result, `angular.js` script must be loaded in the head section of the html file;
* alternatively, the css rule (above) must be included in the external stylesheet of the
* application.
*
* Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they
* cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css
* class `ngCloak` in addition to `ngCloak` directive as shown in the example below.
*
* @element ANY
*
* @example
<doc:example>
<doc:source>
<div id="template1" ng-cloak>{{ 'hello' }}</div>
<div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
</doc:source>
<doc:scenario>
it('should remove the template directive and css class', function() {
expect(element('.doc-example-live #template1').attr('ng-cloak')).
not().toBeDefined();
expect(element('.doc-example-live #template2').attr('ng-cloak')).
not().toBeDefined();
});
</doc:scenario>
</doc:example>
*
*/
var ngCloakDirective = ngDirective({
compile: function(element, attr) {
attr.$set('ngCloak', undefined);
element.removeClass('ng-cloak');
}
});
/**
* @ngdoc directive
* @name ng.directive:ngController
*
* @description
* The `ngController` directive assigns behavior to a scope. This is a key aspect of how angular
* supports the principles behind the Model-View-Controller design pattern.
*
* MVC components in angular:
*
* * Model — The Model is data in scope properties; scopes are attached to the DOM.
* * View — The template (HTML with data bindings) is rendered into the View.
* * Controller — The `ngController` directive specifies a Controller class; the class has
* methods that typically express the business logic behind the application.
*
* Note that an alternative way to define controllers is via the `{@link ng.$route}`
* service.
*
* @element ANY
* @scope
* @param {expression} ngController Name of a globally accessible constructor function or an
* {@link guide/expression expression} that on the current scope evaluates to a
* constructor function.
*
* @example
* Here is a simple form for editing user contact information. Adding, removing, clearing, and
* greeting are methods declared on the controller (see source tab). These methods can
* easily be called from the angular markup. Notice that the scope becomes the `this` for the
* controller's instance. This allows for easy access to the view data from the controller. Also
* notice that any changes to the data are automatically reflected in the View without the need
* for a manual update.
<doc:example>
<doc:source>
<script>
function SettingsController($scope) {
$scope.name = "John Smith";
$scope.contacts = [
{type:'phone', value:'408 555 1212'},
{type:'email', value:'[email protected]'} ];
$scope.greet = function() {
alert(this.name);
};
$scope.addContact = function() {
this.contacts.push({type:'email', value:'[email protected]'});
};
$scope.removeContact = function(contactToRemove) {
var index = this.contacts.indexOf(contactToRemove);
this.contacts.splice(index, 1);
};
$scope.clearContact = function(contact) {
contact.type = 'phone';
contact.value = '';
};
}
</script>
<div ng-controller="SettingsController">
Name: <input type="text" ng-model="name"/>
[ <a href="" ng-click="greet()">greet</a> ]<br/>
Contact:
<ul>
<li ng-repeat="contact in contacts">
<select ng-model="contact.type">
<option>phone</option>
<option>email</option>
</select>
<input type="text" ng-model="contact.value"/>
[ <a href="" ng-click="clearContact(contact)">clear</a>
| <a href="" ng-click="removeContact(contact)">X</a> ]
</li>
<li>[ <a href="" ng-click="addContact()">add</a> ]</li>
</ul>
</div>
</doc:source>
<doc:scenario>
it('should check controller', function() {
expect(element('.doc-example-live div>:input').val()).toBe('John Smith');
expect(element('.doc-example-live li:nth-child(1) input').val())
.toBe('408 555 1212');
expect(element('.doc-example-live li:nth-child(2) input').val())
.toBe('[email protected]');
element('.doc-example-live li:first a:contains("clear")').click();
expect(element('.doc-example-live li:first input').val()).toBe('');
element('.doc-example-live li:last a:contains("add")').click();
expect(element('.doc-example-live li:nth-child(3) input').val())
.toBe('[email protected]');
});
</doc:scenario>
</doc:example>
*/
var ngControllerDirective = [function() {
return {
scope: true,
controller: '@'
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngCsp
* @priority 1000
*
* @description
* Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
* This directive should be used on the root element of the application (typically the `<html>`
* element or other element with the {@link ng.directive:ngApp ngApp}
* directive).
*
* If enabled the performance of template expression evaluator will suffer slightly, so don't enable
* this mode unless you need it.
*
* @element html
*/
var ngCspDirective = ['$sniffer', function($sniffer) {
return {
priority: 1000,
compile: function() {
$sniffer.csp = true;
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngClick
*
* @description
* The ngClick allows you to specify custom behavior when
* element is clicked.
*
* @element ANY
* @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
* click. (Event object is available as `$event`)
*
* @example
<doc:example>
<doc:source>
<button ng-click="count = count + 1" ng-init="count=0">
Increment
</button>
count: {{count}}
</doc:source>
<doc:scenario>
it('should check ng-click', function() {
expect(binding('count')).toBe('0');
element('.doc-example-live :button').click();
expect(binding('count')).toBe('1');
});
</doc:scenario>
</doc:example>
*/
/*
* A directive that allows creation of custom onclick handlers that are defined as angular
* expressions and are compiled and executed within the current scope.
*
* Events that are handled via these handler are always configured not to propagate further.
*/
var ngEventDirectives = {};
forEach(
'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave'.split(' '),
function(name) {
var directiveName = directiveNormalize('ng-' + name);
ngEventDirectives[directiveName] = ['$parse', function($parse) {
return function(scope, element, attr) {
var fn = $parse(attr[directiveName]);
element.bind(lowercase(name), function(event) {
scope.$apply(function() {
fn(scope, {$event:event});
});
});
};
}];
}
);
/**
* @ngdoc directive
* @name ng.directive:ngDblclick
*
* @description
* The `ngDblclick` directive allows you to specify custom behavior on dblclick event.
*
* @element ANY
* @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
* dblclick. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMousedown
*
* @description
* The ngMousedown directive allows you to specify custom behavior on mousedown event.
*
* @element ANY
* @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
* mousedown. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseup
*
* @description
* Specify custom behavior on mouseup event.
*
* @element ANY
* @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
* mouseup. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseover
*
* @description
* Specify custom behavior on mouseover event.
*
* @element ANY
* @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
* mouseover. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseenter
*
* @description
* Specify custom behavior on mouseenter event.
*
* @element ANY
* @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
* mouseenter. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMouseleave
*
* @description
* Specify custom behavior on mouseleave event.
*
* @element ANY
* @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
* mouseleave. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngMousemove
*
* @description
* Specify custom behavior on mousemove event.
*
* @element ANY
* @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
* mousemove. (Event object is available as `$event`)
*
* @example
* See {@link ng.directive:ngClick ngClick}
*/
/**
* @ngdoc directive
* @name ng.directive:ngSubmit
*
* @description
* Enables binding angular expressions to onsubmit events.
*
* Additionally it prevents the default action (which for form means sending the request to the
* server and reloading the current page).
*
* @element form
* @param {expression} ngSubmit {@link guide/expression Expression} to eval.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.list = [];
$scope.text = 'hello';
$scope.submit = function() {
if (this.text) {
this.list.push(this.text);
this.text = '';
}
};
}
</script>
<form ng-submit="submit()" ng-controller="Ctrl">
Enter text and hit enter:
<input type="text" ng-model="text" name="text" />
<input type="submit" id="submit" value="Submit" />
<pre>list={{list}}</pre>
</form>
</doc:source>
<doc:scenario>
it('should check ng-submit', function() {
expect(binding('list')).toBe('[]');
element('.doc-example-live #submit').click();
expect(binding('list')).toBe('["hello"]');
expect(input('text').val()).toBe('');
});
it('should ignore empty strings', function() {
expect(binding('list')).toBe('[]');
element('.doc-example-live #submit').click();
element('.doc-example-live #submit').click();
expect(binding('list')).toBe('["hello"]');
});
</doc:scenario>
</doc:example>
*/
var ngSubmitDirective = ngDirective(function(scope, element, attrs) {
element.bind('submit', function() {
scope.$apply(attrs.ngSubmit);
});
});
/**
* @ngdoc directive
* @name ng.directive:ngInclude
* @restrict ECA
*
* @description
* Fetches, compiles and includes an external HTML fragment.
*
* Keep in mind that Same Origin Policy applies to included resources
* (e.g. ngInclude won't work for cross-domain requests on all browsers and for
* file:// access on some browsers).
*
* @scope
*
* @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
* @param {string=} onload Expression to evaluate when a new partial is loaded.
*
* @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
* $anchorScroll} to scroll the viewport after the content is loaded.
*
* - If the attribute is not set, disable scrolling.
* - If the attribute is set without value, enable scrolling.
* - Otherwise enable scrolling only if the expression evaluates to truthy value.
*
* @example
<example>
<file name="index.html">
<div ng-controller="Ctrl">
<select ng-model="template" ng-options="t.name for t in templates">
<option value="">(blank)</option>
</select>
url of the template: <tt>{{template.url}}</tt>
<hr/>
<div ng-include src="template.url"></div>
</div>
</file>
<file name="script.js">
function Ctrl($scope) {
$scope.templates =
[ { name: 'template1.html', url: 'template1.html'}
, { name: 'template2.html', url: 'template2.html'} ];
$scope.template = $scope.templates[0];
}
</file>
<file name="template1.html">
Content of template1.html
</file>
<file name="template2.html">
Content of template2.html
</file>
<file name="scenario.js">
it('should load template1.html', function() {
expect(element('.doc-example-live [ng-include]').text()).
toMatch(/Content of template1.html/);
});
it('should load template2.html', function() {
select('template').option('1');
expect(element('.doc-example-live [ng-include]').text()).
toMatch(/Content of template2.html/);
});
it('should change to blank', function() {
select('template').option('');
expect(element('.doc-example-live [ng-include]').text()).toEqual('');
});
</file>
</example>
*/
/**
* @ngdoc event
* @name ng.directive:ngInclude#$includeContentLoaded
* @eventOf ng.directive:ngInclude
* @eventType emit on the current ngInclude scope
* @description
* Emitted every time the ngInclude content is reloaded.
*/
var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile',
function($http, $templateCache, $anchorScroll, $compile) {
return {
restrict: 'ECA',
terminal: true,
compile: function(element, attr) {
var srcExp = attr.ngInclude || attr.src,
onloadExp = attr.onload || '',
autoScrollExp = attr.autoscroll;
return function(scope, element) {
var changeCounter = 0,
childScope;
var clearContent = function() {
if (childScope) {
childScope.$destroy();
childScope = null;
}
element.html('');
};
scope.$watch(srcExp, function ngIncludeWatchAction(src) {
var thisChangeId = ++changeCounter;
if (src) {
$http.get(src, {cache: $templateCache}).success(function(response) {
if (thisChangeId !== changeCounter) return;
if (childScope) childScope.$destroy();
childScope = scope.$new();
element.html(response);
$compile(element.contents())(childScope);
if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
$anchorScroll();
}
childScope.$emit('$includeContentLoaded');
scope.$eval(onloadExp);
}).error(function() {
if (thisChangeId === changeCounter) clearContent();
});
} else clearContent();
});
};
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngInit
*
* @description
* The `ngInit` directive specifies initialization tasks to be executed
* before the template enters execution mode during bootstrap.
*
* @element ANY
* @param {expression} ngInit {@link guide/expression Expression} to eval.
*
* @example
<doc:example>
<doc:source>
<div ng-init="greeting='Hello'; person='World'">
{{greeting}} {{person}}!
</div>
</doc:source>
<doc:scenario>
it('should check greeting', function() {
expect(binding('greeting')).toBe('Hello');
expect(binding('person')).toBe('World');
});
</doc:scenario>
</doc:example>
*/
var ngInitDirective = ngDirective({
compile: function() {
return {
pre: function(scope, element, attrs) {
scope.$eval(attrs.ngInit);
}
}
}
});
/**
* @ngdoc directive
* @name ng.directive:ngNonBindable
* @priority 1000
*
* @description
* Sometimes it is necessary to write code which looks like bindings but which should be left alone
* by angular. Use `ngNonBindable` to make angular ignore a chunk of HTML.
*
* @element ANY
*
* @example
* In this example there are two location where a simple binding (`{{}}`) is present, but the one
* wrapped in `ngNonBindable` is left alone.
*
* @example
<doc:example>
<doc:source>
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
</doc:source>
<doc:scenario>
it('should check ng-non-bindable', function() {
expect(using('.doc-example-live').binding('1 + 2')).toBe('3');
expect(using('.doc-example-live').element('div:last').text()).
toMatch(/1 \+ 2/);
});
</doc:scenario>
</doc:example>
*/
var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
/**
* @ngdoc directive
* @name ng.directive:ngPluralize
* @restrict EA
*
* @description
* # Overview
* `ngPluralize` is a directive that displays messages according to en-US localization rules.
* These rules are bundled with angular.js and the rules can be overridden
* (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
* by specifying the mappings between
* {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
* plural categories} and the strings to be displayed.
*
* # Plural categories and explicit number rules
* There are two
* {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
* plural categories} in Angular's default en-US locale: "one" and "other".
*
* While a pural category may match many numbers (for example, in en-US locale, "other" can match
* any number that is not 1), an explicit number rule can only match one number. For example, the
* explicit number rule for "3" matches the number 3. You will see the use of plural categories
* and explicit number rules throughout later parts of this documentation.
*
* # Configuring ngPluralize
* You configure ngPluralize by providing 2 attributes: `count` and `when`.
* You can also provide an optional attribute, `offset`.
*
* The value of the `count` attribute can be either a string or an {@link guide/expression
* Angular expression}; these are evaluated on the current scope for its bound value.
*
* The `when` attribute specifies the mappings between plural categories and the actual
* string to be displayed. The value of the attribute should be a JSON object so that Angular
* can interpret it correctly.
*
* The following example shows how to configure ngPluralize:
*
* <pre>
* <ng-pluralize count="personCount"
when="{'0': 'Nobody is viewing.',
* 'one': '1 person is viewing.',
* 'other': '{} people are viewing.'}">
* </ng-pluralize>
*</pre>
*
* In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
* specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
* would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
* other numbers, for example 12, so that instead of showing "12 people are viewing", you can
* show "a dozen people are viewing".
*
* You can use a set of closed braces(`{}`) as a placeholder for the number that you want substituted
* into pluralized strings. In the previous example, Angular will replace `{}` with
* <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
* for <span ng-non-bindable>{{numberExpression}}</span>.
*
* # Configuring ngPluralize with offset
* The `offset` attribute allows further customization of pluralized text, which can result in
* a better user experience. For example, instead of the message "4 people are viewing this document",
* you might display "John, Kate and 2 others are viewing this document".
* The offset attribute allows you to offset a number by any desired value.
* Let's take a look at an example:
*
* <pre>
* <ng-pluralize count="personCount" offset=2
* when="{'0': 'Nobody is viewing.',
* '1': '{{person1}} is viewing.',
* '2': '{{person1}} and {{person2}} are viewing.',
* 'one': '{{person1}}, {{person2}} and one other person are viewing.',
* 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
* </ng-pluralize>
* </pre>
*
* Notice that we are still using two plural categories(one, other), but we added
* three explicit number rules 0, 1 and 2.
* When one person, perhaps John, views the document, "John is viewing" will be shown.
* When three people view the document, no explicit number rule is found, so
* an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
* In this case, plural category 'one' is matched and "John, Marry and one other person are viewing"
* is shown.
*
* Note that when you specify offsets, you must provide explicit number rules for
* numbers from 0 up to and including the offset. If you use an offset of 3, for example,
* you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
* plural categories "one" and "other".
*
* @param {string|expression} count The variable to be bounded to.
* @param {string} when The mapping between plural category to its correspoding strings.
* @param {number=} offset Offset to deduct from the total number.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.person1 = 'Igor';
$scope.person2 = 'Misko';
$scope.personCount = 1;
}
</script>
<div ng-controller="Ctrl">
Person 1:<input type="text" ng-model="person1" value="Igor" /><br/>
Person 2:<input type="text" ng-model="person2" value="Misko" /><br/>
Number of People:<input type="text" ng-model="personCount" value="1" /><br/>
<!--- Example with simple pluralization rules for en locale --->
Without Offset:
<ng-pluralize count="personCount"
when="{'0': 'Nobody is viewing.',
'one': '1 person is viewing.',
'other': '{} people are viewing.'}">
</ng-pluralize><br>
<!--- Example with offset --->
With Offset(2):
<ng-pluralize count="personCount" offset=2
when="{'0': 'Nobody is viewing.',
'1': '{{person1}} is viewing.',
'2': '{{person1}} and {{person2}} are viewing.',
'one': '{{person1}}, {{person2}} and one other person are viewing.',
'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
</ng-pluralize>
</div>
</doc:source>
<doc:scenario>
it('should show correct pluralized string', function() {
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('1 person is viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor is viewing.');
using('.doc-example-live').input('personCount').enter('0');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('Nobody is viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Nobody is viewing.');
using('.doc-example-live').input('personCount').enter('2');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('2 people are viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor and Misko are viewing.');
using('.doc-example-live').input('personCount').enter('3');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('3 people are viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor, Misko and one other person are viewing.');
using('.doc-example-live').input('personCount').enter('4');
expect(element('.doc-example-live ng-pluralize:first').text()).
toBe('4 people are viewing.');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor, Misko and 2 other people are viewing.');
});
it('should show data-binded names', function() {
using('.doc-example-live').input('personCount').enter('4');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Igor, Misko and 2 other people are viewing.');
using('.doc-example-live').input('person1').enter('Di');
using('.doc-example-live').input('person2').enter('Vojta');
expect(element('.doc-example-live ng-pluralize:last').text()).
toBe('Di, Vojta and 2 other people are viewing.');
});
</doc:scenario>
</doc:example>
*/
var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {
var BRACE = /{}/g;
return {
restrict: 'EA',
link: function(scope, element, attr) {
var numberExp = attr.count,
whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs
offset = attr.offset || 0,
whens = scope.$eval(whenExp),
whensExpFns = {},
startSymbol = $interpolate.startSymbol(),
endSymbol = $interpolate.endSymbol();
forEach(whens, function(expression, key) {
whensExpFns[key] =
$interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
offset + endSymbol));
});
scope.$watch(function ngPluralizeWatch() {
var value = parseFloat(scope.$eval(numberExp));
if (!isNaN(value)) {
//if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,
//check it against pluralization rules in $locale service
if (!whens[value]) value = $locale.pluralCat(value - offset);
return whensExpFns[value](scope, element, true);
} else {
return '';
}
}, function ngPluralizeWatchAction(newVal) {
element.text(newVal);
});
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:ngRepeat
*
* @description
* The `ngRepeat` directive instantiates a template once per item from a collection. Each template
* instance gets its own scope, where the given loop variable is set to the current collection item,
* and `$index` is set to the item index or key.
*
* Special properties are exposed on the local scope of each template instance, including:
*
* * `$index` – `{number}` – iterator offset of the repeated element (0..length-1)
* * `$first` – `{boolean}` – true if the repeated element is first in the iterator.
* * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator.
* * `$last` – `{boolean}` – true if the repeated element is last in the iterator.
*
*
* @element ANY
* @scope
* @priority 1000
* @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. Two
* formats are currently supported:
*
* * `variable in expression` – where variable is the user defined loop variable and `expression`
* is a scope expression giving the collection to enumerate.
*
* For example: `track in cd.tracks`.
*
* * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
* and `expression` is the scope expression giving the collection to enumerate.
*
* For example: `(name, age) in {'adam':10, 'amalie':12}`.
*
* @example
* This example initializes the scope to a list of names and
* then uses `ngRepeat` to display every person:
<doc:example>
<doc:source>
<div ng-init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]">
I have {{friends.length}} friends. They are:
<ul>
<li ng-repeat="friend in friends">
[{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
</li>
</ul>
</div>
</doc:source>
<doc:scenario>
it('should check ng-repeat', function() {
var r = using('.doc-example-live').repeater('ul li');
expect(r.count()).toBe(2);
expect(r.row(0)).toEqual(["1","John","25"]);
expect(r.row(1)).toEqual(["2","Mary","28"]);
});
</doc:scenario>
</doc:example>
*/
var ngRepeatDirective = ngDirective({
transclude: 'element',
priority: 1000,
terminal: true,
compile: function(element, attr, linker) {
return function(scope, iterStartElement, attr){
var expression = attr.ngRepeat;
var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/),
lhs, rhs, valueIdent, keyIdent;
if (! match) {
throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '" +
expression + "'.");
}
lhs = match[1];
rhs = match[2];
match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);
if (!match) {
throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '" +
lhs + "'.");
}
valueIdent = match[3] || match[1];
keyIdent = match[2];
// Store a list of elements from previous run. This is a hash where key is the item from the
// iterator, and the value is an array of objects with following properties.
// - scope: bound scope
// - element: previous element.
// - index: position
// We need an array of these objects since the same object can be returned from the iterator.
// We expect this to be a rare case.
var lastOrder = new HashQueueMap();
scope.$watch(function ngRepeatWatch(scope){
var index, length,
collection = scope.$eval(rhs),
cursor = iterStartElement, // current position of the node
// Same as lastOrder but it has the current state. It will become the
// lastOrder on the next iteration.
nextOrder = new HashQueueMap(),
arrayLength,
childScope,
key, value, // key/value of iteration
array,
last; // last object information {scope, element, index}
if (!isArray(collection)) {
// if object, extract keys, sort them and use to determine order of iteration over obj props
array = [];
for(key in collection) {
if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {
array.push(key);
}
}
array.sort();
} else {
array = collection || [];
}
arrayLength = array.length;
// we are not using forEach for perf reasons (trying to avoid #call)
for (index = 0, length = array.length; index < length; index++) {
key = (collection === array) ? index : array[index];
value = collection[key];
last = lastOrder.shift(value);
if (last) {
// if we have already seen this object, then we need to reuse the
// associated scope/element
childScope = last.scope;
nextOrder.push(value, last);
if (index === last.index) {
// do nothing
cursor = last.element;
} else {
// existing item which got moved
last.index = index;
// This may be a noop, if the element is next, but I don't know of a good way to
// figure this out, since it would require extra DOM access, so let's just hope that
// the browsers realizes that it is noop, and treats it as such.
cursor.after(last.element);
cursor = last.element;
}
} else {
// new item which we don't know about
childScope = scope.$new();
}
childScope[valueIdent] = value;
if (keyIdent) childScope[keyIdent] = key;
childScope.$index = index;
childScope.$first = (index === 0);
childScope.$last = (index === (arrayLength - 1));
childScope.$middle = !(childScope.$first || childScope.$last);
if (!last) {
linker(childScope, function(clone){
cursor.after(clone);
last = {
scope: childScope,
element: (cursor = clone),
index: index
};
nextOrder.push(value, last);
});
}
}
//shrink children
for (key in lastOrder) {
if (lastOrder.hasOwnProperty(key)) {
array = lastOrder[key];
while(array.length) {
value = array.pop();
value.element.remove();
value.scope.$destroy();
}
}
}
lastOrder = nextOrder;
});
};
}
});
/**
* @ngdoc directive
* @name ng.directive:ngShow
*
* @description
* The `ngShow` and `ngHide` directives show or hide a portion of the DOM tree (HTML)
* conditionally.
*
* @element ANY
* @param {expression} ngShow If the {@link guide/expression expression} is truthy
* then the element is shown or hidden respectively.
*
* @example
<doc:example>
<doc:source>
Click me: <input type="checkbox" ng-model="checked"><br/>
Show: <span ng-show="checked">I show up when your checkbox is checked.</span> <br/>
Hide: <span ng-hide="checked">I hide when your checkbox is checked.</span>
</doc:source>
<doc:scenario>
it('should check ng-show / ng-hide', function() {
expect(element('.doc-example-live span:first:hidden').count()).toEqual(1);
expect(element('.doc-example-live span:last:visible').count()).toEqual(1);
input('checked').check();
expect(element('.doc-example-live span:first:visible').count()).toEqual(1);
expect(element('.doc-example-live span:last:hidden').count()).toEqual(1);
});
</doc:scenario>
</doc:example>
*/
//TODO(misko): refactor to remove element from the DOM
var ngShowDirective = ngDirective(function(scope, element, attr){
scope.$watch(attr.ngShow, function ngShowWatchAction(value){
element.css('display', toBoolean(value) ? '' : 'none');
});
});
/**
* @ngdoc directive
* @name ng.directive:ngHide
*
* @description
* The `ngHide` and `ngShow` directives hide or show a portion of the DOM tree (HTML)
* conditionally.
*
* @element ANY
* @param {expression} ngHide If the {@link guide/expression expression} is truthy then
* the element is shown or hidden respectively.
*
* @example
<doc:example>
<doc:source>
Click me: <input type="checkbox" ng-model="checked"><br/>
Show: <span ng-show="checked">I show up when you checkbox is checked?</span> <br/>
Hide: <span ng-hide="checked">I hide when you checkbox is checked?</span>
</doc:source>
<doc:scenario>
it('should check ng-show / ng-hide', function() {
expect(element('.doc-example-live span:first:hidden').count()).toEqual(1);
expect(element('.doc-example-live span:last:visible').count()).toEqual(1);
input('checked').check();
expect(element('.doc-example-live span:first:visible').count()).toEqual(1);
expect(element('.doc-example-live span:last:hidden').count()).toEqual(1);
});
</doc:scenario>
</doc:example>
*/
//TODO(misko): refactor to remove element from the DOM
var ngHideDirective = ngDirective(function(scope, element, attr){
scope.$watch(attr.ngHide, function ngHideWatchAction(value){
element.css('display', toBoolean(value) ? 'none' : '');
});
});
/**
* @ngdoc directive
* @name ng.directive:ngStyle
*
* @description
* The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
*
* @element ANY
* @param {expression} ngStyle {@link guide/expression Expression} which evals to an
* object whose keys are CSS style names and values are corresponding values for those CSS
* keys.
*
* @example
<example>
<file name="index.html">
<input type="button" value="set" ng-click="myStyle={color:'red'}">
<input type="button" value="clear" ng-click="myStyle={}">
<br/>
<span ng-style="myStyle">Sample Text</span>
<pre>myStyle={{myStyle}}</pre>
</file>
<file name="style.css">
span {
color: black;
}
</file>
<file name="scenario.js">
it('should check ng-style', function() {
expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)');
element('.doc-example-live :button[value=set]').click();
expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)');
element('.doc-example-live :button[value=clear]').click();
expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)');
});
</file>
</example>
*/
var ngStyleDirective = ngDirective(function(scope, element, attr) {
scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
if (oldStyles && (newStyles !== oldStyles)) {
forEach(oldStyles, function(val, style) { element.css(style, '');});
}
if (newStyles) element.css(newStyles);
}, true);
});
/**
* @ngdoc directive
* @name ng.directive:ngSwitch
* @restrict EA
*
* @description
* Conditionally change the DOM structure.
*
* @usageContent
* <ANY ng-switch-when="matchValue1">...</ANY>
* <ANY ng-switch-when="matchValue2">...</ANY>
* ...
* <ANY ng-switch-default>...</ANY>
*
* @scope
* @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
* @paramDescription
* On child elments add:
*
* * `ngSwitchWhen`: the case statement to match against. If match then this
* case will be displayed.
* * `ngSwitchDefault`: the default case when no other casses match.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.items = ['settings', 'home', 'other'];
$scope.selection = $scope.items[0];
}
</script>
<div ng-controller="Ctrl">
<select ng-model="selection" ng-options="item for item in items">
</select>
<tt>selection={{selection}}</tt>
<hr/>
<div ng-switch on="selection" >
<div ng-switch-when="settings">Settings Div</div>
<span ng-switch-when="home">Home Span</span>
<span ng-switch-default>default</span>
</div>
</div>
</doc:source>
<doc:scenario>
it('should start in settings', function() {
expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Settings Div/);
});
it('should change to home', function() {
select('selection').option('home');
expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Home Span/);
});
it('should select deafault', function() {
select('selection').option('other');
expect(element('.doc-example-live [ng-switch]').text()).toMatch(/default/);
});
</doc:scenario>
</doc:example>
*/
var NG_SWITCH = 'ng-switch';
var ngSwitchDirective = valueFn({
restrict: 'EA',
require: 'ngSwitch',
controller: function ngSwitchController() {
this.cases = {};
},
link: function(scope, element, attr, ctrl) {
var watchExpr = attr.ngSwitch || attr.on,
selectedTransclude,
selectedElement,
selectedScope;
scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
if (selectedElement) {
selectedScope.$destroy();
selectedElement.remove();
selectedElement = selectedScope = null;
}
if ((selectedTransclude = ctrl.cases['!' + value] || ctrl.cases['?'])) {
scope.$eval(attr.change);
selectedScope = scope.$new();
selectedTransclude(selectedScope, function(caseElement) {
selectedElement = caseElement;
element.append(caseElement);
});
}
});
}
});
var ngSwitchWhenDirective = ngDirective({
transclude: 'element',
priority: 500,
require: '^ngSwitch',
compile: function(element, attrs, transclude) {
return function(scope, element, attr, ctrl) {
ctrl.cases['!' + attrs.ngSwitchWhen] = transclude;
};
}
});
var ngSwitchDefaultDirective = ngDirective({
transclude: 'element',
priority: 500,
require: '^ngSwitch',
compile: function(element, attrs, transclude) {
return function(scope, element, attr, ctrl) {
ctrl.cases['?'] = transclude;
};
}
});
/**
* @ngdoc directive
* @name ng.directive:ngTransclude
*
* @description
* Insert the transcluded DOM here.
*
* @element ANY
*
* @example
<doc:example module="transclude">
<doc:source>
<script>
function Ctrl($scope) {
$scope.title = 'Lorem Ipsum';
$scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
}
angular.module('transclude', [])
.directive('pane', function(){
return {
restrict: 'E',
transclude: true,
scope: 'isolate',
locals: { title:'bind' },
template: '<div style="border: 1px solid black;">' +
'<div style="background-color: gray">{{title}}</div>' +
'<div ng-transclude></div>' +
'</div>'
};
});
</script>
<div ng-controller="Ctrl">
<input ng-model="title"><br>
<textarea ng-model="text"></textarea> <br/>
<pane title="{{title}}">{{text}}</pane>
</div>
</doc:source>
<doc:scenario>
it('should have transcluded', function() {
input('title').enter('TITLE');
input('text').enter('TEXT');
expect(binding('title')).toEqual('TITLE');
expect(binding('text')).toEqual('TEXT');
});
</doc:scenario>
</doc:example>
*
*/
var ngTranscludeDirective = ngDirective({
controller: ['$transclude', '$element', function($transclude, $element) {
$transclude(function(clone) {
$element.append(clone);
});
}]
});
/**
* @ngdoc directive
* @name ng.directive:ngView
* @restrict ECA
*
* @description
* # Overview
* `ngView` is a directive that complements the {@link ng.$route $route} service by
* including the rendered template of the current route into the main layout (`index.html`) file.
* Every time the current route changes, the included view changes with it according to the
* configuration of the `$route` service.
*
* @scope
* @example
<example module="ngView">
<file name="index.html">
<div ng-controller="MainCntl">
Choose:
<a href="Book/Moby">Moby</a> |
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
<a href="Book/Gatsby">Gatsby</a> |
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
<a href="Book/Scarlet">Scarlet Letter</a><br/>
<div ng-view></div>
<hr />
<pre>$location.path() = {{$location.path()}}</pre>
<pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
<pre>$route.current.params = {{$route.current.params}}</pre>
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
<pre>$routeParams = {{$routeParams}}</pre>
</div>
</file>
<file name="book.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
</file>
<file name="chapter.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
Chapter Id: {{params.chapterId}}
</file>
<file name="script.js">
angular.module('ngView', [], function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl
});
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
templateUrl: 'chapter.html',
controller: ChapterCntl
});
// configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(true);
});
function MainCntl($scope, $route, $routeParams, $location) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
}
function BookCntl($scope, $routeParams) {
$scope.name = "BookCntl";
$scope.params = $routeParams;
}
function ChapterCntl($scope, $routeParams) {
$scope.name = "ChapterCntl";
$scope.params = $routeParams;
}
</file>
<file name="scenario.js">
it('should load and compile correct template', function() {
element('a:contains("Moby: Ch1")').click();
var content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element('a:contains("Scarlet")').click();
content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</file>
</example>
*/
/**
* @ngdoc event
* @name ng.directive:ngView#$viewContentLoaded
* @eventOf ng.directive:ngView
* @eventType emit on the current ngView scope
* @description
* Emitted every time the ngView content is reloaded.
*/
var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$compile',
'$controller',
function($http, $templateCache, $route, $anchorScroll, $compile,
$controller) {
return {
restrict: 'ECA',
terminal: true,
link: function(scope, element, attr) {
var lastScope,
onloadExp = attr.onload || '';
scope.$on('$routeChangeSuccess', update);
update();
function destroyLastScope() {
if (lastScope) {
lastScope.$destroy();
lastScope = null;
}
}
function clearContent() {
element.html('');
destroyLastScope();
}
function update() {
var locals = $route.current && $route.current.locals,
template = locals && locals.$template;
if (template) {
element.html(template);
destroyLastScope();
var link = $compile(element.contents()),
current = $route.current,
controller;
lastScope = current.scope = scope.$new();
if (current.controller) {
locals.$scope = lastScope;
controller = $controller(current.controller, locals);
element.contents().data('$ngControllerController', controller);
}
link(lastScope);
lastScope.$emit('$viewContentLoaded');
lastScope.$eval(onloadExp);
// $anchorScroll might listen on event...
$anchorScroll();
} else {
clearContent();
}
}
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:script
*
* @description
* Load content of a script tag, with type `text/ng-template`, into `$templateCache`, so that the
* template can be used by `ngInclude`, `ngView` or directive templates.
*
* @restrict E
* @param {'text/ng-template'} type must be set to `'text/ng-template'`
*
* @example
<doc:example>
<doc:source>
<script type="text/ng-template" id="/tpl.html">
Content of the template.
</script>
<a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
<div id="tpl-content" ng-include src="currentTpl"></div>
</doc:source>
<doc:scenario>
it('should load template defined inside script tag', function() {
element('#tpl-link').click();
expect(element('#tpl-content').text()).toMatch(/Content of the template/);
});
</doc:scenario>
</doc:example>
*/
var scriptDirective = ['$templateCache', function($templateCache) {
return {
restrict: 'E',
terminal: true,
compile: function(element, attr) {
if (attr.type == 'text/ng-template') {
var templateUrl = attr.id,
// IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent
text = element[0].text;
$templateCache.put(templateUrl, text);
}
}
};
}];
/**
* @ngdoc directive
* @name ng.directive:select
* @restrict E
*
* @description
* HTML `SELECT` element with angular data-binding.
*
* # `ngOptions`
*
* Optionally `ngOptions` attribute can be used to dynamically generate a list of `<option>`
* elements for a `<select>` element using an array or an object obtained by evaluating the
* `ngOptions` expression.
*˝˝
* When an item in the select menu is select, the value of array element or object property
* represented by the selected option will be bound to the model identified by the `ngModel`
* directive of the parent select element.
*
* Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
* be nested into the `<select>` element. This element will then represent `null` or "not selected"
* option. See example below for demonstration.
*
* Note: `ngOptions` provides iterator facility for `<option>` element which should be used instead
* of {@link ng.directive:ngRepeat ngRepeat} when you want the
* `select` model to be bound to a non-string value. This is because an option element can currently
* be bound to string values only.
*
* @param {string} name assignable expression to data-bind to.
* @param {string=} required The control is considered valid only if value is entered.
* @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
* the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
* `required` when you want to data-bind to the `required` attribute.
* @param {comprehension_expression=} ngOptions in one of the following forms:
*
* * for array data sources:
* * `label` **`for`** `value` **`in`** `array`
* * `select` **`as`** `label` **`for`** `value` **`in`** `array`
* * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
* * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array`
* * for object data sources:
* * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
* * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
* * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
* * `select` **`as`** `label` **`group by`** `group`
* **`for` `(`**`key`**`,`** `value`**`) in`** `object`
*
* Where:
*
* * `array` / `object`: an expression which evaluates to an array / object to iterate over.
* * `value`: local variable which will refer to each item in the `array` or each property value
* of `object` during iteration.
* * `key`: local variable which will refer to a property name in `object` during iteration.
* * `label`: The result of this expression will be the label for `<option>` element. The
* `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
* * `select`: The result of this expression will be bound to the model of the parent `<select>`
* element. If not specified, `select` expression will default to `value`.
* * `group`: The result of this expression will be used to group options using the `<optgroup>`
* DOM element.
*
* @example
<doc:example>
<doc:source>
<script>
function MyCntrl($scope) {
$scope.colors = [
{name:'black', shade:'dark'},
{name:'white', shade:'light'},
{name:'red', shade:'dark'},
{name:'blue', shade:'dark'},
{name:'yellow', shade:'light'}
];
$scope.color = $scope.colors[2]; // red
}
</script>
<div ng-controller="MyCntrl">
<ul>
<li ng-repeat="color in colors">
Name: <input ng-model="color.name">
[<a href ng-click="colors.splice($index, 1)">X</a>]
</li>
<li>
[<a href ng-click="colors.push({})">add</a>]
</li>
</ul>
<hr/>
Color (null not allowed):
<select ng-model="color" ng-options="c.name for c in colors"></select><br>
Color (null allowed):
<span class="nullable">
<select ng-model="color" ng-options="c.name for c in colors">
<option value="">-- chose color --</option>
</select>
</span><br/>
Color grouped by shade:
<select ng-model="color" ng-options="c.name group by c.shade for c in colors">
</select><br/>
Select <a href ng-click="color={name:'not in list'}">bogus</a>.<br>
<hr/>
Currently selected: {{ {selected_color:color} }}
<div style="border:solid 1px black; height:20px"
ng-style="{'background-color':color.name}">
</div>
</div>
</doc:source>
<doc:scenario>
it('should check ng-options', function() {
expect(binding('{selected_color:color}')).toMatch('red');
select('color').option('0');
expect(binding('{selected_color:color}')).toMatch('black');
using('.nullable').select('color').option('');
expect(binding('{selected_color:color}')).toMatch('null');
});
</doc:scenario>
</doc:example>
*/
var ngOptionsDirective = valueFn({ terminal: true });
var selectDirective = ['$compile', '$parse', function($compile, $parse) {
//00001111100000000000222200000000000000000000003333000000000000044444444444444444000000000555555555555555550000000666666666666666660000000000000007777
var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,
nullModelCtrl = {$setViewValue: noop};
return {
restrict: 'E',
require: ['select', '?ngModel'],
controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
var self = this,
optionsMap = {},
ngModelCtrl = nullModelCtrl,
nullOption,
unknownOption;
self.databound = $attrs.ngModel;
self.init = function(ngModelCtrl_, nullOption_, unknownOption_) {
ngModelCtrl = ngModelCtrl_;
nullOption = nullOption_;
unknownOption = unknownOption_;
}
self.addOption = function(value) {
optionsMap[value] = true;
if (ngModelCtrl.$viewValue == value) {
$element.val(value);
if (unknownOption.parent()) unknownOption.remove();
}
};
self.removeOption = function(value) {
if (this.hasOption(value)) {
delete optionsMap[value];
if (ngModelCtrl.$viewValue == value) {
this.renderUnknownOption(value);
}
}
};
self.renderUnknownOption = function(val) {
var unknownVal = '? ' + hashKey(val) + ' ?';
unknownOption.val(unknownVal);
$element.prepend(unknownOption);
$element.val(unknownVal);
unknownOption.prop('selected', true); // needed for IE
}
self.hasOption = function(value) {
return optionsMap.hasOwnProperty(value);
}
$scope.$on('$destroy', function() {
// disable unknown option so that we don't do work when the whole select is being destroyed
self.renderUnknownOption = noop;
});
}],
link: function(scope, element, attr, ctrls) {
// if ngModel is not defined, we don't need to do anything
if (!ctrls[1]) return;
var selectCtrl = ctrls[0],
ngModelCtrl = ctrls[1],
multiple = attr.multiple,
optionsExp = attr.ngOptions,
nullOption = false, // if false, user will not be able to select it (used by ngOptions)
emptyOption,
// we can't just jqLite('<option>') since jqLite is not smart enough
// to create it in <select> and IE barfs otherwise.
optionTemplate = jqLite(document.createElement('option')),
optGroupTemplate =jqLite(document.createElement('optgroup')),
unknownOption = optionTemplate.clone();
// find "null" option
for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) {
if (children[i].value == '') {
emptyOption = nullOption = children.eq(i);
break;
}
}
selectCtrl.init(ngModelCtrl, nullOption, unknownOption);
// required validator
if (multiple && (attr.required || attr.ngRequired)) {
var requiredValidator = function(value) {
ngModelCtrl.$setValidity('required', !attr.required || (value && value.length));
return value;
};
ngModelCtrl.$parsers.push(requiredValidator);
ngModelCtrl.$formatters.unshift(requiredValidator);
attr.$observe('required', function() {
requiredValidator(ngModelCtrl.$viewValue);
});
}
if (optionsExp) Options(scope, element, ngModelCtrl);
else if (multiple) Multiple(scope, element, ngModelCtrl);
else Single(scope, element, ngModelCtrl, selectCtrl);
////////////////////////////
function Single(scope, selectElement, ngModelCtrl, selectCtrl) {
ngModelCtrl.$render = function() {
var viewValue = ngModelCtrl.$viewValue;
if (selectCtrl.hasOption(viewValue)) {
if (unknownOption.parent()) unknownOption.remove();
selectElement.val(viewValue);
if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy
} else {
if (isUndefined(viewValue) && emptyOption) {
selectElement.val('');
} else {
selectCtrl.renderUnknownOption(viewValue);
}
}
};
selectElement.bind('change', function() {
scope.$apply(function() {
if (unknownOption.parent()) unknownOption.remove();
ngModelCtrl.$setViewValue(selectElement.val());
});
});
}
function Multiple(scope, selectElement, ctrl) {
var lastView;
ctrl.$render = function() {
var items = new HashMap(ctrl.$viewValue);
forEach(selectElement.find('option'), function(option) {
option.selected = isDefined(items.get(option.value));
});
};
// we have to do it on each watch since ngModel watches reference, but
// we need to work of an array, so we need to see if anything was inserted/removed
scope.$watch(function selectMultipleWatch() {
if (!equals(lastView, ctrl.$viewValue)) {
lastView = copy(ctrl.$viewValue);
ctrl.$render();
}
});
selectElement.bind('change', function() {
scope.$apply(function() {
var array = [];
forEach(selectElement.find('option'), function(option) {
if (option.selected) {
array.push(option.value);
}
});
ctrl.$setViewValue(array);
});
});
}
function Options(scope, selectElement, ctrl) {
var match;
if (! (match = optionsExp.match(NG_OPTIONS_REGEXP))) {
throw Error(
"Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
" but got '" + optionsExp + "'.");
}
var displayFn = $parse(match[2] || match[1]),
valueName = match[4] || match[6],
keyName = match[5],
groupByFn = $parse(match[3] || ''),
valueFn = $parse(match[2] ? match[1] : valueName),
valuesFn = $parse(match[7]),
// This is an array of array of existing option groups in DOM. We try to reuse these if possible
// optionGroupsCache[0] is the options with no option group
// optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element
optionGroupsCache = [[{element: selectElement, label:''}]];
if (nullOption) {
// compile the element since there might be bindings in it
$compile(nullOption)(scope);
// remove the class, which is added automatically because we recompile the element and it
// becomes the compilation root
nullOption.removeClass('ng-scope');
// we need to remove it before calling selectElement.html('') because otherwise IE will
// remove the label from the element. wtf?
nullOption.remove();
}
// clear contents, we'll add what's needed based on the model
selectElement.html('');
selectElement.bind('change', function() {
scope.$apply(function() {
var optionGroup,
collection = valuesFn(scope) || [],
locals = {},
key, value, optionElement, index, groupIndex, length, groupLength;
if (multiple) {
value = [];
for (groupIndex = 0, groupLength = optionGroupsCache.length;
groupIndex < groupLength;
groupIndex++) {
// list of options for that group. (first item has the parent)
optionGroup = optionGroupsCache[groupIndex];
for(index = 1, length = optionGroup.length; index < length; index++) {
if ((optionElement = optionGroup[index].element)[0].selected) {
key = optionElement.val();
if (keyName) locals[keyName] = key;
locals[valueName] = collection[key];
value.push(valueFn(scope, locals));
}
}
}
} else {
key = selectElement.val();
if (key == '?') {
value = undefined;
} else if (key == ''){
value = null;
} else {
locals[valueName] = collection[key];
if (keyName) locals[keyName] = key;
value = valueFn(scope, locals);
}
}
ctrl.$setViewValue(value);
});
});
ctrl.$render = render;
// TODO(vojta): can't we optimize this ?
scope.$watch(render);
function render() {
var optionGroups = {'':[]}, // Temporary location for the option groups before we render them
optionGroupNames = [''],
optionGroupName,
optionGroup,
option,
existingParent, existingOptions, existingOption,
modelValue = ctrl.$modelValue,
values = valuesFn(scope) || [],
keys = keyName ? sortedKeys(values) : values,
groupLength, length,
groupIndex, index,
locals = {},
selected,
selectedSet = false, // nothing is selected yet
lastElement,
element,
label;
if (multiple) {
selectedSet = new HashMap(modelValue);
} else if (modelValue === null || nullOption) {
// if we are not multiselect, and we are null then we have to add the nullOption
optionGroups[''].push({selected:modelValue === null, id:'', label:''});
selectedSet = true;
}
// We now build up the list of options we need (we merge later)
for (index = 0; length = keys.length, index < length; index++) {
locals[valueName] = values[keyName ? locals[keyName]=keys[index]:index];
optionGroupName = groupByFn(scope, locals) || '';
if (!(optionGroup = optionGroups[optionGroupName])) {
optionGroup = optionGroups[optionGroupName] = [];
optionGroupNames.push(optionGroupName);
}
if (multiple) {
selected = selectedSet.remove(valueFn(scope, locals)) != undefined;
} else {
selected = modelValue === valueFn(scope, locals);
selectedSet = selectedSet || selected; // see if at least one item is selected
}
label = displayFn(scope, locals); // what will be seen by the user
label = label === undefined ? '' : label; // doing displayFn(scope, locals) || '' overwrites zero values
optionGroup.push({
id: keyName ? keys[index] : index, // either the index into array or key from object
label: label,
selected: selected // determine if we should be selected
});
}
if (!multiple && !selectedSet) {
// nothing was selected, we have to insert the undefined item
optionGroups[''].unshift({id:'?', label:'', selected:true});
}
// Now we need to update the list of DOM nodes to match the optionGroups we computed above
for (groupIndex = 0, groupLength = optionGroupNames.length;
groupIndex < groupLength;
groupIndex++) {
// current option group name or '' if no group
optionGroupName = optionGroupNames[groupIndex];
// list of options for that group. (first item has the parent)
optionGroup = optionGroups[optionGroupName];
if (optionGroupsCache.length <= groupIndex) {
// we need to grow the optionGroups
existingParent = {
element: optGroupTemplate.clone().attr('label', optionGroupName),
label: optionGroup.label
};
existingOptions = [existingParent];
optionGroupsCache.push(existingOptions);
selectElement.append(existingParent.element);
} else {
existingOptions = optionGroupsCache[groupIndex];
existingParent = existingOptions[0]; // either SELECT (no group) or OPTGROUP element
// update the OPTGROUP label if not the same.
if (existingParent.label != optionGroupName) {
existingParent.element.attr('label', existingParent.label = optionGroupName);
}
}
lastElement = null; // start at the beginning
for(index = 0, length = optionGroup.length; index < length; index++) {
option = optionGroup[index];
if ((existingOption = existingOptions[index+1])) {
// reuse elements
lastElement = existingOption.element;
if (existingOption.label !== option.label) {
lastElement.text(existingOption.label = option.label);
}
if (existingOption.id !== option.id) {
lastElement.val(existingOption.id = option.id);
}
if (existingOption.element.selected !== option.selected) {
lastElement.prop('selected', (existingOption.selected = option.selected));
}
} else {
// grow elements
// if it's a null option
if (option.id === '' && nullOption) {
// put back the pre-compiled element
element = nullOption;
} else {
// jQuery(v1.4.2) Bug: We should be able to chain the method calls, but
// in this version of jQuery on some browser the .text() returns a string
// rather then the element.
(element = optionTemplate.clone())
.val(option.id)
.attr('selected', option.selected)
.text(option.label);
}
existingOptions.push(existingOption = {
element: element,
label: option.label,
id: option.id,
selected: option.selected
});
if (lastElement) {
lastElement.after(element);
} else {
existingParent.element.append(element);
}
lastElement = element;
}
}
// remove any excessive OPTIONs in a group
index++; // increment since the existingOptions[0] is parent element not OPTION
while(existingOptions.length > index) {
existingOptions.pop().element.remove();
}
}
// remove any excessive OPTGROUPs from select
while(optionGroupsCache.length > groupIndex) {
optionGroupsCache.pop()[0].element.remove();
}
}
}
}
}
}];
var optionDirective = ['$interpolate', function($interpolate) {
var nullSelectCtrl = {
addOption: noop,
removeOption: noop
};
return {
restrict: 'E',
priority: 100,
compile: function(element, attr) {
if (isUndefined(attr.value)) {
var interpolateFn = $interpolate(element.text(), true);
if (!interpolateFn) {
attr.$set('value', element.text());
}
}
return function (scope, element, attr) {
var selectCtrlName = '$selectController',
parent = element.parent(),
selectCtrl = parent.data(selectCtrlName) ||
parent.parent().data(selectCtrlName); // in case we are in optgroup
if (selectCtrl && selectCtrl.databound) {
// For some reason Opera defaults to true and if not overridden this messes up the repeater.
// We don't want the view to drive the initialization of the model anyway.
element.prop('selected', false);
} else {
selectCtrl = nullSelectCtrl;
}
if (interpolateFn) {
scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) {
attr.$set('value', newVal);
if (newVal !== oldVal) selectCtrl.removeOption(oldVal);
selectCtrl.addOption(newVal);
});
} else {
selectCtrl.addOption(attr.value);
}
element.bind('$destroy', function() {
selectCtrl.removeOption(attr.value);
});
};
}
}
}];
var styleDirective = valueFn({
restrict: 'E',
terminal: true
});
/**
* Setup file for the Scenario.
* Must be first in the compilation/bootstrap list.
*/
// Public namespace
angular.scenario = angular.scenario || {};
/**
* Defines a new output format.
*
* @param {string} name the name of the new output format
* @param {function()} fn function(context, runner) that generates the output
*/
angular.scenario.output = angular.scenario.output || function(name, fn) {
angular.scenario.output[name] = fn;
};
/**
* Defines a new DSL statement. If your factory function returns a Future
* it's returned, otherwise the result is assumed to be a map of functions
* for chaining. Chained functions are subject to the same rules.
*
* Note: All functions on the chain are bound to the chain scope so values
* set on "this" in your statement function are available in the chained
* functions.
*
* @param {string} name The name of the statement
* @param {function()} fn Factory function(), return a function for
* the statement.
*/
angular.scenario.dsl = angular.scenario.dsl || function(name, fn) {
angular.scenario.dsl[name] = function() {
function executeStatement(statement, args) {
var result = statement.apply(this, args);
if (angular.isFunction(result) || result instanceof angular.scenario.Future)
return result;
var self = this;
var chain = angular.extend({}, result);
angular.forEach(chain, function(value, name) {
if (angular.isFunction(value)) {
chain[name] = function() {
return executeStatement.call(self, value, arguments);
};
} else {
chain[name] = value;
}
});
return chain;
}
var statement = fn.apply(this, arguments);
return function() {
return executeStatement.call(this, statement, arguments);
};
};
};
/**
* Defines a new matcher for use with the expects() statement. The value
* this.actual (like in Jasmine) is available in your matcher to compare
* against. Your function should return a boolean. The future is automatically
* created for you.
*
* @param {string} name The name of the matcher
* @param {function()} fn The matching function(expected).
*/
angular.scenario.matcher = angular.scenario.matcher || function(name, fn) {
angular.scenario.matcher[name] = function(expected) {
var prefix = 'expect ' + this.future.name + ' ';
if (this.inverse) {
prefix += 'not ';
}
var self = this;
this.addFuture(prefix + name + ' ' + angular.toJson(expected),
function(done) {
var error;
self.actual = self.future.value;
if ((self.inverse && fn.call(self, expected)) ||
(!self.inverse && !fn.call(self, expected))) {
error = 'expected ' + angular.toJson(expected) +
' but was ' + angular.toJson(self.actual);
}
done(error);
});
};
};
/**
* Initialize the scenario runner and run !
*
* Access global window and document object
* Access $runner through closure
*
* @param {Object=} config Config options
*/
angular.scenario.setUpAndRun = function(config) {
var href = window.location.href;
var body = _jQuery(document.body);
var output = [];
var objModel = new angular.scenario.ObjectModel($runner);
if (config && config.scenario_output) {
output = config.scenario_output.split(',');
}
angular.forEach(angular.scenario.output, function(fn, name) {
if (!output.length || indexOf(output,name) != -1) {
var context = body.append('<div></div>').find('div:last');
context.attr('id', name);
fn.call({}, context, $runner, objModel);
}
});
if (!/^http/.test(href) && !/^https/.test(href)) {
body.append('<p id="system-error"></p>');
body.find('#system-error').text(
'Scenario runner must be run using http or https. The protocol ' +
href.split(':')[0] + ':// is not supported.'
);
return;
}
var appFrame = body.append('<div id="application"></div>').find('#application');
var application = new angular.scenario.Application(appFrame);
$runner.on('RunnerEnd', function() {
appFrame.css('display', 'none');
appFrame.find('iframe').attr('src', 'about:blank');
});
$runner.on('RunnerError', function(error) {
if (window.console) {
console.log(formatException(error));
} else {
// Do something for IE
alert(error);
}
});
$runner.run(application);
};
/**
* Iterates through list with iterator function that must call the
* continueFunction to continute iterating.
*
* @param {Array} list list to iterate over
* @param {function()} iterator Callback function(value, continueFunction)
* @param {function()} done Callback function(error, result) called when
* iteration finishes or an error occurs.
*/
function asyncForEach(list, iterator, done) {
var i = 0;
function loop(error, index) {
if (index && index > i) {
i = index;
}
if (error || i >= list.length) {
done(error);
} else {
try {
iterator(list[i++], loop);
} catch (e) {
done(e);
}
}
}
loop();
}
/**
* Formats an exception into a string with the stack trace, but limits
* to a specific line length.
*
* @param {Object} error The exception to format, can be anything throwable
* @param {Number=} [maxStackLines=5] max lines of the stack trace to include
* default is 5.
*/
function formatException(error, maxStackLines) {
maxStackLines = maxStackLines || 5;
var message = error.toString();
if (error.stack) {
var stack = error.stack.split('\n');
if (stack[0].indexOf(message) === -1) {
maxStackLines++;
stack.unshift(error.message);
}
message = stack.slice(0, maxStackLines).join('\n');
}
return message;
}
/**
* Returns a function that gets the file name and line number from a
* location in the stack if available based on the call site.
*
* Note: this returns another function because accessing .stack is very
* expensive in Chrome.
*
* @param {Number} offset Number of stack lines to skip
*/
function callerFile(offset) {
var error = new Error();
return function() {
var line = (error.stack || '').split('\n')[offset];
// Clean up the stack trace line
if (line) {
if (line.indexOf('@') !== -1) {
// Firefox
line = line.substring(line.indexOf('@')+1);
} else {
// Chrome
line = line.substring(line.indexOf('(')+1).replace(')', '');
}
}
return line || '';
};
}
/**
* Triggers a browser event. Attempts to choose the right event if one is
* not specified.
*
* @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement
* @param {string} type Optional event type.
* @param {Array.<string>=} keys Optional list of pressed keys
* (valid values: 'alt', 'meta', 'shift', 'ctrl')
*/
function browserTrigger(element, type, keys) {
if (element && !element.nodeName) element = element[0];
if (!element) return;
if (!type) {
type = {
'text': 'change',
'textarea': 'change',
'hidden': 'change',
'password': 'change',
'button': 'click',
'submit': 'click',
'reset': 'click',
'image': 'click',
'checkbox': 'click',
'radio': 'click',
'select-one': 'change',
'select-multiple': 'change'
}[lowercase(element.type)] || 'click';
}
if (lowercase(nodeName_(element)) == 'option') {
element.parentNode.value = element.value;
element = element.parentNode;
type = 'change';
}
keys = keys || [];
function pressed(key) {
return indexOf(keys, key) !== -1;
}
if (msie < 9) {
switch(element.type) {
case 'radio':
case 'checkbox':
element.checked = !element.checked;
break;
}
// WTF!!! Error: Unspecified error.
// Don't know why, but some elements when detached seem to be in inconsistent state and
// calling .fireEvent() on them will result in very unhelpful error (Error: Unspecified error)
// forcing the browser to compute the element position (by reading its CSS)
// puts the element in consistent state.
element.style.posLeft;
// TODO(vojta): create event objects with pressed keys to get it working on IE<9
var ret = element.fireEvent('on' + type);
if (lowercase(element.type) == 'submit') {
while(element) {
if (lowercase(element.nodeName) == 'form') {
element.fireEvent('onsubmit');
break;
}
element = element.parentNode;
}
}
return ret;
} else {
var evnt = document.createEvent('MouseEvents'),
originalPreventDefault = evnt.preventDefault,
iframe = _jQuery('#application iframe')[0],
appWindow = iframe ? iframe.contentWindow : window,
fakeProcessDefault = true,
finalProcessDefault,
angular = appWindow.angular || {};
// igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208
angular['ff-684208-preventDefault'] = false;
evnt.preventDefault = function() {
fakeProcessDefault = false;
return originalPreventDefault.apply(evnt, arguments);
};
evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, pressed('ctrl'), pressed('alt'),
pressed('shift'), pressed('meta'), 0, element);
element.dispatchEvent(evnt);
finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault);
delete angular['ff-684208-preventDefault'];
return finalProcessDefault;
}
}
/**
* Don't use the jQuery trigger method since it works incorrectly.
*
* jQuery notifies listeners and then changes the state of a checkbox and
* does not create a real browser event. A real click changes the state of
* the checkbox and then notifies listeners.
*
* To work around this we instead use our own handler that fires a real event.
*/
(function(fn){
var parentTrigger = fn.trigger;
fn.trigger = function(type) {
if (/(click|change|keydown|blur|input)/.test(type)) {
var processDefaults = [];
this.each(function(index, node) {
processDefaults.push(browserTrigger(node, type));
});
// this is not compatible with jQuery - we return an array of returned values,
// so that scenario runner know whether JS code has preventDefault() of the event or not...
return processDefaults;
}
return parentTrigger.apply(this, arguments);
};
})(_jQuery.fn);
/**
* Finds all bindings with the substring match of name and returns an
* array of their values.
*
* @param {string} bindExp The name to match
* @return {Array.<string>} String of binding values
*/
_jQuery.fn.bindings = function(windowJquery, bindExp) {
var result = [], match,
bindSelector = '.ng-binding:visible';
if (angular.isString(bindExp)) {
bindExp = bindExp.replace(/\s/g, '');
match = function (actualExp) {
if (actualExp) {
actualExp = actualExp.replace(/\s/g, '');
if (actualExp == bindExp) return true;
if (actualExp.indexOf(bindExp) == 0) {
return actualExp.charAt(bindExp.length) == '|';
}
}
}
} else if (bindExp) {
match = function(actualExp) {
return actualExp && bindExp.exec(actualExp);
}
} else {
match = function(actualExp) {
return !!actualExp;
};
}
var selection = this.find(bindSelector);
if (this.is(bindSelector)) {
selection = selection.add(this);
}
function push(value) {
if (value == undefined) {
value = '';
} else if (typeof value != 'string') {
value = angular.toJson(value);
}
result.push('' + value);
}
selection.each(function() {
var element = windowJquery(this),
binding;
if (binding = element.data('$binding')) {
if (typeof binding == 'string') {
if (match(binding)) {
push(element.scope().$eval(binding));
}
} else {
if (!angular.isArray(binding)) {
binding = [binding];
}
for(var fns, j=0, jj=binding.length; j<jj; j++) {
fns = binding[j];
if (fns.parts) {
fns = fns.parts;
} else {
fns = [fns];
}
for (var scope, fn, i = 0, ii = fns.length; i < ii; i++) {
if(match((fn = fns[i]).exp)) {
push(fn(scope = scope || element.scope()));
}
}
}
}
}
});
return result;
};
/**
* Represents the application currently being tested and abstracts usage
* of iframes or separate windows.
*
* @param {Object} context jQuery wrapper around HTML context.
*/
angular.scenario.Application = function(context) {
this.context = context;
context.append(
'<h2>Current URL: <a href="about:blank">None</a></h2>' +
'<div id="test-frames"></div>'
);
};
/**
* Gets the jQuery collection of frames. Don't use this directly because
* frames may go stale.
*
* @private
* @return {Object} jQuery collection
*/
angular.scenario.Application.prototype.getFrame_ = function() {
return this.context.find('#test-frames iframe:last');
};
/**
* Gets the window of the test runner frame. Always favor executeAction()
* instead of this method since it prevents you from getting a stale window.
*
* @private
* @return {Object} the window of the frame
*/
angular.scenario.Application.prototype.getWindow_ = function() {
var contentWindow = this.getFrame_().prop('contentWindow');
if (!contentWindow)
throw 'Frame window is not accessible.';
return contentWindow;
};
/**
* Changes the location of the frame.
*
* @param {string} url The URL. If it begins with a # then only the
* hash of the page is changed.
* @param {function()} loadFn function($window, $document) Called when frame loads.
* @param {function()} errorFn function(error) Called if any error when loading.
*/
angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorFn) {
var self = this;
var frame = this.getFrame_();
//TODO(esprehn): Refactor to use rethrow()
errorFn = errorFn || function(e) { throw e; };
if (url === 'about:blank') {
errorFn('Sandbox Error: Navigating to about:blank is not allowed.');
} else if (url.charAt(0) === '#') {
url = frame.attr('src').split('#')[0] + url;
frame.attr('src', url);
this.executeAction(loadFn);
} else {
frame.remove();
this.context.find('#test-frames').append('<iframe>');
frame = this.getFrame_();
frame.load(function() {
frame.unbind();
try {
self.executeAction(loadFn);
} catch (e) {
errorFn(e);
}
}).attr('src', url);
}
this.context.find('> h2 a').attr('href', url).text(url);
};
/**
* Executes a function in the context of the tested application. Will wait
* for all pending angular xhr requests before executing.
*
* @param {function()} action The callback to execute. function($window, $document)
* $document is a jQuery wrapped document.
*/
angular.scenario.Application.prototype.executeAction = function(action) {
var self = this;
var $window = this.getWindow_();
if (!$window.document) {
throw 'Sandbox Error: Application document not accessible.';
}
if (!$window.angular) {
return action.call(this, $window, _jQuery($window.document));
}
angularInit($window.document, function(element) {
var $injector = $window.angular.element(element).injector();
var $element = _jQuery(element);
$element.injector = function() {
return $injector;
};
$injector.invoke(function($browser){
$browser.notifyWhenNoOutstandingRequests(function() {
action.call(self, $window, $element);
});
});
});
};
/**
* The representation of define blocks. Don't used directly, instead use
* define() in your tests.
*
* @param {string} descName Name of the block
* @param {Object} parent describe or undefined if the root.
*/
angular.scenario.Describe = function(descName, parent) {
this.only = parent && parent.only;
this.beforeEachFns = [];
this.afterEachFns = [];
this.its = [];
this.children = [];
this.name = descName;
this.parent = parent;
this.id = angular.scenario.Describe.id++;
/**
* Calls all before functions.
*/
var beforeEachFns = this.beforeEachFns;
this.setupBefore = function() {
if (parent) parent.setupBefore.call(this);
angular.forEach(beforeEachFns, function(fn) { fn.call(this); }, this);
};
/**
* Calls all after functions.
*/
var afterEachFns = this.afterEachFns;
this.setupAfter = function() {
angular.forEach(afterEachFns, function(fn) { fn.call(this); }, this);
if (parent) parent.setupAfter.call(this);
};
};
// Shared Unique ID generator for every describe block
angular.scenario.Describe.id = 0;
// Shared Unique ID generator for every it (spec)
angular.scenario.Describe.specId = 0;
/**
* Defines a block to execute before each it or nested describe.
*
* @param {function()} body Body of the block.
*/
angular.scenario.Describe.prototype.beforeEach = function(body) {
this.beforeEachFns.push(body);
};
/**
* Defines a block to execute after each it or nested describe.
*
* @param {function()} body Body of the block.
*/
angular.scenario.Describe.prototype.afterEach = function(body) {
this.afterEachFns.push(body);
};
/**
* Creates a new describe block that's a child of this one.
*
* @param {string} name Name of the block. Appended to the parent block's name.
* @param {function()} body Body of the block.
*/
angular.scenario.Describe.prototype.describe = function(name, body) {
var child = new angular.scenario.Describe(name, this);
this.children.push(child);
body.call(child);
};
/**
* Same as describe() but makes ddescribe blocks the only to run.
*
* @param {string} name Name of the test.
* @param {function()} body Body of the block.
*/
angular.scenario.Describe.prototype.ddescribe = function(name, body) {
var child = new angular.scenario.Describe(name, this);
child.only = true;
this.children.push(child);
body.call(child);
};
/**
* Use to disable a describe block.
*/
angular.scenario.Describe.prototype.xdescribe = angular.noop;
/**
* Defines a test.
*
* @param {string} name Name of the test.
* @param {function()} vody Body of the block.
*/
angular.scenario.Describe.prototype.it = function(name, body) {
this.its.push({
id: angular.scenario.Describe.specId++,
definition: this,
only: this.only,
name: name,
before: this.setupBefore,
body: body,
after: this.setupAfter
});
};
/**
* Same as it() but makes iit tests the only test to run.
*
* @param {string} name Name of the test.
* @param {function()} body Body of the block.
*/
angular.scenario.Describe.prototype.iit = function(name, body) {
this.it.apply(this, arguments);
this.its[this.its.length-1].only = true;
};
/**
* Use to disable a test block.
*/
angular.scenario.Describe.prototype.xit = angular.noop;
/**
* Gets an array of functions representing all the tests (recursively).
* that can be executed with SpecRunner's.
*
* @return {Array<Object>} Array of it blocks {
* definition : Object // parent Describe
* only: boolean
* name: string
* before: Function
* body: Function
* after: Function
* }
*/
angular.scenario.Describe.prototype.getSpecs = function() {
var specs = arguments[0] || [];
angular.forEach(this.children, function(child) {
child.getSpecs(specs);
});
angular.forEach(this.its, function(it) {
specs.push(it);
});
var only = [];
angular.forEach(specs, function(it) {
if (it.only) {
only.push(it);
}
});
return (only.length && only) || specs;
};
/**
* A future action in a spec.
*
* @param {string} name of the future action
* @param {function()} future callback(error, result)
* @param {function()} Optional. function that returns the file/line number.
*/
angular.scenario.Future = function(name, behavior, line) {
this.name = name;
this.behavior = behavior;
this.fulfilled = false;
this.value = undefined;
this.parser = angular.identity;
this.line = line || function() { return ''; };
};
/**
* Executes the behavior of the closure.
*
* @param {function()} doneFn Callback function(error, result)
*/
angular.scenario.Future.prototype.execute = function(doneFn) {
var self = this;
this.behavior(function(error, result) {
self.fulfilled = true;
if (result) {
try {
result = self.parser(result);
} catch(e) {
error = e;
}
}
self.value = error || result;
doneFn(error, result);
});
};
/**
* Configures the future to convert it's final with a function fn(value)
*
* @param {function()} fn function(value) that returns the parsed value
*/
angular.scenario.Future.prototype.parsedWith = function(fn) {
this.parser = fn;
return this;
};
/**
* Configures the future to parse it's final value from JSON
* into objects.
*/
angular.scenario.Future.prototype.fromJson = function() {
return this.parsedWith(angular.fromJson);
};
/**
* Configures the future to convert it's final value from objects
* into JSON.
*/
angular.scenario.Future.prototype.toJson = function() {
return this.parsedWith(angular.toJson);
};
/**
* Maintains an object tree from the runner events.
*
* @param {Object} runner The scenario Runner instance to connect to.
*
* TODO(esprehn): Every output type creates one of these, but we probably
* want one global shared instance. Need to handle events better too
* so the HTML output doesn't need to do spec model.getSpec(spec.id)
* silliness.
*
* TODO(vojta) refactor on, emit methods (from all objects) - use inheritance
*/
angular.scenario.ObjectModel = function(runner) {
var self = this;
this.specMap = {};
this.listeners = [];
this.value = {
name: '',
children: {}
};
runner.on('SpecBegin', function(spec) {
var block = self.value,
definitions = [];
angular.forEach(self.getDefinitionPath(spec), function(def) {
if (!block.children[def.name]) {
block.children[def.name] = {
id: def.id,
name: def.name,
children: {},
specs: {}
};
}
block = block.children[def.name];
definitions.push(def.name);
});
var it = self.specMap[spec.id] =
block.specs[spec.name] =
new angular.scenario.ObjectModel.Spec(spec.id, spec.name, definitions);
// forward the event
self.emit('SpecBegin', it);
});
runner.on('SpecError', function(spec, error) {
var it = self.getSpec(spec.id);
it.status = 'error';
it.error = error;
// forward the event
self.emit('SpecError', it, error);
});
runner.on('SpecEnd', function(spec) {
var it = self.getSpec(spec.id);
complete(it);
// forward the event
self.emit('SpecEnd', it);
});
runner.on('StepBegin', function(spec, step) {
var it = self.getSpec(spec.id);
var step = new angular.scenario.ObjectModel.Step(step.name);
it.steps.push(step);
// forward the event
self.emit('StepBegin', it, step);
});
runner.on('StepEnd', function(spec) {
var it = self.getSpec(spec.id);
var step = it.getLastStep();
if (step.name !== step.name)
throw 'Events fired in the wrong order. Step names don\'t match.';
complete(step);
// forward the event
self.emit('StepEnd', it, step);
});
runner.on('StepFailure', function(spec, step, error) {
var it = self.getSpec(spec.id),
modelStep = it.getLastStep();
modelStep.setErrorStatus('failure', error, step.line());
it.setStatusFromStep(modelStep);
// forward the event
self.emit('StepFailure', it, modelStep, error);
});
runner.on('StepError', function(spec, step, error) {
var it = self.getSpec(spec.id),
modelStep = it.getLastStep();
modelStep.setErrorStatus('error', error, step.line());
it.setStatusFromStep(modelStep);
// forward the event
self.emit('StepError', it, modelStep, error);
});
runner.on('RunnerBegin', function() {
self.emit('RunnerBegin');
});
runner.on('RunnerEnd', function() {
self.emit('RunnerEnd');
});
function complete(item) {
item.endTime = new Date().getTime();
item.duration = item.endTime - item.startTime;
item.status = item.status || 'success';
}
};
/**
* Adds a listener for an event.
*
* @param {string} eventName Name of the event to add a handler for
* @param {function()} listener Function that will be called when event is fired
*/
angular.scenario.ObjectModel.prototype.on = function(eventName, listener) {
eventName = eventName.toLowerCase();
this.listeners[eventName] = this.listeners[eventName] || [];
this.listeners[eventName].push(listener);
};
/**
* Emits an event which notifies listeners and passes extra
* arguments.
*
* @param {string} eventName Name of the event to fire.
*/
angular.scenario.ObjectModel.prototype.emit = function(eventName) {
var self = this,
args = Array.prototype.slice.call(arguments, 1),
eventName = eventName.toLowerCase();
if (this.listeners[eventName]) {
angular.forEach(this.listeners[eventName], function(listener) {
listener.apply(self, args);
});
}
};
/**
* Computes the path of definition describe blocks that wrap around
* this spec.
*
* @param spec Spec to compute the path for.
* @return {Array<Describe>} The describe block path
*/
angular.scenario.ObjectModel.prototype.getDefinitionPath = function(spec) {
var path = [];
var currentDefinition = spec.definition;
while (currentDefinition && currentDefinition.name) {
path.unshift(currentDefinition);
currentDefinition = currentDefinition.parent;
}
return path;
};
/**
* Gets a spec by id.
*
* @param {string} The id of the spec to get the object for.
* @return {Object} the Spec instance
*/
angular.scenario.ObjectModel.prototype.getSpec = function(id) {
return this.specMap[id];
};
/**
* A single it block.
*
* @param {string} id Id of the spec
* @param {string} name Name of the spec
* @param {Array<string>=} definitionNames List of all describe block names that wrap this spec
*/
angular.scenario.ObjectModel.Spec = function(id, name, definitionNames) {
this.id = id;
this.name = name;
this.startTime = new Date().getTime();
this.steps = [];
this.fullDefinitionName = (definitionNames || []).join(' ');
};
/**
* Adds a new step to the Spec.
*
* @param {string} step Name of the step (really name of the future)
* @return {Object} the added step
*/
angular.scenario.ObjectModel.Spec.prototype.addStep = function(name) {
var step = new angular.scenario.ObjectModel.Step(name);
this.steps.push(step);
return step;
};
/**
* Gets the most recent step.
*
* @return {Object} the step
*/
angular.scenario.ObjectModel.Spec.prototype.getLastStep = function() {
return this.steps[this.steps.length-1];
};
/**
* Set status of the Spec from given Step
*
* @param {angular.scenario.ObjectModel.Step} step
*/
angular.scenario.ObjectModel.Spec.prototype.setStatusFromStep = function(step) {
if (!this.status || step.status == 'error') {
this.status = step.status;
this.error = step.error;
this.line = step.line;
}
};
/**
* A single step inside a Spec.
*
* @param {string} step Name of the step
*/
angular.scenario.ObjectModel.Step = function(name) {
this.name = name;
this.startTime = new Date().getTime();
};
/**
* Helper method for setting all error status related properties
*
* @param {string} status
* @param {string} error
* @param {string} line
*/
angular.scenario.ObjectModel.Step.prototype.setErrorStatus = function(status, error, line) {
this.status = status;
this.error = error;
this.line = line;
};
/**
* Runner for scenarios
*
* Has to be initialized before any test is loaded,
* because it publishes the API into window (global space).
*/
angular.scenario.Runner = function($window) {
this.listeners = [];
this.$window = $window;
this.rootDescribe = new angular.scenario.Describe();
this.currentDescribe = this.rootDescribe;
this.api = {
it: this.it,
iit: this.iit,
xit: angular.noop,
describe: this.describe,
ddescribe: this.ddescribe,
xdescribe: angular.noop,
beforeEach: this.beforeEach,
afterEach: this.afterEach
};
angular.forEach(this.api, angular.bind(this, function(fn, key) {
this.$window[key] = angular.bind(this, fn);
}));
};
/**
* Emits an event which notifies listeners and passes extra
* arguments.
*
* @param {string} eventName Name of the event to fire.
*/
angular.scenario.Runner.prototype.emit = function(eventName) {
var self = this;
var args = Array.prototype.slice.call(arguments, 1);
eventName = eventName.toLowerCase();
if (!this.listeners[eventName])
return;
angular.forEach(this.listeners[eventName], function(listener) {
listener.apply(self, args);
});
};
/**
* Adds a listener for an event.
*
* @param {string} eventName The name of the event to add a handler for
* @param {string} listener The fn(...) that takes the extra arguments from emit()
*/
angular.scenario.Runner.prototype.on = function(eventName, listener) {
eventName = eventName.toLowerCase();
this.listeners[eventName] = this.listeners[eventName] || [];
this.listeners[eventName].push(listener);
};
/**
* Defines a describe block of a spec.
*
* @see Describe.js
*
* @param {string} name Name of the block
* @param {function()} body Body of the block
*/
angular.scenario.Runner.prototype.describe = function(name, body) {
var self = this;
this.currentDescribe.describe(name, function() {
var parentDescribe = self.currentDescribe;
self.currentDescribe = this;
try {
body.call(this);
} finally {
self.currentDescribe = parentDescribe;
}
});
};
/**
* Same as describe, but makes ddescribe the only blocks to run.
*
* @see Describe.js
*
* @param {string} name Name of the block
* @param {function()} body Body of the block
*/
angular.scenario.Runner.prototype.ddescribe = function(name, body) {
var self = this;
this.currentDescribe.ddescribe(name, function() {
var parentDescribe = self.currentDescribe;
self.currentDescribe = this;
try {
body.call(this);
} finally {
self.currentDescribe = parentDescribe;
}
});
};
/**
* Defines a test in a describe block of a spec.
*
* @see Describe.js
*
* @param {string} name Name of the block
* @param {function()} body Body of the block
*/
angular.scenario.Runner.prototype.it = function(name, body) {
this.currentDescribe.it(name, body);
};
/**
* Same as it, but makes iit tests the only tests to run.
*
* @see Describe.js
*
* @param {string} name Name of the block
* @param {function()} body Body of the block
*/
angular.scenario.Runner.prototype.iit = function(name, body) {
this.currentDescribe.iit(name, body);
};
/**
* Defines a function to be called before each it block in the describe
* (and before all nested describes).
*
* @see Describe.js
*
* @param {function()} Callback to execute
*/
angular.scenario.Runner.prototype.beforeEach = function(body) {
this.currentDescribe.beforeEach(body);
};
/**
* Defines a function to be called after each it block in the describe
* (and before all nested describes).
*
* @see Describe.js
*
* @param {function()} Callback to execute
*/
angular.scenario.Runner.prototype.afterEach = function(body) {
this.currentDescribe.afterEach(body);
};
/**
* Creates a new spec runner.
*
* @private
* @param {Object} scope parent scope
*/
angular.scenario.Runner.prototype.createSpecRunner_ = function(scope) {
var child = scope.$new();
var Cls = angular.scenario.SpecRunner;
// Export all the methods to child scope manually as now we don't mess controllers with scopes
// TODO(vojta): refactor scenario runner so that these objects are not tightly coupled as current
for (var name in Cls.prototype)
child[name] = angular.bind(child, Cls.prototype[name]);
Cls.call(child);
return child;
};
/**
* Runs all the loaded tests with the specified runner class on the
* provided application.
*
* @param {angular.scenario.Application} application App to remote control.
*/
angular.scenario.Runner.prototype.run = function(application) {
var self = this;
var $root = angular.injector(['ng']).get('$rootScope');
angular.extend($root, this);
angular.forEach(angular.scenario.Runner.prototype, function(fn, name) {
$root[name] = angular.bind(self, fn);
});
$root.application = application;
$root.emit('RunnerBegin');
asyncForEach(this.rootDescribe.getSpecs(), function(spec, specDone) {
var dslCache = {};
var runner = self.createSpecRunner_($root);
angular.forEach(angular.scenario.dsl, function(fn, key) {
dslCache[key] = fn.call($root);
});
angular.forEach(angular.scenario.dsl, function(fn, key) {
self.$window[key] = function() {
var line = callerFile(3);
var scope = runner.$new();
// Make the dsl accessible on the current chain
scope.dsl = {};
angular.forEach(dslCache, function(fn, key) {
scope.dsl[key] = function() {
return dslCache[key].apply(scope, arguments);
};
});
// Make these methods work on the current chain
scope.addFuture = function() {
Array.prototype.push.call(arguments, line);
return angular.scenario.SpecRunner.
prototype.addFuture.apply(scope, arguments);
};
scope.addFutureAction = function() {
Array.prototype.push.call(arguments, line);
return angular.scenario.SpecRunner.
prototype.addFutureAction.apply(scope, arguments);
};
return scope.dsl[key].apply(scope, arguments);
};
});
runner.run(spec, function() {
runner.$destroy();
specDone.apply(this, arguments);
});
},
function(error) {
if (error) {
self.emit('RunnerError', error);
}
self.emit('RunnerEnd');
});
};
/**
* This class is the "this" of the it/beforeEach/afterEach method.
* Responsibilities:
* - "this" for it/beforeEach/afterEach
* - keep state for single it/beforeEach/afterEach execution
* - keep track of all of the futures to execute
* - run single spec (execute each future)
*/
angular.scenario.SpecRunner = function() {
this.futures = [];
this.afterIndex = 0;
};
/**
* Executes a spec which is an it block with associated before/after functions
* based on the describe nesting.
*
* @param {Object} spec A spec object
* @param {function()} specDone function that is called when the spec finshes. Function(error, index)
*/
angular.scenario.SpecRunner.prototype.run = function(spec, specDone) {
var self = this;
this.spec = spec;
this.emit('SpecBegin', spec);
try {
spec.before.call(this);
spec.body.call(this);
this.afterIndex = this.futures.length;
spec.after.call(this);
} catch (e) {
this.emit('SpecError', spec, e);
this.emit('SpecEnd', spec);
specDone();
return;
}
var handleError = function(error, done) {
if (self.error) {
return done();
}
self.error = true;
done(null, self.afterIndex);
};
asyncForEach(
this.futures,
function(future, futureDone) {
self.step = future;
self.emit('StepBegin', spec, future);
try {
future.execute(function(error) {
if (error) {
self.emit('StepFailure', spec, future, error);
self.emit('StepEnd', spec, future);
return handleError(error, futureDone);
}
self.emit('StepEnd', spec, future);
self.$window.setTimeout(function() { futureDone(); }, 0);
});
} catch (e) {
self.emit('StepError', spec, future, e);
self.emit('StepEnd', spec, future);
handleError(e, futureDone);
}
},
function(e) {
if (e) {
self.emit('SpecError', spec, e);
}
self.emit('SpecEnd', spec);
// Call done in a timeout so exceptions don't recursively
// call this function
self.$window.setTimeout(function() { specDone(); }, 0);
}
);
};
/**
* Adds a new future action.
*
* Note: Do not pass line manually. It happens automatically.
*
* @param {string} name Name of the future
* @param {function()} behavior Behavior of the future
* @param {function()} line fn() that returns file/line number
*/
angular.scenario.SpecRunner.prototype.addFuture = function(name, behavior, line) {
var future = new angular.scenario.Future(name, angular.bind(this, behavior), line);
this.futures.push(future);
return future;
};
/**
* Adds a new future action to be executed on the application window.
*
* Note: Do not pass line manually. It happens automatically.
*
* @param {string} name Name of the future
* @param {function()} behavior Behavior of the future
* @param {function()} line fn() that returns file/line number
*/
angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior, line) {
var self = this;
var NG = /\[ng\\\:/;
return this.addFuture(name, function(done) {
this.application.executeAction(function($window, $document) {
//TODO(esprehn): Refactor this so it doesn't need to be in here.
$document.elements = function(selector) {
var args = Array.prototype.slice.call(arguments, 1);
selector = (self.selector || '') + ' ' + (selector || '');
selector = _jQuery.trim(selector) || '*';
angular.forEach(args, function(value, index) {
selector = selector.replace('$' + (index + 1), value);
});
var result = $document.find(selector);
if (selector.match(NG)) {
angular.forEach(['[ng-','[data-ng-','[x-ng-'], function(value, index){
result = result.add(selector.replace(NG, value), $document);
});
}
if (!result.length) {
throw {
type: 'selector',
message: 'Selector ' + selector + ' did not match any elements.'
};
}
return result;
};
try {
behavior.call(self, $window, $document, done);
} catch(e) {
if (e.type && e.type === 'selector') {
done(e.message);
} else {
throw e;
}
}
});
}, line);
};
/**
* Shared DSL statements that are useful to all scenarios.
*/
/**
* Usage:
* pause() pauses until you call resume() in the console
*/
angular.scenario.dsl('pause', function() {
return function() {
return this.addFuture('pausing for you to resume', function(done) {
this.emit('InteractivePause', this.spec, this.step);
this.$window.resume = function() { done(); };
});
};
});
/**
* Usage:
* sleep(seconds) pauses the test for specified number of seconds
*/
angular.scenario.dsl('sleep', function() {
return function(time) {
return this.addFuture('sleep for ' + time + ' seconds', function(done) {
this.$window.setTimeout(function() { done(null, time * 1000); }, time * 1000);
});
};
});
/**
* Usage:
* browser().navigateTo(url) Loads the url into the frame
* browser().navigateTo(url, fn) where fn(url) is called and returns the URL to navigate to
* browser().reload() refresh the page (reload the same URL)
* browser().window.href() window.location.href
* browser().window.path() window.location.pathname
* browser().window.search() window.location.search
* browser().window.hash() window.location.hash without # prefix
* browser().location().url() see ng.$location#url
* browser().location().path() see ng.$location#path
* browser().location().search() see ng.$location#search
* browser().location().hash() see ng.$location#hash
*/
angular.scenario.dsl('browser', function() {
var chain = {};
chain.navigateTo = function(url, delegate) {
var application = this.application;
return this.addFuture("browser navigate to '" + url + "'", function(done) {
if (delegate) {
url = delegate.call(this, url);
}
application.navigateTo(url, function() {
done(null, url);
}, done);
});
};
chain.reload = function() {
var application = this.application;
return this.addFutureAction('browser reload', function($window, $document, done) {
var href = $window.location.href;
application.navigateTo(href, function() {
done(null, href);
}, done);
});
};
chain.window = function() {
var api = {};
api.href = function() {
return this.addFutureAction('window.location.href', function($window, $document, done) {
done(null, $window.location.href);
});
};
api.path = function() {
return this.addFutureAction('window.location.path', function($window, $document, done) {
done(null, $window.location.pathname);
});
};
api.search = function() {
return this.addFutureAction('window.location.search', function($window, $document, done) {
done(null, $window.location.search);
});
};
api.hash = function() {
return this.addFutureAction('window.location.hash', function($window, $document, done) {
done(null, $window.location.hash.replace('#', ''));
});
};
return api;
};
chain.location = function() {
var api = {};
api.url = function() {
return this.addFutureAction('$location.url()', function($window, $document, done) {
done(null, $document.injector().get('$location').url());
});
};
api.path = function() {
return this.addFutureAction('$location.path()', function($window, $document, done) {
done(null, $document.injector().get('$location').path());
});
};
api.search = function() {
return this.addFutureAction('$location.search()', function($window, $document, done) {
done(null, $document.injector().get('$location').search());
});
};
api.hash = function() {
return this.addFutureAction('$location.hash()', function($window, $document, done) {
done(null, $document.injector().get('$location').hash());
});
};
return api;
};
return function() {
return chain;
};
});
/**
* Usage:
* expect(future).{matcher} where matcher is one of the matchers defined
* with angular.scenario.matcher
*
* ex. expect(binding("name")).toEqual("Elliott")
*/
angular.scenario.dsl('expect', function() {
var chain = angular.extend({}, angular.scenario.matcher);
chain.not = function() {
this.inverse = true;
return chain;
};
return function(future) {
this.future = future;
return chain;
};
});
/**
* Usage:
* using(selector, label) scopes the next DSL element selection
*
* ex.
* using('#foo', "'Foo' text field").input('bar')
*/
angular.scenario.dsl('using', function() {
return function(selector, label) {
this.selector = _jQuery.trim((this.selector||'') + ' ' + selector);
if (angular.isString(label) && label.length) {
this.label = label + ' ( ' + this.selector + ' )';
} else {
this.label = this.selector;
}
return this.dsl;
};
});
/**
* Usage:
* binding(name) returns the value of the first matching binding
*/
angular.scenario.dsl('binding', function() {
return function(name) {
return this.addFutureAction("select binding '" + name + "'", function($window, $document, done) {
var values = $document.elements().bindings($window.angular.element, name);
if (!values.length) {
return done("Binding selector '" + name + "' did not match.");
}
done(null, values[0]);
});
};
});
/**
* Usage:
* input(name).enter(value) enters value in input with specified name
* input(name).check() checks checkbox
* input(name).select(value) selects the radio button with specified name/value
* input(name).val() returns the value of the input.
*/
angular.scenario.dsl('input', function() {
var chain = {};
var supportInputEvent = 'oninput' in document.createElement('div') && msie != 9;
chain.enter = function(value, event) {
return this.addFutureAction("input '" + this.name + "' enter '" + value + "'", function($window, $document, done) {
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
input.val(value);
input.trigger(event || (supportInputEvent ? 'input' : 'change'));
done();
});
};
chain.check = function() {
return this.addFutureAction("checkbox '" + this.name + "' toggle", function($window, $document, done) {
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':checkbox');
input.trigger('click');
done();
});
};
chain.select = function(value) {
return this.addFutureAction("radio button '" + this.name + "' toggle '" + value + "'", function($window, $document, done) {
var input = $document.
elements('[ng\\:model="$1"][value="$2"]', this.name, value).filter(':radio');
input.trigger('click');
done();
});
};
chain.val = function() {
return this.addFutureAction("return input val", function($window, $document, done) {
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
done(null,input.val());
});
};
return function(name) {
this.name = name;
return chain;
};
});
/**
* Usage:
* repeater('#products table', 'Product List').count() number of rows
* repeater('#products table', 'Product List').row(1) all bindings in row as an array
* repeater('#products table', 'Product List').column('product.name') all values across all rows in an array
*/
angular.scenario.dsl('repeater', function() {
var chain = {};
chain.count = function() {
return this.addFutureAction("repeater '" + this.label + "' count", function($window, $document, done) {
try {
done(null, $document.elements().length);
} catch (e) {
done(null, 0);
}
});
};
chain.column = function(binding) {
return this.addFutureAction("repeater '" + this.label + "' column '" + binding + "'", function($window, $document, done) {
done(null, $document.elements().bindings($window.angular.element, binding));
});
};
chain.row = function(index) {
return this.addFutureAction("repeater '" + this.label + "' row '" + index + "'", function($window, $document, done) {
var matches = $document.elements().slice(index, index + 1);
if (!matches.length)
return done('row ' + index + ' out of bounds');
done(null, matches.bindings($window.angular.element));
});
};
return function(selector, label) {
this.dsl.using(selector, label);
return chain;
};
});
/**
* Usage:
* select(name).option('value') select one option
* select(name).options('value1', 'value2', ...) select options from a multi select
*/
angular.scenario.dsl('select', function() {
var chain = {};
chain.option = function(value) {
return this.addFutureAction("select '" + this.name + "' option '" + value + "'", function($window, $document, done) {
var select = $document.elements('select[ng\\:model="$1"]', this.name);
var option = select.find('option[value="' + value + '"]');
if (option.length) {
select.val(value);
} else {
option = select.find('option:contains("' + value + '")');
if (option.length) {
select.val(option.val());
}
}
select.trigger('change');
done();
});
};
chain.options = function() {
var values = arguments;
return this.addFutureAction("select '" + this.name + "' options '" + values + "'", function($window, $document, done) {
var select = $document.elements('select[multiple][ng\\:model="$1"]', this.name);
select.val(values);
select.trigger('change');
done();
});
};
return function(name) {
this.name = name;
return chain;
};
});
/**
* Usage:
* element(selector, label).count() get the number of elements that match selector
* element(selector, label).click() clicks an element
* element(selector, label).query(fn) executes fn(selectedElements, done)
* element(selector, label).{method}() gets the value (as defined by jQuery, ex. val)
* element(selector, label).{method}(value) sets the value (as defined by jQuery, ex. val)
* element(selector, label).{method}(key) gets the value (as defined by jQuery, ex. attr)
* element(selector, label).{method}(key, value) sets the value (as defined by jQuery, ex. attr)
*/
angular.scenario.dsl('element', function() {
var KEY_VALUE_METHODS = ['attr', 'css', 'prop'];
var VALUE_METHODS = [
'val', 'text', 'html', 'height', 'innerHeight', 'outerHeight', 'width',
'innerWidth', 'outerWidth', 'position', 'scrollLeft', 'scrollTop', 'offset'
];
var chain = {};
chain.count = function() {
return this.addFutureAction("element '" + this.label + "' count", function($window, $document, done) {
try {
done(null, $document.elements().length);
} catch (e) {
done(null, 0);
}
});
};
chain.click = function() {
return this.addFutureAction("element '" + this.label + "' click", function($window, $document, done) {
var elements = $document.elements();
var href = elements.attr('href');
var eventProcessDefault = elements.trigger('click')[0];
if (href && elements[0].nodeName.toUpperCase() === 'A' && eventProcessDefault) {
this.application.navigateTo(href, function() {
done();
}, done);
} else {
done();
}
});
};
chain.query = function(fn) {
return this.addFutureAction('element ' + this.label + ' custom query', function($window, $document, done) {
fn.call(this, $document.elements(), done);
});
};
angular.forEach(KEY_VALUE_METHODS, function(methodName) {
chain[methodName] = function(name, value) {
var args = arguments,
futureName = (args.length == 1)
? "element '" + this.label + "' get " + methodName + " '" + name + "'"
: "element '" + this.label + "' set " + methodName + " '" + name + "' to " + "'" + value + "'";
return this.addFutureAction(futureName, function($window, $document, done) {
var element = $document.elements();
done(null, element[methodName].apply(element, args));
});
};
});
angular.forEach(VALUE_METHODS, function(methodName) {
chain[methodName] = function(value) {
var args = arguments,
futureName = (args.length == 0)
? "element '" + this.label + "' " + methodName
: futureName = "element '" + this.label + "' set " + methodName + " to '" + value + "'";
return this.addFutureAction(futureName, function($window, $document, done) {
var element = $document.elements();
done(null, element[methodName].apply(element, args));
});
};
});
return function(selector, label) {
this.dsl.using(selector, label);
return chain;
};
});
/**
* Matchers for implementing specs. Follows the Jasmine spec conventions.
*/
angular.scenario.matcher('toEqual', function(expected) {
return angular.equals(this.actual, expected);
});
angular.scenario.matcher('toBe', function(expected) {
return this.actual === expected;
});
angular.scenario.matcher('toBeDefined', function() {
return angular.isDefined(this.actual);
});
angular.scenario.matcher('toBeTruthy', function() {
return this.actual;
});
angular.scenario.matcher('toBeFalsy', function() {
return !this.actual;
});
angular.scenario.matcher('toMatch', function(expected) {
return new RegExp(expected).test(this.actual);
});
angular.scenario.matcher('toBeNull', function() {
return this.actual === null;
});
angular.scenario.matcher('toContain', function(expected) {
return includes(this.actual, expected);
});
angular.scenario.matcher('toBeLessThan', function(expected) {
return this.actual < expected;
});
angular.scenario.matcher('toBeGreaterThan', function(expected) {
return this.actual > expected;
});
/**
* User Interface for the Scenario Runner.
*
* TODO(esprehn): This should be refactored now that ObjectModel exists
* to use angular bindings for the UI.
*/
angular.scenario.output('html', function(context, runner, model) {
var specUiMap = {},
lastStepUiMap = {};
context.append(
'<div id="header">' +
' <h1><span class="angular">AngularJS</span>: Scenario Test Runner</h1>' +
' <ul id="status-legend" class="status-display">' +
' <li class="status-error">0 Errors</li>' +
' <li class="status-failure">0 Failures</li>' +
' <li class="status-success">0 Passed</li>' +
' </ul>' +
'</div>' +
'<div id="specs">' +
' <div class="test-children"></div>' +
'</div>'
);
runner.on('InteractivePause', function(spec) {
var ui = lastStepUiMap[spec.id];
ui.find('.test-title').
html('paused... <a href="javascript:resume()">resume</a> when ready.');
});
runner.on('SpecBegin', function(spec) {
var ui = findContext(spec);
ui.find('> .tests').append(
'<li class="status-pending test-it"></li>'
);
ui = ui.find('> .tests li:last');
ui.append(
'<div class="test-info">' +
' <p class="test-title">' +
' <span class="timer-result"></span>' +
' <span class="test-name"></span>' +
' </p>' +
'</div>' +
'<div class="scrollpane">' +
' <ol class="test-actions"></ol>' +
'</div>'
);
ui.find('> .test-info .test-name').text(spec.name);
ui.find('> .test-info').click(function() {
var scrollpane = ui.find('> .scrollpane');
var actions = scrollpane.find('> .test-actions');
var name = context.find('> .test-info .test-name');
if (actions.find(':visible').length) {
actions.hide();
name.removeClass('open').addClass('closed');
} else {
actions.show();
scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight'));
name.removeClass('closed').addClass('open');
}
});
specUiMap[spec.id] = ui;
});
runner.on('SpecError', function(spec, error) {
var ui = specUiMap[spec.id];
ui.append('<pre></pre>');
ui.find('> pre').text(formatException(error));
});
runner.on('SpecEnd', function(spec) {
var ui = specUiMap[spec.id];
spec = model.getSpec(spec.id);
ui.removeClass('status-pending');
ui.addClass('status-' + spec.status);
ui.find("> .test-info .timer-result").text(spec.duration + "ms");
if (spec.status === 'success') {
ui.find('> .test-info .test-name').addClass('closed');
ui.find('> .scrollpane .test-actions').hide();
}
updateTotals(spec.status);
});
runner.on('StepBegin', function(spec, step) {
var ui = specUiMap[spec.id];
spec = model.getSpec(spec.id);
step = spec.getLastStep();
ui.find('> .scrollpane .test-actions').append('<li class="status-pending"></li>');
var stepUi = lastStepUiMap[spec.id] = ui.find('> .scrollpane .test-actions li:last');
stepUi.append(
'<div class="timer-result"></div>' +
'<div class="test-title"></div>'
);
stepUi.find('> .test-title').text(step.name);
var scrollpane = stepUi.parents('.scrollpane');
scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight'));
});
runner.on('StepFailure', function(spec, step, error) {
var ui = lastStepUiMap[spec.id];
addError(ui, step.line, error);
});
runner.on('StepError', function(spec, step, error) {
var ui = lastStepUiMap[spec.id];
addError(ui, step.line, error);
});
runner.on('StepEnd', function(spec, step) {
var stepUi = lastStepUiMap[spec.id];
spec = model.getSpec(spec.id);
step = spec.getLastStep();
stepUi.find('.timer-result').text(step.duration + 'ms');
stepUi.removeClass('status-pending');
stepUi.addClass('status-' + step.status);
var scrollpane = specUiMap[spec.id].find('> .scrollpane');
scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight'));
});
/**
* Finds the context of a spec block defined by the passed definition.
*
* @param {Object} The definition created by the Describe object.
*/
function findContext(spec) {
var currentContext = context.find('#specs');
angular.forEach(model.getDefinitionPath(spec), function(defn) {
var id = 'describe-' + defn.id;
if (!context.find('#' + id).length) {
currentContext.find('> .test-children').append(
'<div class="test-describe" id="' + id + '">' +
' <h2></h2>' +
' <div class="test-children"></div>' +
' <ul class="tests"></ul>' +
'</div>'
);
context.find('#' + id).find('> h2').text('describe: ' + defn.name);
}
currentContext = context.find('#' + id);
});
return context.find('#describe-' + spec.definition.id);
}
/**
* Updates the test counter for the status.
*
* @param {string} the status.
*/
function updateTotals(status) {
var legend = context.find('#status-legend .status-' + status);
var parts = legend.text().split(' ');
var value = (parts[0] * 1) + 1;
legend.text(value + ' ' + parts[1]);
}
/**
* Add an error to a step.
*
* @param {Object} The JQuery wrapped context
* @param {function()} fn() that should return the file/line number of the error
* @param {Object} the error.
*/
function addError(context, line, error) {
context.find('.test-title').append('<pre></pre>');
var message = _jQuery.trim(line() + '\n\n' + formatException(error));
context.find('.test-title pre:last').text(message);
}
});
/**
* Generates JSON output into a context.
*/
angular.scenario.output('json', function(context, runner, model) {
model.on('RunnerEnd', function() {
context.text(angular.toJson(model.value));
});
});
/**
* Generates XML output into a context.
*/
angular.scenario.output('xml', function(context, runner, model) {
var $ = function(args) {return new context.init(args);};
model.on('RunnerEnd', function() {
var scenario = $('<scenario></scenario>');
context.append(scenario);
serializeXml(scenario, model.value);
});
/**
* Convert the tree into XML.
*
* @param {Object} context jQuery context to add the XML to.
* @param {Object} tree node to serialize
*/
function serializeXml(context, tree) {
angular.forEach(tree.children, function(child) {
var describeContext = $('<describe></describe>');
describeContext.attr('id', child.id);
describeContext.attr('name', child.name);
context.append(describeContext);
serializeXml(describeContext, child);
});
var its = $('<its></its>');
context.append(its);
angular.forEach(tree.specs, function(spec) {
var it = $('<it></it>');
it.attr('id', spec.id);
it.attr('name', spec.name);
it.attr('duration', spec.duration);
it.attr('status', spec.status);
its.append(it);
angular.forEach(spec.steps, function(step) {
var stepContext = $('<step></step>');
stepContext.attr('name', step.name);
stepContext.attr('duration', step.duration);
stepContext.attr('status', step.status);
it.append(stepContext);
if (step.error) {
var error = $('<error></error>');
stepContext.append(error);
error.text(formatException(stepContext.error));
}
});
});
}
});
/**
* Creates a global value $result with the result of the runner.
*/
angular.scenario.output('object', function(context, runner, model) {
runner.$window.$result = model.value;
});
bindJQuery();
publishExternalAPI(angular);
var $runner = new angular.scenario.Runner(window),
scripts = document.getElementsByTagName('script'),
script = scripts[scripts.length - 1],
config = {};
angular.forEach(script.attributes, function(attr) {
var match = attr.name.match(/ng[:\-](.*)/);
if (match) {
config[match[1]] = attr.value || true;
}
});
if (config.autotest) {
JQLite(document).ready(function() {
angular.scenario.setUpAndRun(config);
});
}
})(window, document);
angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],\n.ng-cloak, .x-ng-cloak {\n display: none;\n}\n\nng\\:form {\n display: block;\n}\n</style>');
angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";\n/* CSS Document */\n\n/** Structure */\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n font-size: 14px;\n}\n\n#system-error {\n font-size: 1.5em;\n text-align: center;\n}\n\n#json, #xml {\n display: none;\n}\n\n#header {\n position: fixed;\n width: 100%;\n}\n\n#specs {\n padding-top: 50px;\n}\n\n#header .angular {\n font-family: Courier New, monospace;\n font-weight: bold;\n}\n\n#header h1 {\n font-weight: normal;\n float: left;\n font-size: 30px;\n line-height: 30px;\n margin: 0;\n padding: 10px 10px;\n height: 30px;\n}\n\n#application h2,\n#specs h2 {\n margin: 0;\n padding: 0.5em;\n font-size: 1.1em;\n}\n\n#status-legend {\n margin-top: 10px;\n margin-right: 10px;\n}\n\n#header,\n#application,\n.test-info,\n.test-actions li {\n overflow: hidden;\n}\n\n#application {\n margin: 10px;\n}\n\n#application iframe {\n width: 100%;\n height: 758px;\n}\n\n#application .popout {\n float: right;\n}\n\n#application iframe {\n border: none;\n}\n\n.tests li,\n.test-actions li,\n.test-it li,\n.test-it ol,\n.status-display {\n list-style-type: none;\n}\n\n.tests,\n.test-it ol,\n.status-display {\n margin: 0;\n padding: 0;\n}\n\n.test-info {\n margin-left: 1em;\n margin-top: 0.5em;\n border-radius: 8px 0 0 8px;\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n cursor: pointer;\n}\n\n.test-info:hover .test-name {\n text-decoration: underline;\n}\n\n.test-info .closed:before {\n content: \'\\25b8\\00A0\';\n}\n\n.test-info .open:before {\n content: \'\\25be\\00A0\';\n font-weight: bold;\n}\n\n.test-it ol {\n margin-left: 2.5em;\n}\n\n.status-display,\n.status-display li {\n float: right;\n}\n\n.status-display li {\n padding: 5px 10px;\n}\n\n.timer-result,\n.test-title {\n display: inline-block;\n margin: 0;\n padding: 4px;\n}\n\n.test-actions .test-title,\n.test-actions .test-result {\n display: table-cell;\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n\n.test-actions {\n display: table;\n}\n\n.test-actions li {\n display: table-row;\n}\n\n.timer-result {\n width: 4em;\n padding: 0 10px;\n text-align: right;\n font-family: monospace;\n}\n\n.test-it pre,\n.test-actions pre {\n clear: left;\n color: black;\n margin-left: 6em;\n}\n\n.test-describe {\n padding-bottom: 0.5em;\n}\n\n.test-describe .test-describe {\n margin: 5px 5px 10px 2em;\n}\n\n.test-actions .status-pending .test-title:before {\n content: \'\\00bb\\00A0\';\n}\n\n.scrollpane {\n max-height: 20em;\n overflow: auto;\n}\n\n/** Colors */\n\n#header {\n background-color: #F2C200;\n}\n\n#specs h2 {\n border-top: 2px solid #BABAD1;\n}\n\n#specs h2,\n#application h2 {\n background-color: #efefef;\n}\n\n#application {\n border: 1px solid #BABAD1;\n}\n\n.test-describe .test-describe {\n border-left: 1px solid #BABAD1;\n border-right: 1px solid #BABAD1;\n border-bottom: 1px solid #BABAD1;\n}\n\n.status-display {\n border: 1px solid #777;\n}\n\n.status-display .status-pending,\n.status-pending .test-info {\n background-color: #F9EEBC;\n}\n\n.status-display .status-success,\n.status-success .test-info {\n background-color: #B1D7A1;\n}\n\n.status-display .status-failure,\n.status-failure .test-info {\n background-color: #FF8286;\n}\n\n.status-display .status-error,\n.status-error .test-info {\n background-color: black;\n color: white;\n}\n\n.test-actions .status-success .test-title {\n color: #30B30A;\n}\n\n.test-actions .status-failure .test-title {\n color: #DF0000;\n}\n\n.test-actions .status-error .test-title {\n color: black;\n}\n\n.test-actions .timer-result {\n color: #888;\n}\n</style>'); |
packages/material-ui-icons/src/OutlinedFlagTwoTone.js | allanalexandre/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M14 6l-1-2H5v17h2v-7h5l1 2h7V6h-6zm4 8h-4l-1-2H7V6h5l1 2h5v6z" /></React.Fragment>
, 'OutlinedFlagTwoTone');
|
packages/icons/src/md/action/List.js | suitejs/suitejs | import React from 'react';
import IconBase from '@suitejs/icon-base';
function MdList(props) {
return (
<IconBase viewBox="0 0 48 48" {...props}>
<path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z" />
</IconBase>
);
}
export default MdList;
|
node_modules/react-router/umd/ReactRouter.js | ddigioia/react_router_practice_1 | (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["ReactRouter"] = factory(require("react"));
else
root["ReactRouter"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
return /******/ (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] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = 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;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.createMemoryHistory = exports.hashHistory = exports.browserHistory = exports.applyRouterMiddleware = exports.formatPattern = exports.useRouterHistory = exports.match = exports.routerShape = exports.locationShape = exports.PropTypes = exports.RoutingContext = exports.RouterContext = exports.createRoutes = exports.useRoutes = exports.RouteContext = exports.Lifecycle = exports.History = exports.Route = exports.Redirect = exports.IndexRoute = exports.IndexRedirect = exports.withRouter = exports.IndexLink = exports.Link = exports.Router = undefined;
var _RouteUtils = __webpack_require__(5);
Object.defineProperty(exports, 'createRoutes', {
enumerable: true,
get: function get() {
return _RouteUtils.createRoutes;
}
});
var _PropTypes2 = __webpack_require__(15);
Object.defineProperty(exports, 'locationShape', {
enumerable: true,
get: function get() {
return _PropTypes2.locationShape;
}
});
Object.defineProperty(exports, 'routerShape', {
enumerable: true,
get: function get() {
return _PropTypes2.routerShape;
}
});
var _PatternUtils = __webpack_require__(8);
Object.defineProperty(exports, 'formatPattern', {
enumerable: true,
get: function get() {
return _PatternUtils.formatPattern;
}
});
var _Router2 = __webpack_require__(39);
var _Router3 = _interopRequireDefault(_Router2);
var _Link2 = __webpack_require__(20);
var _Link3 = _interopRequireDefault(_Link2);
var _IndexLink2 = __webpack_require__(33);
var _IndexLink3 = _interopRequireDefault(_IndexLink2);
var _withRouter2 = __webpack_require__(52);
var _withRouter3 = _interopRequireDefault(_withRouter2);
var _IndexRedirect2 = __webpack_require__(34);
var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2);
var _IndexRoute2 = __webpack_require__(35);
var _IndexRoute3 = _interopRequireDefault(_IndexRoute2);
var _Redirect2 = __webpack_require__(21);
var _Redirect3 = _interopRequireDefault(_Redirect2);
var _Route2 = __webpack_require__(37);
var _Route3 = _interopRequireDefault(_Route2);
var _History2 = __webpack_require__(32);
var _History3 = _interopRequireDefault(_History2);
var _Lifecycle2 = __webpack_require__(36);
var _Lifecycle3 = _interopRequireDefault(_Lifecycle2);
var _RouteContext2 = __webpack_require__(38);
var _RouteContext3 = _interopRequireDefault(_RouteContext2);
var _useRoutes2 = __webpack_require__(51);
var _useRoutes3 = _interopRequireDefault(_useRoutes2);
var _RouterContext2 = __webpack_require__(10);
var _RouterContext3 = _interopRequireDefault(_RouterContext2);
var _RoutingContext2 = __webpack_require__(40);
var _RoutingContext3 = _interopRequireDefault(_RoutingContext2);
var _PropTypes3 = _interopRequireDefault(_PropTypes2);
var _match2 = __webpack_require__(49);
var _match3 = _interopRequireDefault(_match2);
var _useRouterHistory2 = __webpack_require__(26);
var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2);
var _applyRouterMiddleware2 = __webpack_require__(42);
var _applyRouterMiddleware3 = _interopRequireDefault(_applyRouterMiddleware2);
var _browserHistory2 = __webpack_require__(43);
var _browserHistory3 = _interopRequireDefault(_browserHistory2);
var _hashHistory2 = __webpack_require__(47);
var _hashHistory3 = _interopRequireDefault(_hashHistory2);
var _createMemoryHistory2 = __webpack_require__(23);
var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.Router = _Router3.default; /* components */
exports.Link = _Link3.default;
exports.IndexLink = _IndexLink3.default;
exports.withRouter = _withRouter3.default;
/* components (configuration) */
exports.IndexRedirect = _IndexRedirect3.default;
exports.IndexRoute = _IndexRoute3.default;
exports.Redirect = _Redirect3.default;
exports.Route = _Route3.default;
/* mixins */
exports.History = _History3.default;
exports.Lifecycle = _Lifecycle3.default;
exports.RouteContext = _RouteContext3.default;
/* utils */
exports.useRoutes = _useRoutes3.default;
exports.RouterContext = _RouterContext3.default;
exports.RoutingContext = _RoutingContext3.default;
exports.PropTypes = _PropTypes3.default;
exports.match = _match3.default;
exports.useRouterHistory = _useRouterHistory3.default;
exports.applyRouterMiddleware = _applyRouterMiddleware3.default;
/* histories */
exports.browserHistory = _browserHistory3.default;
exports.hashHistory = _hashHistory3.default;
exports.createMemoryHistory = _createMemoryHistory3.default;
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.default = routerWarning;
exports._resetWarned = _resetWarned;
var _warning = __webpack_require__(63);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var warned = {};
function routerWarning(falseToWarn, message) {
// Only issue deprecation warnings once.
if (message.indexOf('deprecated') !== -1) {
if (warned[message]) {
return;
}
warned[message] = true;
}
message = '[react-router] ' + message;
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
_warning2.default.apply(undefined, [falseToWarn, message].concat(args));
}
function _resetWarned() {
warned = {};
}
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-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.
*/
'use strict';
/**
* 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 invariant = function(condition, format, a, b, c, d, e, f) {
if (true) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
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;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
/**
* 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.
*/
'use strict';
/**
* 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 = function() {};
if (true) {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// 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) {}
}
};
}
module.exports = warning;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.isReactChildren = isReactChildren;
exports.createRouteFromReactElement = createRouteFromReactElement;
exports.createRoutesFromReactChildren = createRoutesFromReactChildren;
exports.createRoutes = createRoutes;
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isValidChild(object) {
return object == null || _react2.default.isValidElement(object);
}
function isReactChildren(object) {
return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
}
function createRoute(defaultProps, props) {
return _extends({}, defaultProps, props);
}
function createRouteFromReactElement(element) {
var type = element.type;
var route = createRoute(type.defaultProps, element.props);
if (route.children) {
var childRoutes = createRoutesFromReactChildren(route.children, route);
if (childRoutes.length) route.childRoutes = childRoutes;
delete route.children;
}
return route;
}
/**
* Creates and returns a routes object from the given ReactChildren. JSX
* provides a convenient way to visualize how routes in the hierarchy are
* nested.
*
* import { Route, createRoutesFromReactChildren } from 'react-router'
*
* const routes = createRoutesFromReactChildren(
* <Route component={App}>
* <Route path="home" component={Dashboard}/>
* <Route path="news" component={NewsFeed}/>
* </Route>
* )
*
* Note: This method is automatically used when you provide <Route> children
* to a <Router> component.
*/
function createRoutesFromReactChildren(children, parentRoute) {
var routes = [];
_react2.default.Children.forEach(children, function (element) {
if (_react2.default.isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
var route = element.type.createRouteFromReactElement(element, parentRoute);
if (route) routes.push(route);
} else {
routes.push(createRouteFromReactElement(element));
}
}
});
return routes;
}
/**
* Creates and returns an array of routes from the given object which
* may be a JSX route, a plain object route, or an array of either.
*/
function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes);
} else if (routes && !Array.isArray(routes)) {
routes = [routes];
}
return routes;
}
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.routes = exports.route = exports.components = exports.component = exports.history = undefined;
exports.falsy = falsy;
var _react = __webpack_require__(2);
var func = _react.PropTypes.func;
var object = _react.PropTypes.object;
var arrayOf = _react.PropTypes.arrayOf;
var oneOfType = _react.PropTypes.oneOfType;
var element = _react.PropTypes.element;
var shape = _react.PropTypes.shape;
var string = _react.PropTypes.string;
function falsy(props, propName, componentName) {
if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
}
var history = exports.history = shape({
listen: func.isRequired,
push: func.isRequired,
replace: func.isRequired,
go: func.isRequired,
goBack: func.isRequired,
goForward: func.isRequired
});
var component = exports.component = oneOfType([func, string]);
var components = exports.components = oneOfType([component, object]);
var route = exports.route = oneOfType([object, element]);
var routes = exports.routes = oneOfType([route, arrayOf(route)]);
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.extractPath = extractPath;
exports.parsePath = parsePath;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
function extractPath(string) {
var match = string.match(/^https?:\/\/[^\/]*/);
if (match == null) return string;
return string.substring(match[0].length);
}
function parsePath(path) {
var pathname = extractPath(path);
var search = '';
var hash = '';
true ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined;
var hashIndex = pathname.indexOf('#');
if (hashIndex !== -1) {
hash = pathname.substring(hashIndex);
pathname = pathname.substring(0, hashIndex);
}
var searchIndex = pathname.indexOf('?');
if (searchIndex !== -1) {
search = pathname.substring(searchIndex);
pathname = pathname.substring(0, searchIndex);
}
if (pathname === '') pathname = '/';
return {
pathname: pathname,
search: search,
hash: hash
};
}
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.compilePattern = compilePattern;
exports.matchPattern = matchPattern;
exports.getParamNames = getParamNames;
exports.getParams = getParams;
exports.formatPattern = formatPattern;
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
function _compilePattern(pattern) {
var regexpSource = '';
var paramNames = [];
var tokens = [];
var match = void 0,
lastIndex = 0,
matcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;
while (match = matcher.exec(pattern)) {
if (match.index !== lastIndex) {
tokens.push(pattern.slice(lastIndex, match.index));
regexpSource += escapeRegExp(pattern.slice(lastIndex, match.index));
}
if (match[1]) {
regexpSource += '([^/]+)';
paramNames.push(match[1]);
} else if (match[0] === '**') {
regexpSource += '(.*)';
paramNames.push('splat');
} else if (match[0] === '*') {
regexpSource += '(.*?)';
paramNames.push('splat');
} else if (match[0] === '(') {
regexpSource += '(?:';
} else if (match[0] === ')') {
regexpSource += ')?';
}
tokens.push(match[0]);
lastIndex = matcher.lastIndex;
}
if (lastIndex !== pattern.length) {
tokens.push(pattern.slice(lastIndex, pattern.length));
regexpSource += escapeRegExp(pattern.slice(lastIndex, pattern.length));
}
return {
pattern: pattern,
regexpSource: regexpSource,
paramNames: paramNames,
tokens: tokens
};
}
var CompiledPatternsCache = Object.create(null);
function compilePattern(pattern) {
if (!CompiledPatternsCache[pattern]) CompiledPatternsCache[pattern] = _compilePattern(pattern);
return CompiledPatternsCache[pattern];
}
/**
* Attempts to match a pattern on the given pathname. Patterns may use
* the following special characters:
*
* - :paramName Matches a URL segment up to the next /, ?, or #. The
* captured string is considered a "param"
* - () Wraps a segment of the URL that is optional
* - * Consumes (non-greedy) all characters up to the next
* character in the pattern, or to the end of the URL if
* there is none
* - ** Consumes (greedy) all characters up to the next character
* in the pattern, or to the end of the URL if there is none
*
* The function calls callback(error, matched) when finished.
* The return value is an object with the following properties:
*
* - remainingPathname
* - paramNames
* - paramValues
*/
function matchPattern(pattern, pathname) {
// Ensure pattern starts with leading slash for consistency with pathname.
if (pattern.charAt(0) !== '/') {
pattern = '/' + pattern;
}
var _compilePattern2 = compilePattern(pattern);
var regexpSource = _compilePattern2.regexpSource;
var paramNames = _compilePattern2.paramNames;
var tokens = _compilePattern2.tokens;
if (pattern.charAt(pattern.length - 1) !== '/') {
regexpSource += '/?'; // Allow optional path separator at end.
}
// Special-case patterns like '*' for catch-all routes.
if (tokens[tokens.length - 1] === '*') {
regexpSource += '$';
}
var match = pathname.match(new RegExp('^' + regexpSource, 'i'));
if (match == null) {
return null;
}
var matchedPath = match[0];
var remainingPathname = pathname.substr(matchedPath.length);
if (remainingPathname) {
// Require that the match ends at a path separator, if we didn't match
// the full path, so any remaining pathname is a new path segment.
if (matchedPath.charAt(matchedPath.length - 1) !== '/') {
return null;
}
// If there is a remaining pathname, treat the path separator as part of
// the remaining pathname for properly continuing the match.
remainingPathname = '/' + remainingPathname;
}
return {
remainingPathname: remainingPathname,
paramNames: paramNames,
paramValues: match.slice(1).map(function (v) {
return v && decodeURIComponent(v);
})
};
}
function getParamNames(pattern) {
return compilePattern(pattern).paramNames;
}
function getParams(pattern, pathname) {
var match = matchPattern(pattern, pathname);
if (!match) {
return null;
}
var paramNames = match.paramNames;
var paramValues = match.paramValues;
var params = {};
paramNames.forEach(function (paramName, index) {
params[paramName] = paramValues[index];
});
return params;
}
/**
* Returns a version of the given pattern with params interpolated. Throws
* if there is a dynamic segment of the pattern for which there is no param.
*/
function formatPattern(pattern, params) {
params = params || {};
var _compilePattern3 = compilePattern(pattern);
var tokens = _compilePattern3.tokens;
var parenCount = 0,
pathname = '',
splatIndex = 0;
var token = void 0,
paramName = void 0,
paramValue = void 0;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
if (token === '*' || token === '**') {
paramValue = Array.isArray(params.splat) ? params.splat[splatIndex++] : params.splat;
!(paramValue != null || parenCount > 0) ? true ? (0, _invariant2.default)(false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : (0, _invariant2.default)(false) : void 0;
if (paramValue != null) pathname += encodeURI(paramValue);
} else if (token === '(') {
parenCount += 1;
} else if (token === ')') {
parenCount -= 1;
} else if (token.charAt(0) === ':') {
paramName = token.substring(1);
paramValue = params[paramName];
!(paramValue != null || parenCount > 0) ? true ? (0, _invariant2.default)(false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : (0, _invariant2.default)(false) : void 0;
if (paramValue != null) pathname += encodeURIComponent(paramValue);
} else {
pathname += token;
}
}
return pathname.replace(/\/+/g, '/');
}
/***/ },
/* 9 */
/***/ function(module, exports) {
/**
* Indicates that navigation was caused by a call to history.push.
*/
'use strict';
exports.__esModule = true;
var PUSH = 'PUSH';
exports.PUSH = PUSH;
/**
* Indicates that navigation was caused by a call to history.replace.
*/
var REPLACE = 'REPLACE';
exports.REPLACE = REPLACE;
/**
* Indicates that navigation was caused by some other action such
* as using a browser's back/forward buttons and/or manually manipulating
* the URL in a browser's location bar. This is the default.
*
* See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
* for more information.
*/
var POP = 'POP';
exports.POP = POP;
exports['default'] = {
PUSH: PUSH,
REPLACE: REPLACE,
POP: POP
};
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _deprecateObjectProperties = __webpack_require__(11);
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
var _getRouteParams = __webpack_require__(46);
var _getRouteParams2 = _interopRequireDefault(_getRouteParams);
var _RouteUtils = __webpack_require__(5);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _React$PropTypes = _react2.default.PropTypes;
var array = _React$PropTypes.array;
var func = _React$PropTypes.func;
var object = _React$PropTypes.object;
/**
* A <RouterContext> renders the component tree for a given router state
* and sets the history object and the current location in context.
*/
var RouterContext = _react2.default.createClass({
displayName: 'RouterContext',
propTypes: {
history: object,
router: object.isRequired,
location: object.isRequired,
routes: array.isRequired,
params: object.isRequired,
components: array.isRequired,
createElement: func.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
createElement: _react2.default.createElement
};
},
childContextTypes: {
history: object,
location: object.isRequired,
router: object.isRequired
},
getChildContext: function getChildContext() {
var _props = this.props;
var router = _props.router;
var history = _props.history;
var location = _props.location;
if (!router) {
true ? (0, _routerWarning2.default)(false, '`<RouterContext>` expects a `router` rather than a `history`') : void 0;
router = _extends({}, history, {
setRouteLeaveHook: history.listenBeforeLeavingRoute
});
delete router.listenBeforeLeavingRoute;
}
if (true) {
location = (0, _deprecateObjectProperties2.default)(location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation');
}
return { history: history, location: location, router: router };
},
createElement: function createElement(component, props) {
return component == null ? null : this.props.createElement(component, props);
},
render: function render() {
var _this = this;
var _props2 = this.props;
var history = _props2.history;
var location = _props2.location;
var routes = _props2.routes;
var params = _props2.params;
var components = _props2.components;
var element = null;
if (components) {
element = components.reduceRight(function (element, components, index) {
if (components == null) return element; // Don't create new children; use the grandchildren.
var route = routes[index];
var routeParams = (0, _getRouteParams2.default)(route, params);
var props = {
history: history,
location: location,
params: params,
route: route,
routeParams: routeParams,
routes: routes
};
if ((0, _RouteUtils.isReactChildren)(element)) {
props.children = element;
} else if (element) {
for (var prop in element) {
if (Object.prototype.hasOwnProperty.call(element, prop)) props[prop] = element[prop];
}
}
if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object') {
var elements = {};
for (var key in components) {
if (Object.prototype.hasOwnProperty.call(components, key)) {
// Pass through the key as a prop to createElement to allow
// custom createElement functions to know which named component
// they're rendering, for e.g. matching up to fetched data.
elements[key] = _this.createElement(components[key], _extends({
key: key }, props));
}
}
return elements;
}
return _this.createElement(components, props);
}, element);
}
!(element === null || element === false || _react2.default.isValidElement(element)) ? true ? (0, _invariant2.default)(false, 'The root route must render a single element') : (0, _invariant2.default)(false) : void 0;
return element;
}
});
exports.default = RouterContext;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.canUseMembrane = undefined;
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var canUseMembrane = exports.canUseMembrane = false;
// No-op by default.
var deprecateObjectProperties = function deprecateObjectProperties(object) {
return object;
};
if (true) {
try {
if (Object.defineProperty({}, 'x', {
get: function get() {
return true;
}
}).x) {
exports.canUseMembrane = canUseMembrane = true;
}
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
if (canUseMembrane) {
deprecateObjectProperties = function deprecateObjectProperties(object, message) {
// Wrap the deprecated object in a membrane to warn on property access.
var membrane = {};
var _loop = function _loop(prop) {
if (!Object.prototype.hasOwnProperty.call(object, prop)) {
return 'continue';
}
if (typeof object[prop] === 'function') {
// Can't use fat arrow here because of use of arguments below.
membrane[prop] = function () {
true ? (0, _routerWarning2.default)(false, message) : void 0;
return object[prop].apply(object, arguments);
};
return 'continue';
}
// These properties are non-enumerable to prevent React dev tools from
// seeing them and causing spurious warnings when accessing them. In
// principle this could be done with a proxy, but support for the
// ownKeys trap on proxies is not universal, even among browsers that
// otherwise support proxies.
Object.defineProperty(membrane, prop, {
get: function get() {
true ? (0, _routerWarning2.default)(false, message) : void 0;
return object[prop];
}
});
};
for (var prop in object) {
var _ret = _loop(prop);
if (_ret === 'continue') continue;
}
return membrane;
};
}
}
exports.default = deprecateObjectProperties;
/***/ },
/* 12 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
exports.canUseDOM = canUseDOM;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var _queryString = __webpack_require__(61);
var _runTransitionHook = __webpack_require__(19);
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
var _PathUtils = __webpack_require__(7);
var _deprecate = __webpack_require__(18);
var _deprecate2 = _interopRequireDefault(_deprecate);
var SEARCH_BASE_KEY = '$searchBase';
function defaultStringifyQuery(query) {
return _queryString.stringify(query).replace(/%20/g, '+');
}
var defaultParseQueryString = _queryString.parse;
function isNestedObject(object) {
for (var p in object) {
if (Object.prototype.hasOwnProperty.call(object, p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
}return false;
}
/**
* Returns a new createHistory function that may be used to create
* history objects that know how to handle URL queries.
*/
function useQueries(createHistory) {
return function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var history = createHistory(options);
var stringifyQuery = options.stringifyQuery;
var parseQueryString = options.parseQueryString;
if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
function addQuery(location) {
if (location.query == null) {
var search = location.search;
location.query = parseQueryString(search.substring(1));
location[SEARCH_BASE_KEY] = { search: search, searchBase: '' };
}
// TODO: Instead of all the book-keeping here, this should just strip the
// stringified query from the search.
return location;
}
function appendQuery(location, query) {
var _extends2;
var searchBaseSpec = location[SEARCH_BASE_KEY];
var queryString = query ? stringifyQuery(query) : '';
if (!searchBaseSpec && !queryString) {
return location;
}
true ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined;
if (typeof location === 'string') location = _PathUtils.parsePath(location);
var searchBase = undefined;
if (searchBaseSpec && location.search === searchBaseSpec.search) {
searchBase = searchBaseSpec.searchBase;
} else {
searchBase = location.search || '';
}
var search = searchBase;
if (queryString) {
search += (search ? '&' : '?') + queryString;
}
return _extends({}, location, (_extends2 = {
search: search
}, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2));
}
// Override all read methods with query-aware versions.
function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addQuery(location), callback);
});
}
function listen(listener) {
return history.listen(function (location) {
listener(addQuery(location));
});
}
// Override all write methods with query-aware versions.
function push(location) {
history.push(appendQuery(location, location.query));
}
function replace(location) {
history.replace(appendQuery(location, location.query));
}
function createPath(location, query) {
true ? _warning2['default'](!query, 'the query argument to createPath is deprecated; use a location descriptor instead') : undefined;
return history.createPath(appendQuery(location, query || location.query));
}
function createHref(location, query) {
true ? _warning2['default'](!query, 'the query argument to createHref is deprecated; use a location descriptor instead') : undefined;
return history.createHref(appendQuery(location, query || location.query));
}
function createLocation(location) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var fullLocation = history.createLocation.apply(history, [appendQuery(location, location.query)].concat(args));
if (location.query) {
fullLocation.query = location.query;
}
return addQuery(fullLocation);
}
// deprecated
function pushState(state, path, query) {
if (typeof path === 'string') path = _PathUtils.parsePath(path);
push(_extends({ state: state }, path, { query: query }));
}
// deprecated
function replaceState(state, path, query) {
if (typeof path === 'string') path = _PathUtils.parsePath(path);
replace(_extends({ state: state }, path, { query: query }));
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
push: push,
replace: replace,
createPath: createPath,
createHref: createHref,
createLocation: createLocation,
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
});
};
}
exports['default'] = useQueries;
module.exports = exports['default'];
/***/ },
/* 14 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports.loopAsync = loopAsync;
exports.mapAsync = mapAsync;
function loopAsync(turns, work, callback) {
var currentTurn = 0,
isDone = false;
var sync = false,
hasNext = false,
doneArgs = void 0;
function done() {
isDone = true;
if (sync) {
// Iterate instead of recursing if possible.
doneArgs = [].concat(Array.prototype.slice.call(arguments));
return;
}
callback.apply(this, arguments);
}
function next() {
if (isDone) {
return;
}
hasNext = true;
if (sync) {
// Iterate instead of recursing if possible.
return;
}
sync = true;
while (!isDone && currentTurn < turns && hasNext) {
hasNext = false;
work.call(this, currentTurn++, next, done);
}
sync = false;
if (isDone) {
// This means the loop finished synchronously.
callback.apply(this, doneArgs);
return;
}
if (currentTurn >= turns && hasNext) {
isDone = true;
callback();
}
}
next();
}
function mapAsync(array, work, callback) {
var length = array.length;
var values = [];
if (length === 0) return callback(null, values);
var isDone = false,
doneCount = 0;
function done(index, error, value) {
if (isDone) return;
if (error) {
isDone = true;
callback(error);
} else {
values[index] = value;
isDone = ++doneCount === length;
if (isDone) callback(null, values);
}
}
array.forEach(function (item, index) {
work(item, index, function (error, value) {
done(index, error, value);
});
});
}
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.router = exports.routes = exports.route = exports.components = exports.component = exports.location = exports.history = exports.falsy = exports.locationShape = exports.routerShape = undefined;
var _react = __webpack_require__(2);
var _deprecateObjectProperties = __webpack_require__(11);
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
var _InternalPropTypes = __webpack_require__(6);
var InternalPropTypes = _interopRequireWildcard(_InternalPropTypes);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var func = _react.PropTypes.func;
var object = _react.PropTypes.object;
var shape = _react.PropTypes.shape;
var string = _react.PropTypes.string;
var routerShape = exports.routerShape = shape({
push: func.isRequired,
replace: func.isRequired,
go: func.isRequired,
goBack: func.isRequired,
goForward: func.isRequired,
setRouteLeaveHook: func.isRequired,
isActive: func.isRequired
});
var locationShape = exports.locationShape = shape({
pathname: string.isRequired,
search: string.isRequired,
state: object,
action: string.isRequired,
key: string
});
// Deprecated stuff below:
var falsy = exports.falsy = InternalPropTypes.falsy;
var history = exports.history = InternalPropTypes.history;
var location = exports.location = locationShape;
var component = exports.component = InternalPropTypes.component;
var components = exports.components = InternalPropTypes.components;
var route = exports.route = InternalPropTypes.route;
var routes = exports.routes = InternalPropTypes.routes;
var router = exports.router = routerShape;
if (true) {
(function () {
var deprecatePropType = function deprecatePropType(propType, message) {
return function () {
true ? (0, _routerWarning2.default)(false, message) : void 0;
return propType.apply(undefined, arguments);
};
};
var deprecateInternalPropType = function deprecateInternalPropType(propType) {
return deprecatePropType(propType, 'This prop type is not intended for external use, and was previously exported by mistake. These internal prop types are deprecated for external use, and will be removed in a later version.');
};
var deprecateRenamedPropType = function deprecateRenamedPropType(propType, name) {
return deprecatePropType(propType, 'The `' + name + '` prop type is now exported as `' + name + 'Shape` to avoid name conflicts. This export is deprecated and will be removed in a later version.');
};
exports.falsy = falsy = deprecateInternalPropType(falsy);
exports.history = history = deprecateInternalPropType(history);
exports.component = component = deprecateInternalPropType(component);
exports.components = components = deprecateInternalPropType(components);
exports.route = route = deprecateInternalPropType(route);
exports.routes = routes = deprecateInternalPropType(routes);
exports.location = location = deprecateRenamedPropType(location, 'location');
exports.router = router = deprecateRenamedPropType(router, 'router');
})();
}
var defaultExport = {
falsy: falsy,
history: history,
location: location,
component: component,
components: components,
route: route,
// For some reason, routes was never here.
router: router
};
if (true) {
defaultExport = (0, _deprecateObjectProperties2.default)(defaultExport, 'The default export from `react-router/lib/PropTypes` is deprecated. Please use the named exports instead.');
}
exports.default = defaultExport;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = createTransitionManager;
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _computeChangedRoutes2 = __webpack_require__(44);
var _computeChangedRoutes3 = _interopRequireDefault(_computeChangedRoutes2);
var _TransitionUtils = __webpack_require__(41);
var _isActive2 = __webpack_require__(48);
var _isActive3 = _interopRequireDefault(_isActive2);
var _getComponents = __webpack_require__(45);
var _getComponents2 = _interopRequireDefault(_getComponents);
var _matchRoutes = __webpack_require__(50);
var _matchRoutes2 = _interopRequireDefault(_matchRoutes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hasAnyProperties(object) {
for (var p in object) {
if (Object.prototype.hasOwnProperty.call(object, p)) return true;
}return false;
}
function createTransitionManager(history, routes) {
var state = {};
// Signature should be (location, indexOnly), but needs to support (path,
// query, indexOnly)
function isActive(location) {
var indexOnlyOrDeprecatedQuery = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var deprecatedIndexOnly = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var indexOnly = void 0;
if (indexOnlyOrDeprecatedQuery && indexOnlyOrDeprecatedQuery !== true || deprecatedIndexOnly !== null) {
true ? (0, _routerWarning2.default)(false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : void 0;
location = { pathname: location, query: indexOnlyOrDeprecatedQuery };
indexOnly = deprecatedIndexOnly || false;
} else {
location = history.createLocation(location);
indexOnly = indexOnlyOrDeprecatedQuery;
}
return (0, _isActive3.default)(location, indexOnly, state.location, state.routes, state.params);
}
var partialNextState = void 0;
function match(location, callback) {
if (partialNextState && partialNextState.location === location) {
// Continue from where we left off.
finishMatch(partialNextState, callback);
} else {
(0, _matchRoutes2.default)(routes, location, function (error, nextState) {
if (error) {
callback(error);
} else if (nextState) {
finishMatch(_extends({}, nextState, { location: location }), callback);
} else {
callback();
}
});
}
}
function finishMatch(nextState, callback) {
var _computeChangedRoutes = (0, _computeChangedRoutes3.default)(state, nextState);
var leaveRoutes = _computeChangedRoutes.leaveRoutes;
var changeRoutes = _computeChangedRoutes.changeRoutes;
var enterRoutes = _computeChangedRoutes.enterRoutes;
(0, _TransitionUtils.runLeaveHooks)(leaveRoutes, state);
// Tear down confirmation hooks for left routes
leaveRoutes.filter(function (route) {
return enterRoutes.indexOf(route) === -1;
}).forEach(removeListenBeforeHooksForRoute);
// change and enter hooks are run in series
(0, _TransitionUtils.runChangeHooks)(changeRoutes, state, nextState, function (error, redirectInfo) {
if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
(0, _TransitionUtils.runEnterHooks)(enterRoutes, nextState, finishEnterHooks);
});
function finishEnterHooks(error, redirectInfo) {
if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
// TODO: Fetch components after state is updated.
(0, _getComponents2.default)(nextState, function (error, components) {
if (error) {
callback(error);
} else {
// TODO: Make match a pure function and have some other API
// for "match and update state".
callback(null, null, state = _extends({}, nextState, { components: components }));
}
});
}
function handleErrorOrRedirect(error, redirectInfo) {
if (error) callback(error);else callback(null, redirectInfo);
}
}
var RouteGuid = 1;
function getRouteID(route) {
var create = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
return route.__id__ || create && (route.__id__ = RouteGuid++);
}
var RouteHooks = Object.create(null);
function getRouteHooksForRoutes(routes) {
return routes.reduce(function (hooks, route) {
hooks.push.apply(hooks, RouteHooks[getRouteID(route)]);
return hooks;
}, []);
}
function transitionHook(location, callback) {
(0, _matchRoutes2.default)(routes, location, function (error, nextState) {
if (nextState == null) {
// TODO: We didn't actually match anything, but hang
// onto error/nextState so we don't have to matchRoutes
// again in the listen callback.
callback();
return;
}
// Cache some state here so we don't have to
// matchRoutes() again in the listen callback.
partialNextState = _extends({}, nextState, { location: location });
var hooks = getRouteHooksForRoutes((0, _computeChangedRoutes3.default)(state, partialNextState).leaveRoutes);
var result = void 0;
for (var i = 0, len = hooks.length; result == null && i < len; ++i) {
// Passing the location arg here indicates to
// the user that this is a transition hook.
result = hooks[i](location);
}
callback(result);
});
}
/* istanbul ignore next: untestable with Karma */
function beforeUnloadHook() {
// Synchronously check to see if any route hooks want
// to prevent the current window/tab from closing.
if (state.routes) {
var hooks = getRouteHooksForRoutes(state.routes);
var message = void 0;
for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
// Passing no args indicates to the user that this is a
// beforeunload hook. We don't know the next location.
message = hooks[i]();
}
return message;
}
}
var unlistenBefore = void 0,
unlistenBeforeUnload = void 0;
function removeListenBeforeHooksForRoute(route) {
var routeID = getRouteID(route, false);
if (!routeID) {
return;
}
delete RouteHooks[routeID];
if (!hasAnyProperties(RouteHooks)) {
// teardown transition & beforeunload hooks
if (unlistenBefore) {
unlistenBefore();
unlistenBefore = null;
}
if (unlistenBeforeUnload) {
unlistenBeforeUnload();
unlistenBeforeUnload = null;
}
}
}
/**
* Registers the given hook function to run before leaving the given route.
*
* During a normal transition, the hook function receives the next location
* as its only argument and can return either a prompt message (string) to show the user,
* to make sure they want to leave the page; or `false`, to prevent the transition.
* Any other return value will have no effect.
*
* During the beforeunload event (in browsers) the hook receives no arguments.
* In this case it must return a prompt message to prevent the transition.
*
* Returns a function that may be used to unbind the listener.
*/
function listenBeforeLeavingRoute(route, hook) {
// TODO: Warn if they register for a route that isn't currently
// active. They're probably doing something wrong, like re-creating
// route objects on every location change.
var routeID = getRouteID(route);
var hooks = RouteHooks[routeID];
if (!hooks) {
var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks);
RouteHooks[routeID] = [hook];
if (thereWereNoRouteHooks) {
// setup transition & beforeunload hooks
unlistenBefore = history.listenBefore(transitionHook);
if (history.listenBeforeUnload) unlistenBeforeUnload = history.listenBeforeUnload(beforeUnloadHook);
}
} else {
if (hooks.indexOf(hook) === -1) {
true ? (0, _routerWarning2.default)(false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : void 0;
hooks.push(hook);
}
}
return function () {
var hooks = RouteHooks[routeID];
if (hooks) {
var newHooks = hooks.filter(function (item) {
return item !== hook;
});
if (newHooks.length === 0) {
removeListenBeforeHooksForRoute(route);
} else {
RouteHooks[routeID] = newHooks;
}
}
};
}
/**
* This is the API for stateful environments. As the location
* changes, we update state and call the listener. We can also
* gracefully handle errors and redirects.
*/
function listen(listener) {
// TODO: Only use a single history listener. Otherwise we'll
// end up with multiple concurrent calls to match.
return history.listen(function (location) {
if (state.location === location) {
listener(null, state);
} else {
match(location, function (error, redirectLocation, nextState) {
if (error) {
listener(error);
} else if (redirectLocation) {
history.replace(redirectLocation);
} else if (nextState) {
listener(null, nextState);
} else {
true ? (0, _routerWarning2.default)(false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : void 0;
}
});
}
});
}
return {
isActive: isActive,
match: match,
listenBeforeLeavingRoute: listenBeforeLeavingRoute,
listen: listen
};
}
//export default useRoutes
/***/ },
/* 17 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.addEventListener = addEventListener;
exports.removeEventListener = removeEventListener;
exports.getHashPath = getHashPath;
exports.replaceHashPath = replaceHashPath;
exports.getWindowPath = getWindowPath;
exports.go = go;
exports.getUserConfirmation = getUserConfirmation;
exports.supportsHistory = supportsHistory;
exports.supportsGoWithoutReloadUsingHash = supportsGoWithoutReloadUsingHash;
function addEventListener(node, event, listener) {
if (node.addEventListener) {
node.addEventListener(event, listener, false);
} else {
node.attachEvent('on' + event, listener);
}
}
function removeEventListener(node, event, listener) {
if (node.removeEventListener) {
node.removeEventListener(event, listener, false);
} else {
node.detachEvent('on' + event, listener);
}
}
function getHashPath() {
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
return window.location.href.split('#')[1] || '';
}
function replaceHashPath(path) {
window.location.replace(window.location.pathname + window.location.search + '#' + path);
}
function getWindowPath() {
return window.location.pathname + window.location.search + window.location.hash;
}
function go(n) {
if (n) window.history.go(n);
}
function getUserConfirmation(message, callback) {
callback(window.confirm(message));
}
/**
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
*
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
*/
function supportsHistory() {
var ua = navigator.userAgent;
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
return false;
}
return window.history && 'pushState' in window.history;
}
/**
* Returns false if using go(n) with hash history causes a full page reload.
*/
function supportsGoWithoutReloadUsingHash() {
var ua = navigator.userAgent;
return ua.indexOf('Firefox') === -1;
}
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
function deprecate(fn, message) {
return function () {
true ? _warning2['default'](false, '[history] ' + message) : undefined;
return fn.apply(this, arguments);
};
}
exports['default'] = deprecate;
module.exports = exports['default'];
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
function runTransitionHook(hook, location, callback) {
var result = hook(location, callback);
if (hook.length < 2) {
// Assume the hook runs synchronously and automatically
// call the callback with the return value.
callback(result);
} else {
true ? _warning2['default'](result === undefined, 'You should not "return" in a transition hook with a callback argument; call the callback instead') : undefined;
}
}
exports['default'] = runTransitionHook;
module.exports = exports['default'];
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _PropTypes = __webpack_require__(15);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _React$PropTypes = _react2.default.PropTypes;
var bool = _React$PropTypes.bool;
var object = _React$PropTypes.object;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
var oneOfType = _React$PropTypes.oneOfType;
function isLeftClickEvent(event) {
return event.button === 0;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
// TODO: De-duplicate against hasAnyProperties in createTransitionManager.
function isEmptyObject(object) {
for (var p in object) {
if (Object.prototype.hasOwnProperty.call(object, p)) return false;
}return true;
}
function createLocationDescriptor(to, _ref) {
var query = _ref.query;
var hash = _ref.hash;
var state = _ref.state;
if (query || hash || state) {
return { pathname: to, query: query, hash: hash, state: state };
}
return to;
}
/**
* A <Link> is used to create an <a> element that links to a route.
* When that route is active, the link gets the value of its
* activeClassName prop.
*
* For example, assuming you have the following route:
*
* <Route path="/posts/:postID" component={Post} />
*
* You could use the following component to link to that route:
*
* <Link to={`/posts/${post.id}`} />
*
* Links may pass along location state and/or query string parameters
* in the state/query props, respectively.
*
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
*/
var Link = _react2.default.createClass({
displayName: 'Link',
contextTypes: {
router: _PropTypes.routerShape
},
propTypes: {
to: oneOfType([string, object]),
query: object,
hash: string,
state: object,
activeStyle: object,
activeClassName: string,
onlyActiveOnIndex: bool.isRequired,
onClick: func,
target: string
},
getDefaultProps: function getDefaultProps() {
return {
onlyActiveOnIndex: false,
style: {}
};
},
handleClick: function handleClick(event) {
if (this.props.onClick) this.props.onClick(event);
if (event.defaultPrevented) return;
!this.context.router ? true ? (0, _invariant2.default)(false, '<Link>s rendered outside of a router context cannot navigate.') : (0, _invariant2.default)(false) : void 0;
if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
// If target prop is set (e.g. to "_blank"), let browser handle link.
/* istanbul ignore if: untestable with Karma */
if (this.props.target) return;
event.preventDefault();
var _props = this.props;
var to = _props.to;
var query = _props.query;
var hash = _props.hash;
var state = _props.state;
var location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
this.context.router.push(location);
},
render: function render() {
var _props2 = this.props;
var to = _props2.to;
var query = _props2.query;
var hash = _props2.hash;
var state = _props2.state;
var activeClassName = _props2.activeClassName;
var activeStyle = _props2.activeStyle;
var onlyActiveOnIndex = _props2.onlyActiveOnIndex;
var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
true ? (0, _routerWarning2.default)(!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : void 0;
// Ignore if rendered outside the context of router, simplifies unit testing.
var router = this.context.router;
if (router) {
// If user does not specify a `to` prop, return an empty anchor tag.
if (to == null) {
return _react2.default.createElement('a', props);
}
var location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
props.href = router.createHref(location);
if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
if (router.isActive(location, onlyActiveOnIndex)) {
if (activeClassName) {
if (props.className) {
props.className += ' ' + activeClassName;
} else {
props.className = activeClassName;
}
}
if (activeStyle) props.style = _extends({}, props.style, activeStyle);
}
}
}
return _react2.default.createElement('a', _extends({}, props, { onClick: this.handleClick }));
}
});
exports.default = Link;
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = __webpack_require__(5);
var _PatternUtils = __webpack_require__(8);
var _InternalPropTypes = __webpack_require__(6);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _React$PropTypes = _react2.default.PropTypes;
var string = _React$PropTypes.string;
var object = _React$PropTypes.object;
/**
* A <Redirect> is used to declare another URL path a client should
* be sent to when they request a given URL.
*
* Redirects are placed alongside routes in the route configuration
* and are traversed in the same manner.
*/
var Redirect = _react2.default.createClass({
displayName: 'Redirect',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element) {
var route = (0, _RouteUtils.createRouteFromReactElement)(element);
if (route.from) route.path = route.from;
route.onEnter = function (nextState, replace) {
var location = nextState.location;
var params = nextState.params;
var pathname = void 0;
if (route.to.charAt(0) === '/') {
pathname = (0, _PatternUtils.formatPattern)(route.to, params);
} else if (!route.to) {
pathname = location.pathname;
} else {
var routeIndex = nextState.routes.indexOf(route);
var parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1);
var pattern = parentPattern.replace(/\/*$/, '/') + route.to;
pathname = (0, _PatternUtils.formatPattern)(pattern, params);
}
replace({
pathname: pathname,
query: route.query || location.query,
state: route.state || location.state
});
};
return route;
},
getRoutePattern: function getRoutePattern(routes, routeIndex) {
var parentPattern = '';
for (var i = routeIndex; i >= 0; i--) {
var route = routes[i];
var pattern = route.path || '';
parentPattern = pattern.replace(/\/*$/, '/') + parentPattern;
if (pattern.indexOf('/') === 0) break;
}
return '/' + parentPattern;
}
},
propTypes: {
path: string,
from: string, // Alias for path
to: string.isRequired,
query: object,
state: object,
onEnter: _InternalPropTypes.falsy,
children: _InternalPropTypes.falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
true ? true ? (0, _invariant2.default)(false, '<Redirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
});
exports.default = Redirect;
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.createRouterObject = createRouterObject;
exports.createRoutingHistory = createRoutingHistory;
var _deprecateObjectProperties = __webpack_require__(11);
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createRouterObject(history, transitionManager) {
return _extends({}, history, {
setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute,
isActive: transitionManager.isActive
});
}
// deprecated
function createRoutingHistory(history, transitionManager) {
history = _extends({}, history, transitionManager);
if (true) {
history = (0, _deprecateObjectProperties2.default)(history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges');
}
return history;
}
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.default = createMemoryHistory;
var _useQueries = __webpack_require__(13);
var _useQueries2 = _interopRequireDefault(_useQueries);
var _useBasename = __webpack_require__(31);
var _useBasename2 = _interopRequireDefault(_useBasename);
var _createMemoryHistory = __webpack_require__(59);
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createMemoryHistory(options) {
// signatures and type checking differ between `useRoutes` and
// `createMemoryHistory`, have to create `memoryHistory` first because
// `useQueries` doesn't understand the signature
var memoryHistory = (0, _createMemoryHistory2.default)(options);
var createHistory = function createHistory() {
return memoryHistory;
};
var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
history.__v2_compatible__ = true;
return history;
}
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.default = function (createHistory) {
var history = void 0;
if (canUseDOM) history = (0, _useRouterHistory2.default)(createHistory)();
return history;
};
var _useRouterHistory = __webpack_require__(26);
var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = makeStateWithLocation;
var _deprecateObjectProperties = __webpack_require__(11);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function makeStateWithLocation(state, location) {
if (("development") !== 'production' && _deprecateObjectProperties.canUseMembrane) {
var stateWithLocation = _extends({}, state);
// I don't use deprecateObjectProperties here because I want to keep the
// same code path between development and production, in that we just
// assign extra properties to the copy of the state object in both cases.
var _loop = function _loop(prop) {
if (!Object.prototype.hasOwnProperty.call(location, prop)) {
return 'continue';
}
Object.defineProperty(stateWithLocation, prop, {
get: function get() {
true ? (0, _routerWarning2.default)(false, 'Accessing location properties directly from the first argument to `getComponent`, `getComponents`, `getChildRoutes`, and `getIndexRoute` is deprecated. That argument is now the router state (`nextState` or `partialNextState`) rather than the location. To access the location, use `nextState.location` or `partialNextState.location`.') : void 0;
return location[prop];
}
});
};
for (var prop in location) {
var _ret = _loop(prop);
if (_ret === 'continue') continue;
}
return stateWithLocation;
}
return _extends({}, state, location);
}
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.default = useRouterHistory;
var _useQueries = __webpack_require__(13);
var _useQueries2 = _interopRequireDefault(_useQueries);
var _useBasename = __webpack_require__(31);
var _useBasename2 = _interopRequireDefault(_useBasename);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function useRouterHistory(createHistory) {
return function (options) {
var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
history.__v2_compatible__ = true;
return history;
};
}
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
/*eslint-disable no-empty */
'use strict';
exports.__esModule = true;
exports.saveState = saveState;
exports.readState = readState;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var KeyPrefix = '@@History/';
var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR'];
var SecurityError = 'SecurityError';
function createKey(key) {
return KeyPrefix + key;
}
function saveState(key, state) {
try {
if (state == null) {
window.sessionStorage.removeItem(createKey(key));
} else {
window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
}
} catch (error) {
if (error.name === SecurityError) {
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
// attempt to access window.sessionStorage.
true ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined;
return;
}
if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) {
// Safari "private mode" throws QuotaExceededError.
true ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined;
return;
}
throw error;
}
}
function readState(key) {
var json = undefined;
try {
json = window.sessionStorage.getItem(createKey(key));
} catch (error) {
if (error.name === SecurityError) {
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
// attempt to access window.sessionStorage.
true ? _warning2['default'](false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined;
return null;
}
}
if (json) {
try {
return JSON.parse(json);
} catch (error) {
// Ignore invalid JSON.
}
}
return null;
}
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _ExecutionEnvironment = __webpack_require__(12);
var _DOMUtils = __webpack_require__(17);
var _createHistory = __webpack_require__(30);
var _createHistory2 = _interopRequireDefault(_createHistory);
function createDOMHistory(options) {
var history = _createHistory2['default'](_extends({
getUserConfirmation: _DOMUtils.getUserConfirmation
}, options, {
go: _DOMUtils.go
}));
function listen(listener) {
!_ExecutionEnvironment.canUseDOM ? true ? _invariant2['default'](false, 'DOM history needs a DOM') : _invariant2['default'](false) : undefined;
return history.listen(listener);
}
return _extends({}, history, {
listen: listen
});
}
exports['default'] = createDOMHistory;
module.exports = exports['default'];
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _Actions = __webpack_require__(9);
var _PathUtils = __webpack_require__(7);
var _ExecutionEnvironment = __webpack_require__(12);
var _DOMUtils = __webpack_require__(17);
var _DOMStateStorage = __webpack_require__(27);
var _createDOMHistory = __webpack_require__(28);
var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
function isAbsolutePath(path) {
return typeof path === 'string' && path.charAt(0) === '/';
}
function ensureSlash() {
var path = _DOMUtils.getHashPath();
if (isAbsolutePath(path)) return true;
_DOMUtils.replaceHashPath('/' + path);
return false;
}
function addQueryStringValueToPath(path, key, value) {
return path + (path.indexOf('?') === -1 ? '?' : '&') + (key + '=' + value);
}
function stripQueryStringValueFromPath(path, key) {
return path.replace(new RegExp('[?&]?' + key + '=[a-zA-Z0-9]+'), '');
}
function getQueryStringValueFromPath(path, key) {
var match = path.match(new RegExp('\\?.*?\\b' + key + '=(.+?)\\b'));
return match && match[1];
}
var DefaultQueryKey = '_k';
function createHashHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
!_ExecutionEnvironment.canUseDOM ? true ? _invariant2['default'](false, 'Hash history needs a DOM') : _invariant2['default'](false) : undefined;
var queryKey = options.queryKey;
if (queryKey === undefined || !!queryKey) queryKey = typeof queryKey === 'string' ? queryKey : DefaultQueryKey;
function getCurrentLocation() {
var path = _DOMUtils.getHashPath();
var key = undefined,
state = undefined;
if (queryKey) {
key = getQueryStringValueFromPath(path, queryKey);
path = stripQueryStringValueFromPath(path, queryKey);
if (key) {
state = _DOMStateStorage.readState(key);
} else {
state = null;
key = history.createKey();
_DOMUtils.replaceHashPath(addQueryStringValueToPath(path, queryKey, key));
}
} else {
key = state = null;
}
var location = _PathUtils.parsePath(path);
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
}
function startHashChangeListener(_ref) {
var transitionTo = _ref.transitionTo;
function hashChangeListener() {
if (!ensureSlash()) return; // Always make sure hashes are preceeded with a /.
transitionTo(getCurrentLocation());
}
ensureSlash();
_DOMUtils.addEventListener(window, 'hashchange', hashChangeListener);
return function () {
_DOMUtils.removeEventListener(window, 'hashchange', hashChangeListener);
};
}
function finishTransition(location) {
var basename = location.basename;
var pathname = location.pathname;
var search = location.search;
var state = location.state;
var action = location.action;
var key = location.key;
if (action === _Actions.POP) return; // Nothing to do.
var path = (basename || '') + pathname + search;
if (queryKey) {
path = addQueryStringValueToPath(path, queryKey, key);
_DOMStateStorage.saveState(key, state);
} else {
// Drop key and state.
location.key = location.state = null;
}
var currentHash = _DOMUtils.getHashPath();
if (action === _Actions.PUSH) {
if (currentHash !== path) {
window.location.hash = path;
} else {
true ? _warning2['default'](false, 'You cannot PUSH the same path using hash history') : undefined;
}
} else if (currentHash !== path) {
// REPLACE
_DOMUtils.replaceHashPath(path);
}
}
var history = _createDOMHistory2['default'](_extends({}, options, {
getCurrentLocation: getCurrentLocation,
finishTransition: finishTransition,
saveState: _DOMStateStorage.saveState
}));
var listenerCount = 0,
stopHashChangeListener = undefined;
function listenBefore(listener) {
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
var unlisten = history.listenBefore(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopHashChangeListener();
};
}
function listen(listener) {
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
var unlisten = history.listen(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopHashChangeListener();
};
}
function push(location) {
true ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.push(location);
}
function replace(location) {
true ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.replace(location);
}
var goIsSupportedWithoutReload = _DOMUtils.supportsGoWithoutReloadUsingHash();
function go(n) {
true ? _warning2['default'](goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined;
history.go(n);
}
function createHref(path) {
return '#' + history.createHref(path);
}
// deprecated
function registerTransitionHook(hook) {
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
history.registerTransitionHook(hook);
}
// deprecated
function unregisterTransitionHook(hook) {
history.unregisterTransitionHook(hook);
if (--listenerCount === 0) stopHashChangeListener();
}
// deprecated
function pushState(state, path) {
true ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.pushState(state, path);
}
// deprecated
function replaceState(state, path) {
true ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.replaceState(state, path);
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
push: push,
replace: replace,
go: go,
createHref: createHref,
registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory
unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory
pushState: pushState, // deprecated - warning is in createHistory
replaceState: replaceState // deprecated - warning is in createHistory
});
}
exports['default'] = createHashHistory;
module.exports = exports['default'];
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var _deepEqual = __webpack_require__(53);
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _PathUtils = __webpack_require__(7);
var _AsyncUtils = __webpack_require__(56);
var _Actions = __webpack_require__(9);
var _createLocation2 = __webpack_require__(58);
var _createLocation3 = _interopRequireDefault(_createLocation2);
var _runTransitionHook = __webpack_require__(19);
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
var _deprecate = __webpack_require__(18);
var _deprecate2 = _interopRequireDefault(_deprecate);
function createRandomKey(length) {
return Math.random().toString(36).substr(2, length);
}
function locationsAreEqual(a, b) {
return a.pathname === b.pathname && a.search === b.search &&
//a.action === b.action && // Different action !== location change.
a.key === b.key && _deepEqual2['default'](a.state, b.state);
}
var DefaultKeyLength = 6;
function createHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var getCurrentLocation = options.getCurrentLocation;
var finishTransition = options.finishTransition;
var saveState = options.saveState;
var go = options.go;
var getUserConfirmation = options.getUserConfirmation;
var keyLength = options.keyLength;
if (typeof keyLength !== 'number') keyLength = DefaultKeyLength;
var transitionHooks = [];
function listenBefore(hook) {
transitionHooks.push(hook);
return function () {
transitionHooks = transitionHooks.filter(function (item) {
return item !== hook;
});
};
}
var allKeys = [];
var changeListeners = [];
var location = undefined;
function getCurrent() {
if (pendingLocation && pendingLocation.action === _Actions.POP) {
return allKeys.indexOf(pendingLocation.key);
} else if (location) {
return allKeys.indexOf(location.key);
} else {
return -1;
}
}
function updateLocation(newLocation) {
var current = getCurrent();
location = newLocation;
if (location.action === _Actions.PUSH) {
allKeys = [].concat(allKeys.slice(0, current + 1), [location.key]);
} else if (location.action === _Actions.REPLACE) {
allKeys[current] = location.key;
}
changeListeners.forEach(function (listener) {
listener(location);
});
}
function listen(listener) {
changeListeners.push(listener);
if (location) {
listener(location);
} else {
var _location = getCurrentLocation();
allKeys = [_location.key];
updateLocation(_location);
}
return function () {
changeListeners = changeListeners.filter(function (item) {
return item !== listener;
});
};
}
function confirmTransitionTo(location, callback) {
_AsyncUtils.loopAsync(transitionHooks.length, function (index, next, done) {
_runTransitionHook2['default'](transitionHooks[index], location, function (result) {
if (result != null) {
done(result);
} else {
next();
}
});
}, function (message) {
if (getUserConfirmation && typeof message === 'string') {
getUserConfirmation(message, function (ok) {
callback(ok !== false);
});
} else {
callback(message !== false);
}
});
}
var pendingLocation = undefined;
function transitionTo(nextLocation) {
if (location && locationsAreEqual(location, nextLocation)) return; // Nothing to do.
pendingLocation = nextLocation;
confirmTransitionTo(nextLocation, function (ok) {
if (pendingLocation !== nextLocation) return; // Transition was interrupted.
if (ok) {
// treat PUSH to current path like REPLACE to be consistent with browsers
if (nextLocation.action === _Actions.PUSH) {
var prevPath = createPath(location);
var nextPath = createPath(nextLocation);
if (nextPath === prevPath && _deepEqual2['default'](location.state, nextLocation.state)) nextLocation.action = _Actions.REPLACE;
}
if (finishTransition(nextLocation) !== false) updateLocation(nextLocation);
} else if (location && nextLocation.action === _Actions.POP) {
var prevIndex = allKeys.indexOf(location.key);
var nextIndex = allKeys.indexOf(nextLocation.key);
if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL.
}
});
}
function push(location) {
transitionTo(createLocation(location, _Actions.PUSH, createKey()));
}
function replace(location) {
transitionTo(createLocation(location, _Actions.REPLACE, createKey()));
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
function createKey() {
return createRandomKey(keyLength);
}
function createPath(location) {
if (location == null || typeof location === 'string') return location;
var pathname = location.pathname;
var search = location.search;
var hash = location.hash;
var result = pathname;
if (search) result += search;
if (hash) result += hash;
return result;
}
function createHref(location) {
return createPath(location);
}
function createLocation(location, action) {
var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
if (typeof action === 'object') {
true ? _warning2['default'](false, 'The state (2nd) argument to history.createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
if (typeof location === 'string') location = _PathUtils.parsePath(location);
location = _extends({}, location, { state: action });
action = key;
key = arguments[3] || createKey();
}
return _createLocation3['default'](location, action, key);
}
// deprecated
function setState(state) {
if (location) {
updateLocationState(location, state);
updateLocation(location);
} else {
updateLocationState(getCurrentLocation(), state);
}
}
function updateLocationState(location, state) {
location.state = _extends({}, location.state, state);
saveState(location.key, location.state);
}
// deprecated
function registerTransitionHook(hook) {
if (transitionHooks.indexOf(hook) === -1) transitionHooks.push(hook);
}
// deprecated
function unregisterTransitionHook(hook) {
transitionHooks = transitionHooks.filter(function (item) {
return item !== hook;
});
}
// deprecated
function pushState(state, path) {
if (typeof path === 'string') path = _PathUtils.parsePath(path);
push(_extends({ state: state }, path));
}
// deprecated
function replaceState(state, path) {
if (typeof path === 'string') path = _PathUtils.parsePath(path);
replace(_extends({ state: state }, path));
}
return {
listenBefore: listenBefore,
listen: listen,
transitionTo: transitionTo,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
createKey: createKey,
createPath: createPath,
createHref: createHref,
createLocation: createLocation,
setState: _deprecate2['default'](setState, 'setState is deprecated; use location.key to save state instead'),
registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'),
unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'),
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
};
}
exports['default'] = createHistory;
module.exports = exports['default'];
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var _ExecutionEnvironment = __webpack_require__(12);
var _PathUtils = __webpack_require__(7);
var _runTransitionHook = __webpack_require__(19);
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
var _deprecate = __webpack_require__(18);
var _deprecate2 = _interopRequireDefault(_deprecate);
function useBasename(createHistory) {
return function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var history = createHistory(options);
var basename = options.basename;
var checkedBaseHref = false;
function checkBaseHref() {
if (checkedBaseHref) {
return;
}
// Automatically use the value of <base href> in HTML
// documents as basename if it's not explicitly given.
if (basename == null && _ExecutionEnvironment.canUseDOM) {
var base = document.getElementsByTagName('base')[0];
var baseHref = base && base.getAttribute('href');
if (baseHref != null) {
basename = baseHref;
true ? _warning2['default'](false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined;
}
}
checkedBaseHref = true;
}
function addBasename(location) {
checkBaseHref();
if (basename && location.basename == null) {
if (location.pathname.indexOf(basename) === 0) {
location.pathname = location.pathname.substring(basename.length);
location.basename = basename;
if (location.pathname === '') location.pathname = '/';
} else {
location.basename = '';
}
}
return location;
}
function prependBasename(location) {
checkBaseHref();
if (!basename) return location;
if (typeof location === 'string') location = _PathUtils.parsePath(location);
var pname = location.pathname;
var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
var pathname = normalizedBasename + normalizedPathname;
return _extends({}, location, {
pathname: pathname
});
}
// Override all read methods with basename-aware versions.
function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addBasename(location), callback);
});
}
function listen(listener) {
return history.listen(function (location) {
listener(addBasename(location));
});
}
// Override all write methods with basename-aware versions.
function push(location) {
history.push(prependBasename(location));
}
function replace(location) {
history.replace(prependBasename(location));
}
function createPath(location) {
return history.createPath(prependBasename(location));
}
function createHref(location) {
return history.createHref(prependBasename(location));
}
function createLocation(location) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return addBasename(history.createLocation.apply(history, [prependBasename(location)].concat(args)));
}
// deprecated
function pushState(state, path) {
if (typeof path === 'string') path = _PathUtils.parsePath(path);
push(_extends({ state: state }, path));
}
// deprecated
function replaceState(state, path) {
if (typeof path === 'string') path = _PathUtils.parsePath(path);
replace(_extends({ state: state }, path));
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
push: push,
replace: replace,
createPath: createPath,
createHref: createHref,
createLocation: createLocation,
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
});
};
}
exports['default'] = useBasename;
module.exports = exports['default'];
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _InternalPropTypes = __webpack_require__(6);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A mixin that adds the "history" instance variable to components.
*/
var History = {
contextTypes: {
history: _InternalPropTypes.history
},
componentWillMount: function componentWillMount() {
true ? (0, _routerWarning2.default)(false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : void 0;
this.history = this.context.history;
}
};
exports.default = History;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _Link = __webpack_require__(20);
var _Link2 = _interopRequireDefault(_Link);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An <IndexLink> is used to link to an <IndexRoute>.
*/
var IndexLink = _react2.default.createClass({
displayName: 'IndexLink',
render: function render() {
return _react2.default.createElement(_Link2.default, _extends({}, this.props, { onlyActiveOnIndex: true }));
}
});
exports.default = IndexLink;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _Redirect = __webpack_require__(21);
var _Redirect2 = _interopRequireDefault(_Redirect);
var _InternalPropTypes = __webpack_require__(6);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _React$PropTypes = _react2.default.PropTypes;
var string = _React$PropTypes.string;
var object = _React$PropTypes.object;
/**
* An <IndexRedirect> is used to redirect from an indexRoute.
*/
var IndexRedirect = _react2.default.createClass({
displayName: 'IndexRedirect',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = _Redirect2.default.createRouteFromReactElement(element);
} else {
true ? (0, _routerWarning2.default)(false, 'An <IndexRedirect> does not make sense at the root of your route config') : void 0;
}
}
},
propTypes: {
to: string.isRequired,
query: object,
state: object,
onEnter: _InternalPropTypes.falsy,
children: _InternalPropTypes.falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
true ? true ? (0, _invariant2.default)(false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
});
exports.default = IndexRedirect;
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = __webpack_require__(5);
var _InternalPropTypes = __webpack_require__(6);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var func = _react2.default.PropTypes.func;
/**
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
* a JSX route config.
*/
var IndexRoute = _react2.default.createClass({
displayName: 'IndexRoute',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = (0, _RouteUtils.createRouteFromReactElement)(element);
} else {
true ? (0, _routerWarning2.default)(false, 'An <IndexRoute> does not make sense at the root of your route config') : void 0;
}
}
},
propTypes: {
path: _InternalPropTypes.falsy,
component: _InternalPropTypes.component,
components: _InternalPropTypes.components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
true ? true ? (0, _invariant2.default)(false, '<IndexRoute> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
});
exports.default = IndexRoute;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var object = _react2.default.PropTypes.object;
/**
* The Lifecycle mixin adds the routerWillLeave lifecycle method to a
* component that may be used to cancel a transition or prompt the user
* for confirmation.
*
* On standard transitions, routerWillLeave receives a single argument: the
* location we're transitioning to. To cancel the transition, return false.
* To prompt the user for confirmation, return a prompt message (string).
*
* During the beforeunload event (assuming you're using the useBeforeUnload
* history enhancer), routerWillLeave does not receive a location object
* because it isn't possible for us to know the location we're transitioning
* to. In this case routerWillLeave must return a prompt message to prevent
* the user from closing the window/tab.
*/
var Lifecycle = {
contextTypes: {
history: object.isRequired,
// Nested children receive the route as context, either
// set by the route component using the RouteContext mixin
// or by some other ancestor.
route: object
},
propTypes: {
// Route components receive the route object as a prop.
route: object
},
componentDidMount: function componentDidMount() {
true ? (0, _routerWarning2.default)(false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : void 0;
!this.routerWillLeave ? true ? (0, _invariant2.default)(false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : (0, _invariant2.default)(false) : void 0;
var route = this.props.route || this.context.route;
!route ? true ? (0, _invariant2.default)(false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : (0, _invariant2.default)(false) : void 0;
this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave);
},
componentWillUnmount: function componentWillUnmount() {
if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute();
}
};
exports.default = Lifecycle;
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = __webpack_require__(5);
var _InternalPropTypes = __webpack_require__(6);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _React$PropTypes = _react2.default.PropTypes;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
/**
* A <Route> is used to declare which components are rendered to the
* page when the URL matches a given pattern.
*
* Routes are arranged in a nested tree structure. When a new URL is
* requested, the tree is searched depth-first to find a route whose
* path matches the URL. When one is found, all routes in the tree
* that lead to it are considered "active" and their components are
* rendered into the DOM, nested in the same order as in the tree.
*/
var Route = _react2.default.createClass({
displayName: 'Route',
statics: {
createRouteFromReactElement: _RouteUtils.createRouteFromReactElement
},
propTypes: {
path: string,
component: _InternalPropTypes.component,
components: _InternalPropTypes.components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
true ? true ? (0, _invariant2.default)(false, '<Route> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
}
});
exports.default = Route;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var object = _react2.default.PropTypes.object;
/**
* The RouteContext mixin provides a convenient way for route
* components to set the route in context. This is needed for
* routes that render elements that want to use the Lifecycle
* mixin to prevent transitions.
*/
var RouteContext = {
propTypes: {
route: object.isRequired
},
childContextTypes: {
route: object.isRequired
},
getChildContext: function getChildContext() {
return {
route: this.props.route
};
},
componentWillMount: function componentWillMount() {
true ? (0, _routerWarning2.default)(false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : void 0;
}
};
exports.default = RouteContext;
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createHashHistory = __webpack_require__(29);
var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
var _useQueries = __webpack_require__(13);
var _useQueries2 = _interopRequireDefault(_useQueries);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _createTransitionManager = __webpack_require__(16);
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _InternalPropTypes = __webpack_require__(6);
var _RouterContext = __webpack_require__(10);
var _RouterContext2 = _interopRequireDefault(_RouterContext);
var _RouteUtils = __webpack_require__(5);
var _RouterUtils = __webpack_require__(22);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function isDeprecatedHistory(history) {
return !history || !history.__v2_compatible__;
}
/* istanbul ignore next: sanity check */
function isUnsupportedHistory(history) {
// v3 histories expose getCurrentLocation, but aren't currently supported.
return history && history.getCurrentLocation;
}
var _React$PropTypes = _react2.default.PropTypes;
var func = _React$PropTypes.func;
var object = _React$PropTypes.object;
/**
* A <Router> is a high-level API for automatically setting up
* a router that renders a <RouterContext> with all the props
* it needs each time the URL changes.
*/
var Router = _react2.default.createClass({
displayName: 'Router',
propTypes: {
history: object,
children: _InternalPropTypes.routes,
routes: _InternalPropTypes.routes, // alias for children
render: func,
createElement: func,
onError: func,
onUpdate: func,
// Deprecated:
parseQueryString: func,
stringifyQuery: func,
// PRIVATE: For client-side rehydration of server match.
matchContext: object
},
getDefaultProps: function getDefaultProps() {
return {
render: function render(props) {
return _react2.default.createElement(_RouterContext2.default, props);
}
};
},
getInitialState: function getInitialState() {
return {
location: null,
routes: null,
params: null,
components: null
};
},
handleError: function handleError(error) {
if (this.props.onError) {
this.props.onError.call(this, error);
} else {
// Throw errors by default so we don't silently swallow them!
throw error; // This error probably occurred in getChildRoutes or getComponents.
}
},
componentWillMount: function componentWillMount() {
var _this = this;
var _props = this.props;
var parseQueryString = _props.parseQueryString;
var stringifyQuery = _props.stringifyQuery;
true ? (0, _routerWarning2.default)(!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : void 0;
var _createRouterObjects = this.createRouterObjects();
var history = _createRouterObjects.history;
var transitionManager = _createRouterObjects.transitionManager;
var router = _createRouterObjects.router;
this._unlisten = transitionManager.listen(function (error, state) {
if (error) {
_this.handleError(error);
} else {
_this.setState(state, _this.props.onUpdate);
}
});
this.history = history;
this.router = router;
},
createRouterObjects: function createRouterObjects() {
var matchContext = this.props.matchContext;
if (matchContext) {
return matchContext;
}
var history = this.props.history;
var _props2 = this.props;
var routes = _props2.routes;
var children = _props2.children;
!!isUnsupportedHistory(history) ? true ? (0, _invariant2.default)(false, 'You have provided a history object created with history v3.x. ' + 'This version of React Router is not compatible with v3 history ' + 'objects. Please use history v2.x instead.') : (0, _invariant2.default)(false) : void 0;
if (isDeprecatedHistory(history)) {
history = this.wrapDeprecatedHistory(history);
}
var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes || children));
var router = (0, _RouterUtils.createRouterObject)(history, transitionManager);
var routingHistory = (0, _RouterUtils.createRoutingHistory)(history, transitionManager);
return { history: routingHistory, transitionManager: transitionManager, router: router };
},
wrapDeprecatedHistory: function wrapDeprecatedHistory(history) {
var _props3 = this.props;
var parseQueryString = _props3.parseQueryString;
var stringifyQuery = _props3.stringifyQuery;
var createHistory = void 0;
if (history) {
true ? (0, _routerWarning2.default)(false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : void 0;
createHistory = function createHistory() {
return history;
};
} else {
true ? (0, _routerWarning2.default)(false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : void 0;
createHistory = _createHashHistory2.default;
}
return (0, _useQueries2.default)(createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery });
},
/* istanbul ignore next: sanity check */
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
true ? (0, _routerWarning2.default)(nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : void 0;
true ? (0, _routerWarning2.default)((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : void 0;
},
componentWillUnmount: function componentWillUnmount() {
if (this._unlisten) this._unlisten();
},
render: function render() {
var _state = this.state;
var location = _state.location;
var routes = _state.routes;
var params = _state.params;
var components = _state.components;
var _props4 = this.props;
var createElement = _props4.createElement;
var render = _props4.render;
var props = _objectWithoutProperties(_props4, ['createElement', 'render']);
if (location == null) return null; // Async match
// Only forward non-Router-specific props to routing context, as those are
// the only ones that might be custom routing context props.
Object.keys(Router.propTypes).forEach(function (propType) {
return delete props[propType];
});
return render(_extends({}, props, {
history: this.history,
router: this.router,
location: location,
routes: routes,
params: params,
components: components,
createElement: createElement
}));
}
});
exports.default = Router;
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _RouterContext = __webpack_require__(10);
var _RouterContext2 = _interopRequireDefault(_RouterContext);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var RoutingContext = _react2.default.createClass({
displayName: 'RoutingContext',
componentWillMount: function componentWillMount() {
true ? (0, _routerWarning2.default)(false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : void 0;
},
render: function render() {
return _react2.default.createElement(_RouterContext2.default, this.props);
}
});
exports.default = RoutingContext;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.runEnterHooks = runEnterHooks;
exports.runChangeHooks = runChangeHooks;
exports.runLeaveHooks = runLeaveHooks;
var _AsyncUtils = __webpack_require__(14);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createTransitionHook(hook, route, asyncArity) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
hook.apply(route, args);
if (hook.length < asyncArity) {
var callback = args[args.length - 1];
// Assume hook executes synchronously and
// automatically call the callback.
callback();
}
};
}
function getEnterHooks(routes) {
return routes.reduce(function (hooks, route) {
if (route.onEnter) hooks.push(createTransitionHook(route.onEnter, route, 3));
return hooks;
}, []);
}
function getChangeHooks(routes) {
return routes.reduce(function (hooks, route) {
if (route.onChange) hooks.push(createTransitionHook(route.onChange, route, 4));
return hooks;
}, []);
}
function runTransitionHooks(length, iter, callback) {
if (!length) {
callback();
return;
}
var redirectInfo = void 0;
function replace(location, deprecatedPathname, deprecatedQuery) {
if (deprecatedPathname) {
true ? (0, _routerWarning2.default)(false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : void 0;
redirectInfo = {
pathname: deprecatedPathname,
query: deprecatedQuery,
state: location
};
return;
}
redirectInfo = location;
}
(0, _AsyncUtils.loopAsync)(length, function (index, next, done) {
iter(index, replace, function (error) {
if (error || redirectInfo) {
done(error, redirectInfo); // No need to continue.
} else {
next();
}
});
}, callback);
}
/**
* Runs all onEnter hooks in the given array of routes in order
* with onEnter(nextState, replace, callback) and calls
* callback(error, redirectInfo) when finished. The first hook
* to use replace short-circuits the loop.
*
* If a hook needs to run asynchronously, it may use the callback
* function. However, doing so will cause the transition to pause,
* which could lead to a non-responsive UI if the hook is slow.
*/
function runEnterHooks(routes, nextState, callback) {
var hooks = getEnterHooks(routes);
return runTransitionHooks(hooks.length, function (index, replace, next) {
hooks[index](nextState, replace, next);
}, callback);
}
/**
* Runs all onChange hooks in the given array of routes in order
* with onChange(prevState, nextState, replace, callback) and calls
* callback(error, redirectInfo) when finished. The first hook
* to use replace short-circuits the loop.
*
* If a hook needs to run asynchronously, it may use the callback
* function. However, doing so will cause the transition to pause,
* which could lead to a non-responsive UI if the hook is slow.
*/
function runChangeHooks(routes, state, nextState, callback) {
var hooks = getChangeHooks(routes);
return runTransitionHooks(hooks.length, function (index, replace, next) {
hooks[index](state, nextState, replace, next);
}, callback);
}
/**
* Runs all onLeave hooks in the given array of routes in order.
*/
function runLeaveHooks(routes, prevState) {
for (var i = 0, len = routes.length; i < len; ++i) {
if (routes[i].onLeave) routes[i].onLeave.call(routes[i], prevState);
}
}
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _RouterContext = __webpack_require__(10);
var _RouterContext2 = _interopRequireDefault(_RouterContext);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
if (true) {
middlewares.forEach(function (middleware, index) {
true ? (0, _routerWarning2.default)(middleware.renderRouterContext || middleware.renderRouteComponent, 'The middleware specified at index ' + index + ' does not appear to be ' + 'a valid React Router middleware.') : void 0;
});
}
var withContext = middlewares.map(function (middleware) {
return middleware.renderRouterContext;
}).filter(Boolean);
var withComponent = middlewares.map(function (middleware) {
return middleware.renderRouteComponent;
}).filter(Boolean);
var makeCreateElement = function makeCreateElement() {
var baseCreateElement = arguments.length <= 0 || arguments[0] === undefined ? _react.createElement : arguments[0];
return function (Component, props) {
return withComponent.reduceRight(function (previous, renderRouteComponent) {
return renderRouteComponent(previous, props);
}, baseCreateElement(Component, props));
};
};
return function (renderProps) {
return withContext.reduceRight(function (previous, renderRouterContext) {
return renderRouterContext(previous, renderProps);
}, _react2.default.createElement(_RouterContext2.default, _extends({}, renderProps, {
createElement: makeCreateElement(renderProps.createElement)
})));
};
};
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createBrowserHistory = __webpack_require__(57);
var _createBrowserHistory2 = _interopRequireDefault(_createBrowserHistory);
var _createRouterHistory = __webpack_require__(24);
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (0, _createRouterHistory2.default)(_createBrowserHistory2.default);
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _PatternUtils = __webpack_require__(8);
function routeParamsChanged(route, prevState, nextState) {
if (!route.path) return false;
var paramNames = (0, _PatternUtils.getParamNames)(route.path);
return paramNames.some(function (paramName) {
return prevState.params[paramName] !== nextState.params[paramName];
});
}
/**
* Returns an object of { leaveRoutes, changeRoutes, enterRoutes } determined by
* the change from prevState to nextState. We leave routes if either
* 1) they are not in the next state or 2) they are in the next state
* but their params have changed (i.e. /users/123 => /users/456).
*
* leaveRoutes are ordered starting at the leaf route of the tree
* we're leaving up to the common parent route. enterRoutes are ordered
* from the top of the tree we're entering down to the leaf route.
*
* changeRoutes are any routes that didn't leave or enter during
* the transition.
*/
function computeChangedRoutes(prevState, nextState) {
var prevRoutes = prevState && prevState.routes;
var nextRoutes = nextState.routes;
var leaveRoutes = void 0,
changeRoutes = void 0,
enterRoutes = void 0;
if (prevRoutes) {
(function () {
var parentIsLeaving = false;
leaveRoutes = prevRoutes.filter(function (route) {
if (parentIsLeaving) {
return true;
} else {
var isLeaving = nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
if (isLeaving) parentIsLeaving = true;
return isLeaving;
}
});
// onLeave hooks start at the leaf route.
leaveRoutes.reverse();
enterRoutes = [];
changeRoutes = [];
nextRoutes.forEach(function (route) {
var isNew = prevRoutes.indexOf(route) === -1;
var paramsChanged = leaveRoutes.indexOf(route) !== -1;
if (isNew || paramsChanged) enterRoutes.push(route);else changeRoutes.push(route);
});
})();
} else {
leaveRoutes = [];
changeRoutes = [];
enterRoutes = nextRoutes;
}
return {
leaveRoutes: leaveRoutes,
changeRoutes: changeRoutes,
enterRoutes: enterRoutes
};
}
exports.default = computeChangedRoutes;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _AsyncUtils = __webpack_require__(14);
var _makeStateWithLocation = __webpack_require__(25);
var _makeStateWithLocation2 = _interopRequireDefault(_makeStateWithLocation);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getComponentsForRoute(nextState, route, callback) {
if (route.component || route.components) {
callback(null, route.component || route.components);
return;
}
var getComponent = route.getComponent || route.getComponents;
if (!getComponent) {
callback();
return;
}
var location = nextState.location;
var nextStateWithLocation = (0, _makeStateWithLocation2.default)(nextState, location);
getComponent.call(route, nextStateWithLocation, callback);
}
/**
* Asynchronously fetches all components needed for the given router
* state and calls callback(error, components) when finished.
*
* Note: This operation may finish synchronously if no routes have an
* asynchronous getComponents method.
*/
function getComponents(nextState, callback) {
(0, _AsyncUtils.mapAsync)(nextState.routes, function (route, index, callback) {
getComponentsForRoute(nextState, route, callback);
}, callback);
}
exports.default = getComponents;
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _PatternUtils = __webpack_require__(8);
/**
* Extracts an object of params the given route cares about from
* the given params object.
*/
function getRouteParams(route, params) {
var routeParams = {};
if (!route.path) return routeParams;
(0, _PatternUtils.getParamNames)(route.path).forEach(function (p) {
if (Object.prototype.hasOwnProperty.call(params, p)) {
routeParams[p] = params[p];
}
});
return routeParams;
}
exports.default = getRouteParams;
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createHashHistory = __webpack_require__(29);
var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
var _createRouterHistory = __webpack_require__(24);
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (0, _createRouterHistory2.default)(_createHashHistory2.default);
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.default = isActive;
var _PatternUtils = __webpack_require__(8);
function deepEqual(a, b) {
if (a == b) return true;
if (a == null || b == null) return false;
if (Array.isArray(a)) {
return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
return deepEqual(item, b[index]);
});
}
if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object') {
for (var p in a) {
if (!Object.prototype.hasOwnProperty.call(a, p)) {
continue;
}
if (a[p] === undefined) {
if (b[p] !== undefined) {
return false;
}
} else if (!Object.prototype.hasOwnProperty.call(b, p)) {
return false;
} else if (!deepEqual(a[p], b[p])) {
return false;
}
}
return true;
}
return String(a) === String(b);
}
/**
* Returns true if the current pathname matches the supplied one, net of
* leading and trailing slash normalization. This is sufficient for an
* indexOnly route match.
*/
function pathIsActive(pathname, currentPathname) {
// Normalize leading slash for consistency. Leading slash on pathname has
// already been normalized in isActive. See caveat there.
if (currentPathname.charAt(0) !== '/') {
currentPathname = '/' + currentPathname;
}
// Normalize the end of both path names too. Maybe `/foo/` shouldn't show
// `/foo` as active, but in this case, we would already have failed the
// match.
if (pathname.charAt(pathname.length - 1) !== '/') {
pathname += '/';
}
if (currentPathname.charAt(currentPathname.length - 1) !== '/') {
currentPathname += '/';
}
return currentPathname === pathname;
}
/**
* Returns true if the given pathname matches the active routes and params.
*/
function routeIsActive(pathname, routes, params) {
var remainingPathname = pathname,
paramNames = [],
paramValues = [];
// for...of would work here but it's probably slower post-transpilation.
for (var i = 0, len = routes.length; i < len; ++i) {
var route = routes[i];
var pattern = route.path || '';
if (pattern.charAt(0) === '/') {
remainingPathname = pathname;
paramNames = [];
paramValues = [];
}
if (remainingPathname !== null && pattern) {
var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
if (matched) {
remainingPathname = matched.remainingPathname;
paramNames = [].concat(paramNames, matched.paramNames);
paramValues = [].concat(paramValues, matched.paramValues);
} else {
remainingPathname = null;
}
if (remainingPathname === '') {
// We have an exact match on the route. Just check that all the params
// match.
// FIXME: This doesn't work on repeated params.
return paramNames.every(function (paramName, index) {
return String(paramValues[index]) === String(params[paramName]);
});
}
}
}
return false;
}
/**
* Returns true if all key/value pairs in the given query are
* currently active.
*/
function queryIsActive(query, activeQuery) {
if (activeQuery == null) return query == null;
if (query == null) return true;
return deepEqual(query, activeQuery);
}
/**
* Returns true if a <Link> to the given pathname/query combination is
* currently active.
*/
function isActive(_ref, indexOnly, currentLocation, routes, params) {
var pathname = _ref.pathname;
var query = _ref.query;
if (currentLocation == null) return false;
// TODO: This is a bit ugly. It keeps around support for treating pathnames
// without preceding slashes as absolute paths, but possibly also works
// around the same quirks with basenames as in matchRoutes.
if (pathname.charAt(0) !== '/') {
pathname = '/' + pathname;
}
if (!pathIsActive(pathname, currentLocation.pathname)) {
// The path check is necessary and sufficient for indexOnly, but otherwise
// we still need to check the routes.
if (indexOnly || !routeIsActive(pathname, routes, params)) {
return false;
}
}
return queryIsActive(query, currentLocation.query);
}
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _Actions = __webpack_require__(9);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _createMemoryHistory = __webpack_require__(23);
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
var _createTransitionManager = __webpack_require__(16);
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _RouteUtils = __webpack_require__(5);
var _RouterUtils = __webpack_require__(22);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
/**
* A high-level API to be used for server-side rendering.
*
* This function matches a location to a set of routes and calls
* callback(error, redirectLocation, renderProps) when finished.
*
* Note: You probably don't want to use this in a browser unless you're using
* server-side rendering with async routes.
*/
function match(_ref, callback) {
var history = _ref.history;
var routes = _ref.routes;
var location = _ref.location;
var options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']);
!(history || location) ? true ? (0, _invariant2.default)(false, 'match needs a history or a location') : (0, _invariant2.default)(false) : void 0;
history = history ? history : (0, _createMemoryHistory2.default)(options);
var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes));
var unlisten = void 0;
if (location) {
// Allow match({ location: '/the/path', ... })
location = history.createLocation(location);
} else {
// Pick up the location from the history via synchronous history.listen
// call if needed.
unlisten = history.listen(function (historyLocation) {
location = historyLocation;
});
}
var router = (0, _RouterUtils.createRouterObject)(history, transitionManager);
history = (0, _RouterUtils.createRoutingHistory)(history, transitionManager);
transitionManager.match(location, function (error, redirectLocation, nextState) {
callback(error, redirectLocation && router.createLocation(redirectLocation, _Actions.REPLACE), nextState && _extends({}, nextState, {
history: history,
router: router,
matchContext: { history: history, transitionManager: transitionManager, router: router }
}));
// Defer removing the listener to here to prevent DOM histories from having
// to unwind DOM event listeners unnecessarily, in case callback renders a
// <Router> and attaches another history listener.
if (unlisten) {
unlisten();
}
});
}
exports.default = match;
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
exports.default = matchRoutes;
var _AsyncUtils = __webpack_require__(14);
var _makeStateWithLocation = __webpack_require__(25);
var _makeStateWithLocation2 = _interopRequireDefault(_makeStateWithLocation);
var _PatternUtils = __webpack_require__(8);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
var _RouteUtils = __webpack_require__(5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getChildRoutes(route, location, paramNames, paramValues, callback) {
if (route.childRoutes) {
return [null, route.childRoutes];
}
if (!route.getChildRoutes) {
return [];
}
var sync = true,
result = void 0;
var partialNextState = {
location: location,
params: createParams(paramNames, paramValues)
};
var partialNextStateWithLocation = (0, _makeStateWithLocation2.default)(partialNextState, location);
route.getChildRoutes(partialNextStateWithLocation, function (error, childRoutes) {
childRoutes = !error && (0, _RouteUtils.createRoutes)(childRoutes);
if (sync) {
result = [error, childRoutes];
return;
}
callback(error, childRoutes);
});
sync = false;
return result; // Might be undefined.
}
function getIndexRoute(route, location, paramNames, paramValues, callback) {
if (route.indexRoute) {
callback(null, route.indexRoute);
} else if (route.getIndexRoute) {
var partialNextState = {
location: location,
params: createParams(paramNames, paramValues)
};
var partialNextStateWithLocation = (0, _makeStateWithLocation2.default)(partialNextState, location);
route.getIndexRoute(partialNextStateWithLocation, function (error, indexRoute) {
callback(error, !error && (0, _RouteUtils.createRoutes)(indexRoute)[0]);
});
} else if (route.childRoutes) {
(function () {
var pathless = route.childRoutes.filter(function (childRoute) {
return !childRoute.path;
});
(0, _AsyncUtils.loopAsync)(pathless.length, function (index, next, done) {
getIndexRoute(pathless[index], location, paramNames, paramValues, function (error, indexRoute) {
if (error || indexRoute) {
var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
done(error, routes);
} else {
next();
}
});
}, function (err, routes) {
callback(null, routes);
});
})();
} else {
callback();
}
}
function assignParams(params, paramNames, paramValues) {
return paramNames.reduce(function (params, paramName, index) {
var paramValue = paramValues && paramValues[index];
if (Array.isArray(params[paramName])) {
params[paramName].push(paramValue);
} else if (paramName in params) {
params[paramName] = [params[paramName], paramValue];
} else {
params[paramName] = paramValue;
}
return params;
}, params);
}
function createParams(paramNames, paramValues) {
return assignParams({}, paramNames, paramValues);
}
function matchRouteDeep(route, location, remainingPathname, paramNames, paramValues, callback) {
var pattern = route.path || '';
if (pattern.charAt(0) === '/') {
remainingPathname = location.pathname;
paramNames = [];
paramValues = [];
}
// Only try to match the path if the route actually has a pattern, and if
// we're not just searching for potential nested absolute paths.
if (remainingPathname !== null && pattern) {
try {
var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
if (matched) {
remainingPathname = matched.remainingPathname;
paramNames = [].concat(paramNames, matched.paramNames);
paramValues = [].concat(paramValues, matched.paramValues);
} else {
remainingPathname = null;
}
} catch (error) {
callback(error);
}
// By assumption, pattern is non-empty here, which is the prerequisite for
// actually terminating a match.
if (remainingPathname === '') {
var _ret2 = function () {
var match = {
routes: [route],
params: createParams(paramNames, paramValues)
};
getIndexRoute(route, location, paramNames, paramValues, function (error, indexRoute) {
if (error) {
callback(error);
} else {
if (Array.isArray(indexRoute)) {
var _match$routes;
true ? (0, _routerWarning2.default)(indexRoute.every(function (route) {
return !route.path;
}), 'Index routes should not have paths') : void 0;
(_match$routes = match.routes).push.apply(_match$routes, indexRoute);
} else if (indexRoute) {
true ? (0, _routerWarning2.default)(!indexRoute.path, 'Index routes should not have paths') : void 0;
match.routes.push(indexRoute);
}
callback(null, match);
}
});
return {
v: void 0
};
}();
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
}
}
if (remainingPathname != null || route.childRoutes) {
// Either a) this route matched at least some of the path or b)
// we don't have to load this route's children asynchronously. In
// either case continue checking for matches in the subtree.
var onChildRoutes = function onChildRoutes(error, childRoutes) {
if (error) {
callback(error);
} else if (childRoutes) {
// Check the child routes to see if any of them match.
matchRoutes(childRoutes, location, function (error, match) {
if (error) {
callback(error);
} else if (match) {
// A child route matched! Augment the match and pass it up the stack.
match.routes.unshift(route);
callback(null, match);
} else {
callback();
}
}, remainingPathname, paramNames, paramValues);
} else {
callback();
}
};
var result = getChildRoutes(route, location, paramNames, paramValues, onChildRoutes);
if (result) {
onChildRoutes.apply(undefined, result);
}
} else {
callback();
}
}
/**
* Asynchronously matches the given location to a set of routes and calls
* callback(error, state) when finished. The state object will have the
* following properties:
*
* - routes An array of routes that matched, in hierarchical order
* - params An object of URL parameters
*
* Note: This operation may finish synchronously if no routes have an
* asynchronous getChildRoutes method.
*/
function matchRoutes(routes, location, callback, remainingPathname) {
var paramNames = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4];
var paramValues = arguments.length <= 5 || arguments[5] === undefined ? [] : arguments[5];
if (remainingPathname === undefined) {
// TODO: This is a little bit ugly, but it works around a quirk in history
// that strips the leading slash from pathnames when using basenames with
// trailing slashes.
if (location.pathname.charAt(0) !== '/') {
location = _extends({}, location, {
pathname: '/' + location.pathname
});
}
remainingPathname = location.pathname;
}
(0, _AsyncUtils.loopAsync)(routes.length, function (index, next, done) {
matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
if (error || match) {
done(error, match);
} else {
next();
}
});
}, callback);
}
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _useQueries = __webpack_require__(13);
var _useQueries2 = _interopRequireDefault(_useQueries);
var _createTransitionManager = __webpack_require__(16);
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _routerWarning = __webpack_require__(1);
var _routerWarning2 = _interopRequireDefault(_routerWarning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
/**
* Returns a new createHistory function that may be used to create
* history objects that know about routing.
*
* Enhances history objects with the following methods:
*
* - listen((error, nextState) => {})
* - listenBeforeLeavingRoute(route, (nextLocation) => {})
* - match(location, (error, redirectLocation, nextState) => {})
* - isActive(pathname, query, indexOnly=false)
*/
function useRoutes(createHistory) {
true ? (0, _routerWarning2.default)(false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : void 0;
return function () {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var routes = _ref.routes;
var options = _objectWithoutProperties(_ref, ['routes']);
var history = (0, _useQueries2.default)(createHistory)(options);
var transitionManager = (0, _createTransitionManager2.default)(history, routes);
return _extends({}, history, transitionManager);
};
}
exports.default = useRoutes;
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = withRouter;
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _hoistNonReactStatics = __webpack_require__(60);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _PropTypes = __webpack_require__(15);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
function withRouter(WrappedComponent, options) {
var withRef = options && options.withRef;
var WithRouter = _react2.default.createClass({
displayName: 'WithRouter',
contextTypes: { router: _PropTypes.routerShape },
propTypes: { router: _PropTypes.routerShape },
getWrappedInstance: function getWrappedInstance() {
!withRef ? true ? (0, _invariant2.default)(false, 'To access the wrapped instance, you need to specify ' + '`{ withRef: true }` as the second argument of the withRouter() call.') : (0, _invariant2.default)(false) : void 0;
return this.wrappedInstance;
},
render: function render() {
var _this = this;
var router = this.props.router || this.context.router;
var props = _extends({}, this.props, { router: router });
if (withRef) {
props.ref = function (c) {
_this.wrappedInstance = c;
};
}
return _react2.default.createElement(WrappedComponent, props);
}
});
WithRouter.displayName = 'withRouter(' + getDisplayName(WrappedComponent) + ')';
WithRouter.WrappedComponent = WrappedComponent;
return (0, _hoistNonReactStatics2.default)(WithRouter, WrappedComponent);
}
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
var pSlice = Array.prototype.slice;
var objectKeys = __webpack_require__(55);
var isArguments = __webpack_require__(54);
var deepEqual = module.exports = function (actual, expected, opts) {
if (!opts) opts = {};
// 7.1. All identical values are equivalent, as determined by ===.
if (actual === expected) {
return true;
} else if (actual instanceof Date && expected instanceof Date) {
return actual.getTime() === expected.getTime();
// 7.3. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
return opts.strict ? actual === expected : actual == expected;
// 7.4. For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else {
return objEquiv(actual, expected, opts);
}
}
function isUndefinedOrNull(value) {
return value === null || value === undefined;
}
function isBuffer (x) {
if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
return false;
}
if (x.length > 0 && typeof x[0] !== 'number') return false;
return true;
}
function objEquiv(a, b, opts) {
var i, key;
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (isArguments(a)) {
if (!isArguments(b)) {
return false;
}
a = pSlice.call(a);
b = pSlice.call(b);
return deepEqual(a, b, opts);
}
if (isBuffer(a)) {
if (!isBuffer(b)) {
return false;
}
if (a.length !== b.length) return false;
for (i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
}
return true;
}
try {
var ka = objectKeys(a),
kb = objectKeys(b);
} catch (e) {//happens when one is a string literal and the other isn't
return false;
}
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length != kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!deepEqual(a[key], b[key], opts)) return false;
}
return typeof a === typeof b;
}
/***/ },
/* 54 */
/***/ function(module, exports) {
var supportsArgumentsClass = (function(){
return Object.prototype.toString.call(arguments)
})() == '[object Arguments]';
exports = module.exports = supportsArgumentsClass ? supported : unsupported;
exports.supported = supported;
function supported(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
};
exports.unsupported = unsupported;
function unsupported(object){
return object &&
typeof object == 'object' &&
typeof object.length == 'number' &&
Object.prototype.hasOwnProperty.call(object, 'callee') &&
!Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
false;
};
/***/ },
/* 55 */
/***/ function(module, exports) {
exports = module.exports = typeof Object.keys === 'function'
? Object.keys : shim;
exports.shim = shim;
function shim (obj) {
var keys = [];
for (var key in obj) keys.push(key);
return keys;
}
/***/ },
/* 56 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
var _slice = Array.prototype.slice;
exports.loopAsync = loopAsync;
function loopAsync(turns, work, callback) {
var currentTurn = 0,
isDone = false;
var sync = false,
hasNext = false,
doneArgs = undefined;
function done() {
isDone = true;
if (sync) {
// Iterate instead of recursing if possible.
doneArgs = [].concat(_slice.call(arguments));
return;
}
callback.apply(this, arguments);
}
function next() {
if (isDone) {
return;
}
hasNext = true;
if (sync) {
// Iterate instead of recursing if possible.
return;
}
sync = true;
while (!isDone && currentTurn < turns && hasNext) {
hasNext = false;
work.call(this, currentTurn++, next, done);
}
sync = false;
if (isDone) {
// This means the loop finished synchronously.
callback.apply(this, doneArgs);
return;
}
if (currentTurn >= turns && hasNext) {
isDone = true;
callback();
}
}
next();
}
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _Actions = __webpack_require__(9);
var _PathUtils = __webpack_require__(7);
var _ExecutionEnvironment = __webpack_require__(12);
var _DOMUtils = __webpack_require__(17);
var _DOMStateStorage = __webpack_require__(27);
var _createDOMHistory = __webpack_require__(28);
var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
/**
* Creates and returns a history object that uses HTML5's history API
* (pushState, replaceState, and the popstate event) to manage history.
* This is the recommended method of managing history in browsers because
* it provides the cleanest URLs.
*
* Note: In browsers that do not support the HTML5 history API full
* page reloads will be used to preserve URLs.
*/
function createBrowserHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
!_ExecutionEnvironment.canUseDOM ? true ? _invariant2['default'](false, 'Browser history needs a DOM') : _invariant2['default'](false) : undefined;
var forceRefresh = options.forceRefresh;
var isSupported = _DOMUtils.supportsHistory();
var useRefresh = !isSupported || forceRefresh;
function getCurrentLocation(historyState) {
try {
historyState = historyState || window.history.state || {};
} catch (e) {
historyState = {};
}
var path = _DOMUtils.getWindowPath();
var _historyState = historyState;
var key = _historyState.key;
var state = undefined;
if (key) {
state = _DOMStateStorage.readState(key);
} else {
state = null;
key = history.createKey();
if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null);
}
var location = _PathUtils.parsePath(path);
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
}
function startPopStateListener(_ref) {
var transitionTo = _ref.transitionTo;
function popStateListener(event) {
if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit.
transitionTo(getCurrentLocation(event.state));
}
_DOMUtils.addEventListener(window, 'popstate', popStateListener);
return function () {
_DOMUtils.removeEventListener(window, 'popstate', popStateListener);
};
}
function finishTransition(location) {
var basename = location.basename;
var pathname = location.pathname;
var search = location.search;
var hash = location.hash;
var state = location.state;
var action = location.action;
var key = location.key;
if (action === _Actions.POP) return; // Nothing to do.
_DOMStateStorage.saveState(key, state);
var path = (basename || '') + pathname + search + hash;
var historyState = {
key: key
};
if (action === _Actions.PUSH) {
if (useRefresh) {
window.location.href = path;
return false; // Prevent location update.
} else {
window.history.pushState(historyState, null, path);
}
} else {
// REPLACE
if (useRefresh) {
window.location.replace(path);
return false; // Prevent location update.
} else {
window.history.replaceState(historyState, null, path);
}
}
}
var history = _createDOMHistory2['default'](_extends({}, options, {
getCurrentLocation: getCurrentLocation,
finishTransition: finishTransition,
saveState: _DOMStateStorage.saveState
}));
var listenerCount = 0,
stopPopStateListener = undefined;
function listenBefore(listener) {
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
var unlisten = history.listenBefore(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopPopStateListener();
};
}
function listen(listener) {
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
var unlisten = history.listen(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopPopStateListener();
};
}
// deprecated
function registerTransitionHook(hook) {
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
history.registerTransitionHook(hook);
}
// deprecated
function unregisterTransitionHook(hook) {
history.unregisterTransitionHook(hook);
if (--listenerCount === 0) stopPopStateListener();
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
registerTransitionHook: registerTransitionHook,
unregisterTransitionHook: unregisterTransitionHook
});
}
exports['default'] = createBrowserHistory;
module.exports = exports['default'];
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var _Actions = __webpack_require__(9);
var _PathUtils = __webpack_require__(7);
function createLocation() {
var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
if (typeof location === 'string') location = _PathUtils.parsePath(location);
if (typeof action === 'object') {
true ? _warning2['default'](false, 'The state (2nd) argument to createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
location = _extends({}, location, { state: action });
action = key || _Actions.POP;
key = _fourthArg;
}
var pathname = location.pathname || '/';
var search = location.search || '';
var hash = location.hash || '';
var state = location.state || null;
return {
pathname: pathname,
search: search,
hash: hash,
state: state,
action: action,
key: key
};
}
exports['default'] = createLocation;
module.exports = exports['default'];
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = __webpack_require__(4);
var _warning2 = _interopRequireDefault(_warning);
var _invariant = __webpack_require__(3);
var _invariant2 = _interopRequireDefault(_invariant);
var _PathUtils = __webpack_require__(7);
var _Actions = __webpack_require__(9);
var _createHistory = __webpack_require__(30);
var _createHistory2 = _interopRequireDefault(_createHistory);
function createStateStorage(entries) {
return entries.filter(function (entry) {
return entry.state;
}).reduce(function (memo, entry) {
memo[entry.key] = entry.state;
return memo;
}, {});
}
function createMemoryHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
if (Array.isArray(options)) {
options = { entries: options };
} else if (typeof options === 'string') {
options = { entries: [options] };
}
var history = _createHistory2['default'](_extends({}, options, {
getCurrentLocation: getCurrentLocation,
finishTransition: finishTransition,
saveState: saveState,
go: go
}));
var _options = options;
var entries = _options.entries;
var current = _options.current;
if (typeof entries === 'string') {
entries = [entries];
} else if (!Array.isArray(entries)) {
entries = ['/'];
}
entries = entries.map(function (entry) {
var key = history.createKey();
if (typeof entry === 'string') return { pathname: entry, key: key };
if (typeof entry === 'object' && entry) return _extends({}, entry, { key: key });
true ? true ? _invariant2['default'](false, 'Unable to create history entry from %s', entry) : _invariant2['default'](false) : undefined;
});
if (current == null) {
current = entries.length - 1;
} else {
!(current >= 0 && current < entries.length) ? true ? _invariant2['default'](false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : _invariant2['default'](false) : undefined;
}
var storage = createStateStorage(entries);
function saveState(key, state) {
storage[key] = state;
}
function readState(key) {
return storage[key];
}
function getCurrentLocation() {
var entry = entries[current];
var basename = entry.basename;
var pathname = entry.pathname;
var search = entry.search;
var path = (basename || '') + pathname + (search || '');
var key = undefined,
state = undefined;
if (entry.key) {
key = entry.key;
state = readState(key);
} else {
key = history.createKey();
state = null;
entry.key = key;
}
var location = _PathUtils.parsePath(path);
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
}
function canGo(n) {
var index = current + n;
return index >= 0 && index < entries.length;
}
function go(n) {
if (n) {
if (!canGo(n)) {
true ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined;
return;
}
current += n;
var currentLocation = getCurrentLocation();
// change action to POP
history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
}
}
function finishTransition(location) {
switch (location.action) {
case _Actions.PUSH:
current += 1;
// if we are not on the top of stack
// remove rest and push new
if (current < entries.length) entries.splice(current);
entries.push(location);
saveState(location.key, location.state);
break;
case _Actions.REPLACE:
entries[current] = location;
saveState(location.key, location.state);
break;
}
}
return history;
}
exports['default'] = createMemoryHistory;
module.exports = exports['default'];
/***/ },
/* 60 */
/***/ function(module, exports) {
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
arguments: true,
arity: true
};
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function';
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
var keys = Object.getOwnPropertyNames(sourceComponent);
/* istanbul ignore else */
if (isGetOwnPropertySymbolsAvailable) {
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent));
}
for (var i = 0; i < keys.length; ++i) {
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) {
try {
targetComponent[keys[i]] = sourceComponent[keys[i]];
} catch (error) {
}
}
}
}
return targetComponent;
};
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strictUriEncode = __webpack_require__(62);
exports.extract = function (str) {
return str.split('?')[1] || '';
};
exports.parse = function (str) {
if (typeof str !== 'string') {
return {};
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return {};
}
return str.split('&').reduce(function (ret, param) {
var parts = param.replace(/\+/g, ' ').split('=');
// Firefox (pre 40) decodes `%3D` to `=`
// https://github.com/sindresorhus/query-string/pull/37
var key = parts.shift();
var val = parts.length > 0 ? parts.join('=') : undefined;
key = decodeURIComponent(key);
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;
} else if (Array.isArray(ret[key])) {
ret[key].push(val);
} else {
ret[key] = [ret[key], val];
}
return ret;
}, {});
};
exports.stringify = function (obj) {
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (val === undefined) {
return '';
}
if (val === null) {
return key;
}
if (Array.isArray(val)) {
return val.slice().sort().map(function (val2) {
return strictUriEncode(key) + '=' + strictUriEncode(val2);
}).join('&');
}
return strictUriEncode(key) + '=' + strictUriEncode(val);
}).filter(function (x) {
return x.length > 0;
}).join('&') : '';
};
/***/ },
/* 62 */
/***/ function(module, exports) {
'use strict';
module.exports = function (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
});
};
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
/**
* 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.
*/
'use strict';
/**
* 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 = function() {};
if (true) {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// 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) {}
}
};
}
module.exports = warning;
/***/ }
/******/ ])
});
; |
public/assets/js/node_modules/react-redux-form/test/control-component-spec.js | ngocson8b/6jar | /* eslint react/no-multi-comp:0 react/jsx-no-bind:0 */
import { assert } from 'chai';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import { controls, formReducer, modelReducer, Control } from '../src';
function createTestStore(reducers) {
return applyMiddleware(thunk)(createStore)(combineReducers(reducers));
}
describe('<Control> component', () => {
it('should exist', () => {
assert.ok(Control);
});
it('should work as expected with a model (happy path)', () => {
const store = createTestStore({
test: modelReducer('test', { foo: 'bar' }),
testForm: formReducer('test', { foo: 'bar' }),
});
const form = TestUtils.renderIntoDocument(
<Provider store={store}>
<Control model="test.foo" mapProps={controls.text} component="input" />
</Provider>
);
const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input');
assert.ok(input);
});
});
|
assets/javascripts/kitten/components/interaction/upload/documents-status-box/index.js | KissKissBankBank/kitten | import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import classNames from 'classnames'
import COLORS from '../../../../constants/colors-config'
import { pxToRem } from '../../../../helpers/utils/typography'
import { Text } from '../../../typography/text'
import { ClockCircleIcon } from '../../../graphics/icons/clock-circle-icon'
import { CheckedCircleIcon } from '../../../graphics/icons/checked-circle-icon'
import { CrossCircleIcon } from '../../../graphics/icons/cross-circle-icon'
const StyledDocumentsStatusBox = styled.div`
border-radius: var(--border-radius-m);
padding: ${pxToRem(20)} ${pxToRem(30)};
width: 100%;
position: relative;
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
gap: ${pxToRem(30)};
.k-DocumentsStatusBox__fileList {
margin: 0;
padding: 0;
list-style: none;
display: block;
line-height: 1.4;
}
&.k-DocumentsStatusBox--wait {
background-color: ${COLORS.line1};
}
&.k-DocumentsStatusBox--accepted {
background-color: ${COLORS.valid1};
}
&.k-DocumentsStatusBox--denied {
background-color: ${COLORS.error2};
}
`
export const DocumentsStatusBox = ({
className,
fileList = [],
title = '',
status = 'wait',
message,
retryActionMessage = '',
retryAction = () => {},
}) => {
return (
<StyledDocumentsStatusBox
className={classNames(
'k-DocumentsStatusBox',
className,
`k-DocumentsStatusBox--${status}`,
)}
>
<div className="k-DrocumentDropUploader__icon">
{status === 'wait' && (
<ClockCircleIcon
color={COLORS.background1}
bgColor={COLORS.font1}
width={22}
height={22}
/>
)}
{status === 'accepted' && (
<CheckedCircleIcon
color={COLORS.background1}
bgColor={COLORS.valid}
width={22}
height={22}
/>
)}
{status === 'denied' && (
<CrossCircleIcon
color={COLORS.background1}
bgColor={COLORS.error}
width={22}
height={22}
/>
)}
</div>
<div className="k-DocumentsStatusBox__content">
<Text
as="p"
className="k-DocumentsStatusBox__title k-u-margin-top-none k-u-margin-bottom-noneHalf"
weight="regular"
size="small"
lineHeight="1"
>
{title}
</Text>
{fileList.length > 0 && (
<ul className="k-DocumentsStatusBox__fileList">
{fileList.map((file, index) => (
<Text
key={file + index}
as="li"
className="k-DocumentsStatusBox__fileName"
size="micro"
weight="light"
>
{file}
</Text>
))}
</ul>
)}
{!!message && (
<Text
as="p"
weight="regular"
size="micro"
className="k-DocumentsStatusBox__message k-u-margin-bottom-none k-u-margin-top-noneHalf"
lineHeight="1"
>
{message}
</Text>
)}
{status === 'denied' && (
<Text
as="button"
className="k-DocumentsStatusBox__button k-u-reset-button k-u-align-left k-u-margin-top-single"
weight="regular"
color="error"
type="button"
size="micro"
onClick={retryAction}
>
{retryActionMessage}
</Text>
)}
</div>
</StyledDocumentsStatusBox>
)
}
DocumentsStatusBox.propTypes = {
title: PropTypes.node,
message: PropTypes.node,
status: PropTypes.oneOf(['wait', 'accepted', 'denied']),
retryAction: PropTypes.func,
fileList: PropTypes.array,
}
|
src/js/components/icons/base/DocumentZip.js | odedre/grommet-final | /**
* @description DocumentZip SVG Icon.
* @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon.
* @property {string} colorIndex - The color identifier to use for the stroke color.
* If not specified, this component will default to muiTheme.palette.textColor.
* @property {xsmall|small|medium|large|xlarge|huge} size - The icon size. Defaults to small.
* @property {boolean} responsive - Allows you to redefine what the coordinates.
* @example
* <svg width="24" height="24" ><path d="M4.99787498,8.99999999 L4.99787498,0.999999992 L19.4999998,0.999999992 L22.9999998,4.50000005 L23,23 L4,23 M18,1 L18,6 L23,6 M2,13 L7,13 L7,14 L3,18 L3,19 L8,19 M11,12 L11,20 L11,12 Z M15,13 L15,20 L15,13 Z M20,15 C20,13.895 19.105,13 18,13 L15,13 L15,17 L18,17 C19.105,17 20,16.105 20,15 Z"/></svg>
*/
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import CSSClassnames from '../../../utils/CSSClassnames';
import Intl from '../../../utils/Intl';
import Props from '../../../utils/Props';
const CLASS_ROOT = CSSClassnames.CONTROL_ICON;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class Icon extends Component {
render () {
const { className, colorIndex } = this.props;
let { a11yTitle, size, responsive } = this.props;
let { intl } = this.context;
const classes = classnames(
CLASS_ROOT,
`${CLASS_ROOT}-document-zip`,
className,
{
[`${CLASS_ROOT}--${size}`]: size,
[`${CLASS_ROOT}--responsive`]: responsive,
[`${COLOR_INDEX}-${colorIndex}`]: colorIndex
}
);
a11yTitle = a11yTitle || Intl.getMessage(intl, 'document-zip');
const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));
return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M4.99787498,8.99999999 L4.99787498,0.999999992 L19.4999998,0.999999992 L22.9999998,4.50000005 L23,23 L4,23 M18,1 L18,6 L23,6 M2,13 L7,13 L7,14 L3,18 L3,19 L8,19 M11,12 L11,20 L11,12 Z M15,13 L15,20 L15,13 Z M20,15 C20,13.895 19.105,13 18,13 L15,13 L15,17 L18,17 C19.105,17 20,16.105 20,15 Z"/></svg>;
}
};
Icon.contextTypes = {
intl: PropTypes.object
};
Icon.defaultProps = {
responsive: true
};
Icon.displayName = 'DocumentZip';
Icon.icon = true;
Icon.propTypes = {
a11yTitle: PropTypes.string,
colorIndex: PropTypes.string,
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),
responsive: PropTypes.bool
};
|
src/Card/CardActions.js | ngbrown/material-ui | import React, {Component, PropTypes} from 'react';
function getStyles() {
return {
root: {
padding: 8,
position: 'relative',
},
action: {
marginRight: 8,
},
};
}
class CardActions extends Component {
static propTypes = {
/**
* If true, a click on this card component expands the card.
*/
actAsExpander: PropTypes.bool,
/**
* Can be used to render elements inside the Card Action.
*/
children: PropTypes.node,
/**
* If true, this card component is expandable.
*/
expandable: PropTypes.bool,
/**
* If true, this card component will include a button to expand the card.
*/
showExpandableButton: PropTypes.bool,
/**
* Override the inline-styles of the root element.
*/
style: PropTypes.object,
};
static contextTypes = {
muiTheme: PropTypes.object.isRequired,
};
render() {
const {prepareStyles} = this.context.muiTheme;
const styles = getStyles(this.props, this.context);
const children = React.Children.map(this.props.children, (child) => {
if (React.isValidElement(child)) {
return React.cloneElement(child, {
style: Object.assign({}, styles.action, child.props.style),
});
}
});
return (
<div {...this.props} style={prepareStyles(Object.assign(styles.root, this.props.style))}>
{children}
</div>
);
}
}
export default CardActions;
|
www/page-templates/index.js | KyleAMathews/react-headroom | import React from 'react'
import { Container } from 'react-responsive-grid'
import Headroom from '../../src/index'
import { rhythm } from 'utils/typography'
const IndexRoute = React.createClass({
propTypes () {
return {
children: React.PropTypes.any,
}
},
render () {
return (
<div style={{ marginBottom: rhythm(1) }}>
<Headroom
onPin={() => console.log('pinned')}
onUnpin={() => console.log('unpinned')}
wrapperStyle={{ marginBottom: rhythm(1) }}
style={{
background: 'rgb(57, 111, 176)',
boxShadow: '1px 1px 1px rgba(0,0,0,0.25)',
}}
>
<Container style={{ maxWidth: 960, padding: `${rhythm(1/2)}` }}>
<h1
style={{
margin: 0,
color: 'rgb(252, 253, 254)',
}}
>
React Headroom
</h1>
</Container>
</Headroom>
<Container
style={{
maxWidth: 960,
padding: `${rhythm(1)} ${rhythm(1/2)}`,
paddingTop: 0,
}}
>
<div dangerouslySetInnerHTML=
{{
__html: this.props.data.allMarkdown.edges[0].node.bodyHTML,
}}
/>
</Container>
</div>
)
},
})
export default IndexRoute
export const pageQuery = `
{
allMarkdown(first: 1) {
edges {
node {
bodyHTML
}
}
}
}
`
|
UpgradeIt/umbraco_client/Installer/Js/jquery.1.4.4.js | v-five/upgradeit | /*!
* jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Nov 11 19:04:53 2010 -0500
*/
(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"||
h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;
if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z],
z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j,
s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v=
s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)||
[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u,
false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,
a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=
c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===
1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "),
l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,
"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r=
a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b=
w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d===
"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}});
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i,
[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*"));
return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!==
B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()===
i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=
i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g,
"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]-
0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n===
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1;
for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"),
i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML;
c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},
not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a,
b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):
this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length-
1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b===
"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache=
false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset;
A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]=
encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",
[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),
e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});
if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",
3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",
d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,
d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)===
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L||
1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)}
var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;
for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+=
parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a,
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&&
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window);
/*!
* jQuery UI 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.6",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
* jQuery UI Widget 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Widget
*/
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
* jQuery UI Mouse 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Mouse
*
* Depends:
* jquery.ui.widget.js
*/
(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(a._preventClickEvent){a._preventClickEvent=false;b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&
this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();
return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&
this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=a.target==this._mouseDownEvent.target;this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-
a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
* jQuery UI Position 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Position
*/
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=m/2;
i.left=parseInt(i.left);i.top=parseInt(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=d>0?
b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;/*
* jQuery UI Progressbar 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function(b,c){b.widget("ui.progressbar",{options:{value:0},min:0,max:100,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===c)return this._value();this._setOption("value",a);return this},_setOption:function(a,d){if(a==="value"){this.options.value=d;this._refreshValue();this._trigger("change");this._value()===this.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.max,Math.max(this.min,a))},_refreshValue:function(){var a=
this.value();this.valueDiv.toggleClass("ui-corner-right",a===this.max).width(a+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.6"})})(jQuery);
; |
jrt/src/components/app.js | wizzardo/jrtorrent | import React from 'react';
import Header from './header';
import Home from '../routes/home';
import Dialog from "./Dialog";
const App = () => (
<div id="app">
<Header/>
<Home/>
<Dialog/>
</div>
)
export default App;
|
cerberus-dashboard/src/components/RoleSelect/RoleSelect.js | Nike-Inc/cerberus | /*
* Copyright (c) 2020 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'
import { Component } from 'react'
import Select from 'react-select'
export default class RoleSelect extends Component {
render() {
const {roles, value, onChange, handleBeingTouched, touched, error} = this.props
let options = roles.map(function(permission) {
let option = {label: permission.name, value: permission.id}
return option
});
let selected = options.find(option => option.value === value);
return (
<div className='role-select'>
<Select
className={((touched && error) ? 'category-select select-container-error' : 'category-select select-container')}
onChange = {(v) => { handleBeingTouched(); onChange(v)} }
onBlur={() => { handleBeingTouched() }}
placeholder="Select a permission"
value={selected}
options={options} />
{touched && error && <div className='select-error-msg'>{error}</div>}
</div>
)
}
} |
node_modules/react-icons/md/local-library.js | bairrada97/festival |
import React from 'react'
import Icon from 'react-icon-base'
const MdLocalLibrary = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m20 13.4c-2.7 0-5-2.3-5-5s2.3-5 5-5 5 2.2 5 5-2.3 5-5 5z m0 5.8c3.9-3.7 9.2-5.8 15-5.8v18.2c-5.8 0-11.1 2.3-15 6-3.9-3.7-9.2-6-15-6v-18.2c5.8 0 11.1 2.1 15 5.8z"/></g>
</Icon>
)
export default MdLocalLibrary
|
ajax/libs/falcor/0.0.12/Falcor.js | dc-js/cdnjs | /*!
* Copyright 2014 Netflix, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var falcor = require('./lib/falcor');
var get = require('./lib/get');
var set = require('./lib/set');
var inv = require('./lib/invalidate');
var prototype = falcor.Model.prototype;
prototype._getBoundValue = get.getBoundValue;
prototype._getValueSync = get.getValueSync;
prototype._getPathSetsAsValues = get.getAsValues;
prototype._getPathSetsAsJSON = get.getAsJSON;
prototype._getPathSetsAsPathMap = get.getAsPathMap;
prototype._getPathSetsAsJSONG = get.getAsJSONG;
prototype._getPathMapsAsValues = get.getAsValues;
prototype._getPathMapsAsJSON = get.getAsJSON;
prototype._getPathMapsAsPathMap = get.getAsPathMap;
prototype._getPathMapsAsJSONG = get.getAsJSONG;
prototype._setPathSetsAsJSON = set.setPathSetsAsJSON;
prototype._setPathSetsAsJSONG = set.setPathSetsAsJSONG;
prototype._setPathSetsAsPathMap = set.setPathSetsAsPathMap;
prototype._setPathSetsAsValues = set.setPathSetsAsValues;
prototype._setPathMapsAsJSON = set.setPathMapsAsJSON;
prototype._setPathMapsAsJSONG = set.setPathMapsAsJSONG;
prototype._setPathMapsAsPathMap = set.setPathMapsAsPathMap;
prototype._setPathMapsAsValues = set.setPathMapsAsValues;
prototype._setJSONGsAsJSON = set.setJSONGsAsJSON;
prototype._setJSONGsAsJSONG = set.setJSONGsAsJSONG;
prototype._setJSONGsAsPathMap = set.setJSONGsAsPathMap;
prototype._setJSONGsAsValues = set.setJSONGsAsValues;
prototype._invPathSetsAsJSON = inv.invPathSetsAsJSON;
prototype._invPathSetsAsJSONG = inv.invPathSetsAsJSONG;
prototype._invPathSetsAsPathMap = inv.invPathSetsAsPathMap;
prototype._invPathSetsAsValues = inv.invPathSetsAsValues;
// prototype._setCache = get.setCache;
prototype._setCache = set.setCache;
module.exports = falcor;
},{"./lib/falcor":5,"./lib/get":47,"./lib/invalidate":76,"./lib/set":84}],2:[function(require,module,exports){
if (typeof falcor === 'undefined') {
var falcor = {};
}
var Rx = require('rx');
falcor.__Internals = {};
falcor.Observable = Rx.Observable;
falcor.EXPIRES_NOW = 0;
falcor.EXPIRES_NEVER = 1;
/**
* The current semVer'd data version of falcor.
*/
falcor.dataVersion = '0.1.0';
falcor.now = function now() {
return Date.now();
};
falcor.NOOP = function() {};
module.exports = falcor;
},{"rx":165}],3:[function(require,module,exports){
var falcor = require('./Falcor');
var RequestQueue = require('./request/RequestQueue');
var ImmediateScheduler = require('./scheduler/ImmediateScheduler');
var TimeoutScheduler = require('./scheduler/TimeoutScheduler');
var ERROR = require("../types/error");
var ModelResponse = require('./ModelResponse');
var call = require('./operations/call');
var operations = require('./operations');
var pathSyntax = require('falcor-path-syntax');
var getBoundValue = require('./../get/getBoundValue');
var slice = Array.prototype.slice;
var $ref = require('./../types/path');
var $error = require('./../types/error');
var $sentinel = require('./../types/sentinel');
var Model = module.exports = falcor.Model = function Model(options) {
if (!options) {
options = {};
}
this._materialized = options.materialized || false;
this._boxed = options.boxed || false;
this._treatErrorsAsValues = options.treatErrorsAsValues || false;
this._dataSource = options.source;
this._maxSize = options.maxSize || Math.pow(2, 53) - 1;
this._collectRatio = options.collectRatio || 0.75;
this._scheduler = new ImmediateScheduler();
this._request = new RequestQueue(this, this._scheduler);
this._errorSelector = options.errorSelector || Model.prototype._errorSelector;
this._router = options.router;
this._root = options.root || {
expired: [],
allowSync: 0,
unsafeMode: false
};
if (options.cache && typeof options.cache === "object") {
this.setCache(options.cache);
} else {
this._cache = {};
}
this._path = [];
};
Model.EXPIRES_NOW = falcor.EXPIRES_NOW;
Model.EXPIRES_NEVER = falcor.EXPIRES_NEVER;
Model.ref = function(path) {
if (typeof path === 'string') {
path = pathSyntax(path);
}
return {$type: $ref, value: path};
};
Model.error = function(error) {
return {$type: $error, value: error};
};
Model.atom = function(value) {
return {$type: $sentinel, value: value};
};
Model.prototype = {
_boxed: false,
_progressive: false,
_errorSelector: function(x, y) { return y; },
get: operations("get"),
set: operations("set"),
invalidate: operations("invalidate"),
call: call,
getValue: function(path) {
return this.get(path, function(x) { return x; });
},
setValue: function(path, value) {
path = pathSyntax.fromPath(path);
return this.set(Array.isArray(path) ?
{path: path, value: value} :
path, function(x) { return x; });
},
bind: function(boundPath) {
var model = this, root = model._root,
paths = new Array(arguments.length - 1),
i = -1, n = arguments.length - 1;
boundPath = pathSyntax.fromPath(boundPath);
while(++i < n) {
paths[i] = pathSyntax.fromPath(arguments[i + 1]);
}
if(n === 0) { throw new Error("Model#bind requires at least one value path."); }
return falcor.Observable.create(function(observer) {
var boundModel;
root.allowSync++;
try {
boundModel = model.bindSync(model._path.concat(boundPath));
if (!boundModel) {
throw false;
}
observer.onNext(boundModel);
observer.onCompleted();
} catch (e) {
return model.get.apply(model, paths.map(function(path) {
return boundPath.concat(path);
}).concat(function(){})).subscribe(
function onNext() {},
function onError(err) { observer.onError(err); },
function onCompleted() {
root.allowSync++;
try {
boundModel = model.bindSync(boundPath);
if(boundModel) {
observer.onNext(boundModel);
}
observer.onCompleted();
} catch(e) {
observer.onError(e);
}
// remove the inc
finally {
root.allowSync--;
}
});
}
// remove the inc
finally {
root.allowSync--;
}
});
},
setCache: function(cache) {
return (this._cache = {}) && this._setCache(this, cache);
},
getCache: function() {
var pathmaps = [{}];
var tmpCache = this.boxValues().treatErrorsAsValues().materialize();
tmpCache._getPathMapsAsPathMap(tmpCache, [tmpCache._cache], pathmaps);
return pathmaps[0].json;
},
getValueSync: function(path) {
path = pathSyntax.fromPath(path);
if (Array.isArray(path) === false) {
throw new Error("Model#getValueSync must be called with an Array path.");
}
if (this._path.length) {
path = this._path.concat(path);
}
return this.syncCheck("getValueSync") && this._getValueSync(this, path).value;
},
setValueSync: function(path, value, errorSelector) {
path = pathSyntax.fromPath(path);
if(Array.isArray(path) === false) {
if(typeof errorSelector !== "function") {
errorSelector = value || this._errorSelector;
}
value = path.value;
path = path.path;
}
if(Array.isArray(path) === false) {
throw new Error("Model#setValueSync must be called with an Array path.");
}
if(this.syncCheck("setValueSync")) {
var json = {};
var tEeAV = this._treatErrorsAsValues;
var boxed = this._boxed;
this._treatErrorsAsValues = true;
this._boxed = true;
this._setPathSetsAsJSON(this, [{path: path, value: value}], [json], errorSelector);
this._treatErrorsAsValues = tEeAV;
this._boxed = boxed;
json = json.json;
if(json && json.$type === ERROR && !this._treatErrorsAsValues) {
if(this._boxed) {
throw json;
} else {
throw json.value;
}
} else if(this._boxed) {
return json;
}
return json && json.value;
}
},
bindSync: function(path) {
path = pathSyntax.fromPath(path);
if(Array.isArray(path) === false) {
throw new Error("Model#bindSync must be called with an Array path.");
}
var boundValue = this.syncCheck("bindSync") && getBoundValue(this, this._path.concat(path));
var node = boundValue.value;
path = boundValue.path;
if(boundValue.shorted) {
if(!!node) {
if(node.$type === ERROR) {
if(this._boxed) {
throw node;
}
throw node.value;
// throw new Error("Model#bindSync can\'t bind to or beyond an error: " + boundValue.toString());
}
}
return undefined;
} else if(!!node && node.$type === ERROR) {
if(this._boxed) {
throw node;
}
throw node.value;
}
return this.clone(["_path", boundValue.path]);
},
clone: function() {
var self = this;
var clone = new Model();
var key, keyValue;
var keys = Object.keys(self);
var keysIdx = -1;
var keysLen = keys.length;
while(++keysIdx < keysLen) {
key = keys[keysIdx];
clone[key] = self[key];
}
var argsIdx = -1;
var argsLen = arguments.length;
while(++argsIdx < argsLen) {
keyValue = arguments[argsIdx];
clone[keyValue[0]] = keyValue[1];
}
return clone;
},
batch: function(schedulerOrDelay) {
if(typeof schedulerOrDelay === "number") {
schedulerOrDelay = new TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));
} else if(!schedulerOrDelay || !schedulerOrDelay.schedule) {
schedulerOrDelay = new ImmediateScheduler();
}
return this.clone(["_request", new RequestQueue(this, schedulerOrDelay)]);
},
unbatch: function() {
return this.clone(["_request", new RequestQueue(this, new ImmediateScheduler())]);
},
treatErrorsAsValues: function() {
return this.clone(["_treatErrorsAsValues", true]);
},
materialize: function() {
return this.clone(["_materialized", true]);
},
boxValues: function() {
return this.clone(["_boxed", true]);
},
unboxValues: function() {
return this.clone(["_boxed", false]);
},
withoutDataSource: function() {
return this.clone(["_dataSource", null]);
},
syncCheck: function(name) {
if (!!this._dataSource && this._root.allowSync <= 0 && this._root.unsafeMode === false) {
throw new Error("Model#" + name + " may only be called within the context of a request selector.");
}
return true;
}
};
},{"../types/error":134,"./../get/getBoundValue":44,"./../types/error":134,"./../types/path":135,"./../types/sentinel":136,"./Falcor":2,"./ModelResponse":4,"./operations":11,"./operations/call":6,"./request/RequestQueue":36,"./scheduler/ImmediateScheduler":37,"./scheduler/TimeoutScheduler":38,"falcor-path-syntax":149}],4:[function(require,module,exports){
var falcor = require('./Falcor');
var pathSyntax = require('falcor-path-syntax');
if(typeof Promise !== "undefined" && Promise) {
falcor.Promise = Promise;
} else {
falcor.Promise = require("promise");
}
var Observable = falcor.Observable,
valuesMixin = { format: { value: "AsValues" } },
jsonMixin = { format: { value: "AsPathMap" } },
jsongMixin = { format: { value: "AsJSONG" } },
progressiveMixin = { operationIsProgressive: { value: true } };
function ModelResponse(forEach) {
this._subscribe = forEach;
}
ModelResponse.create = function(forEach) {
return new ModelResponse(forEach);
};
ModelResponse.fromOperation = function(model, args, selector, forEach) {
return new ModelResponse(function(observer) {
return forEach(Object.create(observer, {
operationModel: {value: model},
operationArgs: {value: pathSyntax.fromPathsOrPathValues(args)},
operationSelector: {value: selector}
}));
});
};
function noop() {}
function mixin(self) {
var mixins = Array.prototype.slice.call(arguments, 1);
return new ModelResponse(function(other) {
return self.subscribe(mixins.reduce(function(proto, mixin) {
return Object.create(proto, mixin);
}, other));
});
}
ModelResponse.prototype = Observable.create(noop);
ModelResponse.prototype.format = "AsPathMap";
ModelResponse.prototype.toPathValues = function() {
return mixin(this, valuesMixin);
};
ModelResponse.prototype.toJSON = function() {
return mixin(this, jsonMixin);
};
ModelResponse.prototype.progressively = function() {
return mixin(this, progressiveMixin);
};
ModelResponse.prototype.toJSONG = function() {
return mixin(this, jsongMixin);
};
ModelResponse.prototype.then = function(onNext, onError) {
var self = this;
return new falcor.Promise(function(resolve, reject) {
setTimeout(function() {
var value = undefined;
var error = undefined;
self.toArray().subscribe(
function(values) {
if(values.length <= 1) {
value = values[0];
} else {
value = values;
}
},
function(errors) {
if(errors.length <= 1) {
error = errors[0];
} else {
error = errors;
}
resolve = undefined;
},
function() {
if(!!resolve) {
resolve(value);
} else {
reject(error);
}
}
);
}, 0);
}).then(onNext, onError);
};
module.exports = ModelResponse;
},{"./Falcor":2,"falcor-path-syntax":149,"promise":155}],5:[function(require,module,exports){
var falcor = require('./Falcor');
var Model = require('./Model');
falcor.Model = Model;
module.exports = falcor;
},{"./Falcor":2,"./Model":3}],6:[function(require,module,exports){
module.exports = call;
var falcor = require("../../Falcor");
var ModelResponse = require('./../../ModelResponse');
function call(path, args, suffixes, paths, selector) {
var model = this;
args && Array.isArray(args) || (args = []);
suffixes && Array.isArray(suffixes) || (suffixes = []);
paths = Array.prototype.slice.call(arguments, 3);
if (typeof (selector = paths[paths.length - 1]) !== "function") {
selector = undefined;
} else {
paths = paths.slice(0, -1);
}
return ModelResponse.create(function (options) {
var rootModel = model.clone(["_path", []]),
localRoot = rootModel.withoutDataSource(),
dataSource = model._dataSource,
boundPath = model._path,
callPath = boundPath.concat(path),
thisPath = callPath.slice(0, -1);
var disposable = model.
getValue(path).
flatMap(function (localFn) {
if (typeof localFn === "function") {
return falcor.Observable.return(localFn.
apply(rootModel.bindSync(thisPath), args).
map(function (pathValue) {
return {
path: thisPath.concat(pathValue.path),
value: pathValue.value
};
}).
toArray().
flatMap(function (pathValues) {
return localRoot.set.
apply(localRoot, pathValues).
toJSONG();
}).
flatMap(function (envelope) {
return rootModel.get.apply(rootModel,
envelope.paths.reduce(function (paths, path) {
return paths.concat(suffixes.map(function (suffix) {
return path.concat(suffix);
}));
}, []).
concat(paths.reduce(function (paths, path) {
return paths.concat(thisPath.concat(path));
}, []))).
toJSONG();
}));
}
return falcor.Observable.empty();
}).
defaultIfEmpty(dataSource.call(path, args, suffixes, paths)).
mergeAll().
subscribe(function (envelope) {
var invalidated = envelope.invalidated;
if (invalidated && invalidated.length) {
invalidatePaths(rootModel, invalidated, undefined, model._errorSelector);
}
disposable = localRoot.
set(envelope, function () {
return model;
}).
subscribe(function (model) {
var getPaths = envelope.paths.map(function (path) {
return path.slice(boundPath.length);
});
if (selector) {
getPaths[getPaths.length] = function () {
return selector.call(model, getPaths);
};
}
disposable = model.get.apply(model, getPaths).subscribe(options);
});
});
return {
dispose: function () {
disposable && disposable.dispose();
disposable = undefined;
}
};
});
}
},{"../../Falcor":2,"./../../ModelResponse":4}],7:[function(require,module,exports){
var combineOperations = require('./../support/combineOperations');
var setSeedsOrOnNext = require('./../support/setSeedsOrOnNext');
/**
* The initial args that are passed into the async request pipeline.
* @see lib/falcor/operations/request.js for how initialArgs are used
*/
module.exports = function getInitialArgs(options, seeds, onNext) {
var seedRequired = options.format !== 'AsValues';
var isProgressive = options.operationIsProgressive;
var spreadOperations = false;
var operations =
combineOperations(
options.operationArgs, options.format, 'get',
spreadOperations, isProgressive);
setSeedsOrOnNext(
operations, seedRequired, seeds, onNext, options.operationSelector);
var requestOptions;
return [operations];
};
},{"./../support/combineOperations":22,"./../support/setSeedsOrOnNext":35}],8:[function(require,module,exports){
var getSourceObserver = require('./../support/getSourceObserever');
var partitionOperations = require('./../support/partitionOperations');
var mergeBoundPath = require('./../support/mergeBoundPath');
module.exports = getSourceRequest;
function getSourceRequest(
options, onNext, seeds, combinedResults, requestOptions, cb) {
var model = options.operationModel;
var boundPath = model._path;
var missingPaths = combinedResults.requestedMissingPaths;
if (boundPath.length) {
for (var i = 0; i < missingPaths.length; ++i) {
var pathSetIndex = missingPaths[i].pathSetIndex;
var path = missingPaths[i] = boundPath.concat(missingPaths[i]);
path.pathSetIndex = pathSetIndex;
}
}
return model._request.get(
missingPaths,
combinedResults.optimizedMissingPaths,
getSourceObserver(
model,
missingPaths,
function getSourceCallback(err, results) {
if (err) {
cb(err);
return;
}
// partitions the operations by their pathSetIndex
var partitionOperationsAndSeeds = partitionOperations(
results,
seeds,
options.format,
onNext);
// We allow for the rerequesting to happen.
cb(null, partitionOperationsAndSeeds);
}));
}
},{"./../support/getSourceObserever":23,"./../support/mergeBoundPath":27,"./../support/partitionOperations":30}],9:[function(require,module,exports){
var getInitialArgs = require('./getInitialArgs');
var getSourceRequest = require('./getSourceRequest');
var shouldRequest = require('./shouldRequest');
var request = require('./../request');
var processOperations = require('./../support/processOperations');
var get = request(
getInitialArgs,
getSourceRequest,
processOperations,
shouldRequest);
module.exports = get;
},{"./../request":14,"./../support/processOperations":32,"./getInitialArgs":7,"./getSourceRequest":8,"./shouldRequest":10}],10:[function(require,module,exports){
module.exports = function(model, combinedResults) {
return model._dataSource && combinedResults.requestedMissingPaths.length > 0;
};
},{}],11:[function(require,module,exports){
var ModelResponse = require('../ModelResponse');
var get = require('./get');
var set = require('./set');
var invalidate = require('./invalidate');
module.exports = function modelOperation(name) {
return function() {
var model = this, root = model._root,
args = Array.prototype.slice.call(arguments),
selector = args[args.length - 1];
if (typeof selector === 'function') {
args.pop();
} else {
selector = false;
}
var modelResponder;
switch (name) {
case 'get':
modelResponder = get;
break;
case 'set':
modelResponder = set;
break;
case 'invalidate':
modelResponder = invalidate;
break;
}
return ModelResponse.fromOperation(
model,
args,
selector,
modelResponder);
};
};
},{"../ModelResponse":4,"./get":9,"./invalidate":12,"./set":15}],12:[function(require,module,exports){
var invalidateInitialArgs = require('./invalidateInitialArgs');
var request = require('./../request');
var processOperations = require('./../support/processOperations');
var invalidate = request(
invalidateInitialArgs,
null,
processOperations);
module.exports = invalidate;
},{"./../request":14,"./../support/processOperations":32,"./invalidateInitialArgs":13}],13:[function(require,module,exports){
var combineOperations = require('./../support/combineOperations');
var setSeedsOrOnNext = require('./../support/setSeedsOrOnNext');
module.exports = function getInitialArgs(options, seeds, onNext) {
var seedRequired = options.format !== 'AsValues';
var operations = combineOperations(
options.operationArgs, options.format, 'inv');
setSeedsOrOnNext(
operations, seedRequired, seeds,
onNext, options.operationSelector);
return [operations, seeds];
};
},{"./../support/combineOperations":22,"./../support/setSeedsOrOnNext":35}],14:[function(require,module,exports){
var setSeedsOrOnNext = require('./support/setSeedsOrOnNext');
var onNextValues = require('./support/onNextValue');
var onCompletedOrError = require('./support/onCompletedOrError');
var primeSeeds = require('./support/primeSeeds');
var autoFalse = function() { return false; };
module.exports = request;
function request(initialArgs, sourceRequest, processOperations, shouldRequestFn) {
if (!shouldRequestFn) {
shouldRequestFn = autoFalse;
}
return function innerRequest(options) {
var selector = options.operationSelector;
var model = options.operationModel;
var args = options.operationArgs;
var onNext = options.onNext.bind(options);
var onError = options.onError.bind(options);
var onCompleted = options.onCompleted.bind(options);
var isProgressive = options.operationIsProgressive;
var errorSelector = model._errorSelector;
var selectorLength = selector && selector.length || 0;
// State variables
var errors = [];
var format = options.format = selector && 'AsJSON' ||
options.format || 'AsPathMap';
var toJSONG = format === 'AsJSONG';
var toJSON = format === 'AsPathMap';
var toPathValues = format === 'AsValues';
var seedRequired = toJSON || toJSONG || selector;
var boundPath = model._path;
var i, len;
var foundValue = false;
var seeds = primeSeeds(selector, selectorLength);
var loopCount = 0;
function recurse(operations, opts) {
if (loopCount > 50) {
throw 'Loop Kill switch thrown.';
}
var combinedResults = processOperations(
model,
operations,
errorSelector,
opts);
foundValue = foundValue || combinedResults.valuesReceived;
if (combinedResults.errors.length) {
errors = errors.concat(combinedResults.errors);
}
// if in progressiveMode, values are emitted
// each time through the recurse loop. This may have
// to change when the router is considered.
if (isProgressive && !toPathValues) {
onNextValues(model, onNext, seeds, selector);
}
// Performs the recursing via dataSource
if (shouldRequestFn(model, combinedResults, loopCount)) {
sourceRequest(
options,
onNext,
seeds,
combinedResults,
opts,
function onCompleteFromSourceSet(err, results) {
if (err) {
errors = errors.concat(err);
recurse([], seeds);
return;
}
++loopCount;
// We continue to string the opts through
recurse(results, opts);
});
}
// Else we need to onNext values and complete/error.
else {
if (!toPathValues && !isProgressive && foundValue) {
onNextValues(model, onNext, seeds, selector);
}
onCompletedOrError(onCompleted, onError, errors);
}
}
try {
recurse.apply(null,
initialArgs(options, seeds, onNext));
} catch(e) {
errors = [e];
onCompletedOrError(onCompleted, onError, errors);
}
};
}
},{"./support/onCompletedOrError":28,"./support/onNextValue":29,"./support/primeSeeds":31,"./support/setSeedsOrOnNext":35}],15:[function(require,module,exports){
var setInitialArgs = require('./setInitialArgs');
var setSourceRequest = require('./setSourceRequest');
var request = require('./../request');
var setProcessOperations = require('./setProcessOperations');
var shouldRequest = require('./shouldRequest');
var set = request(
setInitialArgs,
setSourceRequest,
setProcessOperations,
shouldRequest);
module.exports = set;
},{"./../request":14,"./setInitialArgs":16,"./setProcessOperations":17,"./setSourceRequest":18,"./shouldRequest":19}],16:[function(require,module,exports){
var combineOperations = require('./../support/combineOperations');
var setSeedsOrOnNext = require('./../support/setSeedsOrOnNext');
var Formats = require('./../support/Formats');
var toPathValues = Formats.toPathValues;
var toJSONG = Formats.toJSONG;
module.exports = function setInitialArgs(options, seeds, onNext) {
var isPathValues = options.format === toPathValues;
var seedRequired = !isPathValues;
var shouldRequest = !!options.operationModel._dataSource;
var format = options.format;
var args = options.operationArgs;
var selector = options.operationSelector;
var isProgressive = options.operationIsProgressive;
var firstSeeds, operations;
var requestOptions = {
removeBoundPath: shouldRequest
};
// If Model is a slave, in shouldRequest mode,
// a single seed is required to accumulate the jsong results.
if (shouldRequest) {
operations =
combineOperations(args, toJSONG, 'set', selector, false);
firstSeeds = [{}];
setSeedsOrOnNext(
operations, true, firstSeeds, false, options.selector);
// we must keep track of the set seeds.
requestOptions.requestSeed = firstSeeds[0];
}
// This model is the master, therefore a regular set can be performed.
else {
firstSeeds = seeds;
operations = combineOperations(args, format, 'set');
setSeedsOrOnNext(
operations, seedRequired, seeds, onNext, options.operationSelector);
}
// We either have to construct the master operations if
// the ModelResponse is isProgressive
// the ModelResponse is toPathValues
// but luckily we can just perform a get for the progressive or
// toPathValues mode.
if (isProgressive || isPathValues) {
var getOps = combineOperations(
args, format, 'get', selector, true);
setSeedsOrOnNext(
getOps, seedRequired, seeds, onNext, options.operationSelector);
operations = operations.concat(getOps);
requestOptions.isProgressive = true;
}
return [operations, requestOptions];
};
},{"./../support/Formats":20,"./../support/combineOperations":22,"./../support/setSeedsOrOnNext":35}],17:[function(require,module,exports){
var processOperations = require('./../support/processOperations');
var combineOperations = require('./../support/combineOperations');
var mergeBoundPath = require('./../support/mergeBoundPath');
var Formats = require('./../support/Formats');
var toPathValues = Formats.toPathValues;
module.exports = setProcessOperations;
function setProcessOperations(model, operations, errorSelector, requestOptions) {
var boundPath = model._path;
var hasBoundPath = boundPath.length > 0;
var removeBoundPath = requestOptions && requestOptions.removeBoundPath;
var isProgressive = requestOptions && requestOptions.isProgressive;
var progressiveOperations;
// if in progressive mode, then the progressive operations
// need to be executed but the bound path must stay intact.
if (isProgressive && removeBoundPath && hasBoundPath) {
progressiveOperations = operations.filter(function(op) {
return op.isProgressive;
});
operations = operations.filter(function(op) {
return !op.isProgressive;
});
}
if (removeBoundPath && hasBoundPath) {
model._path = [];
// For every operations arguments, the bound path must be adjusted.
for (var i = 0, opLen = operations.length; i < opLen; i++) {
var args = operations[i].args;
for (var j = 0, argsLen = args.length; j < argsLen; j++) {
args[j] = mergeBoundPath(args[j], boundPath);
}
}
}
var results = processOperations(model, operations, errorSelector);
// Undo what we have done to the model's bound path.
if (removeBoundPath && hasBoundPath) {
model._path = boundPath;
}
// executes the progressive ops
if (progressiveOperations) {
processOperations(model, progressiveOperations, errorSelector);
}
return results;
}
},{"./../support/Formats":20,"./../support/combineOperations":22,"./../support/mergeBoundPath":27,"./../support/processOperations":32}],18:[function(require,module,exports){
var getSourceObserver = require('./../support/getSourceObserever');
var combineOperations = require('./../support/combineOperations');
var setSeedsOrOnNext = require('./../support/setSeedsOrOnNext');
var toPathValues = require('./../support/Formats').toPathValues;
module.exports = setSourceRequest;
function setSourceRequest(
options, onNext, seeds, combinedResults, requestOptions, cb) {
var model = options.operationModel;
var seedRequired = options.format !== toPathValues;
var requestSeed = requestOptions.requestSeed;
return model._request.set(
requestSeed,
getSourceObserver(
model,
requestSeed.paths,
function setSourceRequestCB(err, results) {
if (err) {
cb(err);
}
// Sets the results into the model.
model._setJSONGsAsJSON(model, [results], []);
// Gets the original paths / maps back out.
var operations = combineOperations(
options.operationArgs, options.format, 'get');
setSeedsOrOnNext(
operations, seedRequired,
seeds, onNext, options.operationSelector);
// unset the removeBoundPath.
requestOptions.removeBoundPath = false;
cb(null, operations);
}));
}
},{"./../support/Formats":20,"./../support/combineOperations":22,"./../support/getSourceObserever":23,"./../support/setSeedsOrOnNext":35}],19:[function(require,module,exports){
// Set differs from get in the sense that the first time through
// the recurse loop a server operation must be performed if it can be.
module.exports = function(model, combinedResults, loopCount) {
return model._dataSource && (
combinedResults.requestedMissingPaths.length > 0 ||
loopCount === 0);
};
},{}],20:[function(require,module,exports){
module.exports = {
toPathValues: 'AsValues',
toJSON: 'AsPathMap',
toJSONG: 'AsJSONG',
selector: 'AsJSON',
};
},{}],21:[function(require,module,exports){
module.exports = function buildJSONGOperation(format, seeds, jsongOp, seedOffset, onNext) {
return {
methodName: '_setJSONGs' + format,
format: format,
isValues: format === 'AsValues',
onNext: onNext,
seeds: seeds,
seedsOffset: seedOffset,
args: [jsongOp]
};
};
},{}],22:[function(require,module,exports){
var isSeedRequired = require('./seedRequired');
var isJSONG = require('./isJSONG');
var isPathOrPathValue = require('./isPathOrPathValue');
var Formats = require('./Formats');
var toSelector = Formats.selector;
module.exports = function combineOperations(args, format, name, spread, isProgressive) {
var seedRequired = isSeedRequired(format);
var isValues = !seedRequired;
var hasSelector = seedRequired && format === toSelector;
var seedsOffset = 0;
return args.
reduce(function(groups, argument) {
var group = groups[groups.length - 1];
var type = isPathOrPathValue(argument) ? "PathSets" :
isJSONG(argument) ? "JSONGs" : "PathMaps";
var groupType = group && group.type;
var methodName = '_' + name + type + format;
if (!groupType || type !== groupType || spread) {
group = {
methodName: methodName,
format: format,
operation: name,
isValues: isValues,
seeds: [],
onNext: null,
seedsOffset: seedsOffset,
isProgressive: isProgressive,
type: type,
args: []
};
groups.push(group);
}
if (hasSelector) {
++seedsOffset;
}
group.args.push(argument);
return groups;
}, []);
};
},{"./Formats":20,"./isJSONG":25,"./isPathOrPathValue":26,"./seedRequired":33}],23:[function(require,module,exports){
var insertErrors = require('./insertErrors.js');
/**
* creates the model source observer
* @param {Model} model
* @param {Array.<Array>} requestedMissingPaths
* @param {Function} cb
*/
function getSourceObserver(model, requestedMissingPaths, cb) {
var incomingValues;
return {
onNext: function(jsongEnvelop) {
incomingValues = {
jsong: jsongEnvelop.jsong,
paths: requestedMissingPaths
};
},
onError: function(err) {
cb(insertErrors(model, requestedMissingPaths, err));
},
onCompleted: function() {
cb(false, incomingValues);
}
};
}
module.exports = getSourceObserver;
},{"./insertErrors.js":24}],24:[function(require,module,exports){
/**
* will insert the error provided for every requestedPath.
* @param {Model} model
* @param {Array.<Array>} requestedPaths
* @param {Object} err
*/
module.exports = function insertErrors(model, requestedPaths, err) {
var out = model._setPathSetsAsJSON.apply(null, [model].concat(
requestedPaths.
reduce(function(acc, r) {
acc[0].push({
path: r,
value: err
});
return acc;
}, [[]]),
[],
model._errorSelector
));
return out.errors;
};
},{}],25:[function(require,module,exports){
module.exports = function isJSONG(x) {
return x.hasOwnProperty("jsong");
};
},{}],26:[function(require,module,exports){
module.exports = function isPathOrPathValue(x) {
return !!(Array.isArray(x)) || (
x.hasOwnProperty("path") && x.hasOwnProperty("value"));
};
},{}],27:[function(require,module,exports){
var isJSONG = require('./isJSONG');
var isPathValue = require('./isPathOrPathValue');
module.exports = mergeBoundPath;
function mergeBoundPath(arg, boundPath) {
return isJSONG(arg) && mergeBoundPathIntoJSONG(arg, boundPath) ||
isPathValue(arg) && mergeBoundPathIntoPathValue(arg, boundPath) ||
mergeBoundPathIntoJSON(arg, boundPath);
}
function mergeBoundPathIntoJSONG(jsongEnv, boundPath) {
var newJSONGEnv = {jsong: jsongEnv.jsong, paths: jsongEnv.paths};
if (boundPath.length) {
var paths = [];
for (i = 0, len = jsongEnv.paths.length; i < len; i++) {
paths[i] = boundPath.concat(jsongEnv.paths[i]);
}
newJSONGEnv.paths = paths;
}
return newJSONGEnv;
}
function mergeBoundPathIntoJSON(arg, boundPath) {
var newArg = arg;
if (boundPath.length) {
newArg = {};
for (var i = 0, len = boundPath.length - 1; i < len; i++) {
newArg[boundPath[i]] = {};
}
newArg[boundPath[i]] = arg;
}
return newArg;
}
function mergeBoundPathIntoPathValue(arg, boundPath) {
return {
path: boundPath.concat(arg.path),
value: arg.value
};
}
},{"./isJSONG":25,"./isPathOrPathValue":26}],28:[function(require,module,exports){
module.exports = function onCompletedOrError(onCompleted, onError, errors) {
if (errors.length) {
onError(errors);
} else {
onCompleted();
}
};
},{}],29:[function(require,module,exports){
/**
* will onNext the observer with the seeds provided.
* @param {Model} model
* @param {Function} onNext
* @param {Array.<Object>} seeds
* @param {Function} [selector]
*/
module.exports = function onNextValues(model, onNext, seeds, selector) {
var root = model._root;
root.allowSync++;
try {
if (selector) {
if (seeds.length) {
// they should be wrapped in json items
onNext(selector.apply(model, seeds.map(function(x, i) {
return x.json;
})));
} else {
onNext(selector.call(model));
}
} else {
// this means there is an onNext function that is not AsValues or progressive,
// therefore there must only be one onNext call, which should only be the 0
// index of the values of the array
onNext(seeds[0]);
}
} catch(e) {
} finally {
root.allowSync--;
}
};
},{}],30:[function(require,module,exports){
var buildJSONGOperation = require('./buildJSONGOperation');
/**
* It performs the opposite of combine operations. It will take a JSONG
* response and partition them into the required amount of operations.
* @param {{jsong: {}, paths:[]}} jsongResponse
*/
module.exports = partitionOperations;
function partitionOperations(
jsongResponse, seeds, format, onNext) {
var partitionedOps = [];
var requestedMissingPaths = jsongResponse.paths;
if (format === 'AsJSON') {
// fast collapse ass the requestedMissingPaths into their
// respective groups
var opsFromRequestedMissingPaths = [];
var op = null;
for (var i = 0, len = requestedMissingPaths.length; i < len; i++) {
var missingPath = requestedMissingPaths[i];
if (!op || op.idx !== missingPath.pathSetIndex) {
op = {
idx: missingPath.pathSetIndex,
paths: []
};
opsFromRequestedMissingPaths.push(op);
}
op.paths.push(missingPath);
}
opsFromRequestedMissingPaths.forEach(function(op, i) {
var seed = [seeds[op.idx]];
var jsong = {
jsong: jsongResponse.jsong,
paths: op.paths
};
partitionedOps.push(buildJSONGOperation(
format,
seed,
jsong,
op.idx,
onNext));
});
} else {
partitionedOps[0] = buildJSONGOperation(format, seeds, jsongResponse, 0, onNext);
}
return partitionedOps;
}
},{"./buildJSONGOperation":21}],31:[function(require,module,exports){
module.exports = function primeSeeds(selector, selectorLength) {
var seeds = [];
if (selector) {
for (i = 0; i < selectorLength; i++) {
seeds.push({});
}
} else {
seeds[0] = {};
}
return seeds;
};
},{}],32:[function(require,module,exports){
module.exports = function processOperations(model, operations, errorSelector, boundPath) {
return operations.reduce(function(memo, operation) {
var jsonGraphOperation = model[operation.methodName];
var seedsOrFunction = operation.isValues ?
operation.onNext : operation.seeds;
var results = jsonGraphOperation(
model,
operation.args,
seedsOrFunction,
operation.onNext,
errorSelector,
boundPath);
var missing = results.requestedMissingPaths;
var offset = operation.seedsOffset;
for (var i = 0, len = missing.length; i < len; i++) {
missing[i].boundPath = boundPath;
missing[i].pathSetIndex += offset;
}
memo.requestedMissingPaths = memo.requestedMissingPaths.concat(missing);
memo.optimizedMissingPaths = memo.optimizedMissingPaths.concat(results.optimizedMissingPaths);
memo.errors = memo.errors.concat(results.errors);
memo.valuesReceived = memo.valuesReceived || results.requestedPaths.length > 0;
return memo;
}, {
errors: [],
requestedMissingPaths: [],
optimizedMissingPaths: [],
valuesReceived: false
});
}
},{}],33:[function(require,module,exports){
module.exports = function isSeedRequired(format) {
return format === 'AsJSON' || format === 'AsJSONG' || format === 'AsPathMap';
};
},{}],34:[function(require,module,exports){
module.exports = function setSeedsOnGroups(groups, seeds, hasSelector) {
var valueIndex = 0;
var seedsLength = seeds.length;
var j, i, len = groups.length, gLen, group;
if (hasSelector) {
for (i = 0; i < len && valueIndex < seedsLength; i++) {
group = groups[i];
gLen = gLen = group.args.length;
for (j = 0; j < gLen && valueIndex < seedsLength; j++, valueIndex++) {
group.seeds.push(seeds[valueIndex]);
}
}
} else {
for (i = 0; i < len && valueIndex < seedsLength; i++) {
groups[i].seeds = seeds;
}
}
}
},{}],35:[function(require,module,exports){
var setSeedsOnGroups = require('./setSeedsOnGroups');
module.exports = function setSeedsOrOnNext(operations, seedRequired, seeds, onNext, selector) {
if (seedRequired) {
setSeedsOnGroups(operations, seeds, selector);
} else {
for (i = 0; i < operations.length; i++) {
operations[i].onNext = onNext;
}
}
};
},{"./setSeedsOnGroups":34}],36:[function(require,module,exports){
var falcor = require('./../Falcor');
var NOOP = falcor.NOOP;
var RequestQueue = function(jsongModel, scheduler) {
this._scheduler = scheduler;
this._jsongModel = jsongModel;
this._scheduled = false;
this._requests = [];
};
RequestQueue.prototype = {
_get: function() {
var i = -1;
var requests = this._requests;
while (++i < requests.length) {
if (!requests[i].pending && requests[i].isGet) {
return requests[i];
}
}
return requests[requests.length] = new GetRequest(this._jsongModel, this);
},
_set: function() {
var i = -1;
var requests = this._requests;
// TODO: Set always sends off a request immediately, so there is no batching.
while (++i < requests.length) {
if (!requests[i].pending && requests[i].isSet) {
return requests[i];
}
}
return requests[requests.length] = new SetRequest(this._jsongModel, this);
},
remove: function(request) {
for (var i = this._requests.length - 1; i > -1; i--) {
if (this._requests[i].id === request.id && this._requests.splice(i, 1)) {
break;
}
}
},
set: function(jsongEnv, observer) {
var self = this;
var disposable = self._set().batch(jsongEnv, observer).flush();
return {
dispose: function() {
disposable.dispose();
}
};
},
get: function(requestedPaths, optimizedPaths, observer) {
var self = this;
var disposable = null;
// TODO: get does not batch across requests.
self._get().batch(requestedPaths, optimizedPaths, observer);
if (!self._scheduled) {
self._scheduled = true;
disposable = self._scheduler.schedule(self._flush.bind(self));
}
return {
dispose: function() {
disposable.dispose();
}
};
},
_flush: function() {
this._scheduled = false;
var requests = this._requests, i = -1;
var disposables = [];
while (++i < requests.length) {
if (!requests[i].pending) {
disposables[disposables.length] = requests[i].flush();
}
}
return {
dispose: function() {
disposables.forEach(function(d) { d.dispose(); });
}
};
}
};
var REQUEST_ID = 0;
var SetRequest = function(model, queue) {
var self = this;
self._jsongModel = model;
self._queue = queue;
self.observers = [];
self.jsongEnvs = [];
self.pending = false;
self.id = ++REQUEST_ID;
self.isSet = true;
};
SetRequest.prototype = {
batch: function(jsongEnv, observer) {
var self = this;
observer.onNext = observer.onNext || NOOP;
observer.onError = observer.onError || NOOP;
observer.onCompleted = observer.onCompleted || NOOP;
if (!observer.__observerId) {
observer.__observerId = ++REQUEST_ID;
}
observer._requestId = self.id;
self.observers[self.observers.length] = observer;
self.jsongEnvs[self.jsongEnvs.length] = jsongEnv;
return self;
},
flush: function() {
var incomingValues, query, op, len;
var self = this;
var jsongs = self.jsongEnvs;
var observers = self.observers;
var model = self._jsongModel;
self.pending = true;
// TODO: Set does not batch.
return model._dataSource.
set(jsongs[0]).
subscribe(function(response) {
incomingValues = response;
}, function(err) {
var i = -1;
var n = observers.length;
while (++i < n) {
obs = observers[i];
obs.onError && obs.onError(err);
}
}, function() {
var i, n, obs;
self._queue.remove(self);
i = -1;
n = observers.length;
while (++i < n) {
obs = observers[i];
obs.onNext && obs.onNext({
jsong: incomingValues.jsong || incomingValues.value,
paths: incomingValues.paths
});
obs.onCompleted && obs.onCompleted();
}
});
}
};
var GetRequest = function(jsongModel, queue) {
var self = this;
self._jsongModel = jsongModel;
self._queue = queue;
self.observers = [];
self.optimizedPaths = [];
self.requestedPaths = [];
self.pending = false;
self.id = ++REQUEST_ID;
self.isGet = true;
};
GetRequest.prototype = {
batch: function(requestedPaths, optimizedPaths, observer) {
// TODO: Do we need to gap fill?
var self = this;
observer.onNext = observer.onNext || NOOP;
observer.onError = observer.onError || NOOP;
observer.onCompleted = observer.onCompleted || NOOP;
if (!observer.__observerId) {
observer.__observerId = ++REQUEST_ID;
}
observer._requestId = self.id;
self.observers[self.observers.length] = observer;
self.optimizedPaths[self.optimizedPaths.length] = optimizedPaths;
self.requestedPaths[self.requestedPaths.length] = requestedPaths;
return self;
},
flush: function() {
var incomingValues, query, op, len;
var self = this;
var requested = self.requestedPaths;
var optimized = self.optimizedPaths;
var observers = self.observers;
var disposables = [];
var results = [];
var model = self._jsongModel;
self._scheduled = false;
self.pending = true;
var optimizedMaps = {};
var requestedMaps = {};
var r, o, i, j, obs, resultIndex;
for (i = 0, len = requested.length; i < len; i++) {
r = requested[i];
o = optimized[i];
obs = observers[i];
for (j = 0; j < r.length; j++) {
pathsToMapWithObservers(r[j], 0, readyNode(requestedMaps, null, obs), obs);
pathsToMapWithObservers(o[j], 0, readyNode(optimizedMaps, null, obs), obs);
}
}
return model._dataSource.
get(collapse(optimizedMaps)).
subscribe(function(response) {
incomingValues = response;
}, function(err) {
var i = -1;
var n = observers.length;
while (++i < n) {
obs = observers[i];
obs.onError && obs.onError(err);
}
}, function() {
var i, n, obs;
self._queue.remove(self);
i = -1;
n = observers.length;
while (++i < n) {
obs = observers[i];
obs.onNext && obs.onNext({
jsong: incomingValues.jsong || incomingValues.value,
paths: incomingValues.paths
});
obs.onCompleted && obs.onCompleted();
}
});
},
// Returns the paths that are contained within this request.
contains: function(requestedPaths, optimizedPaths) {
// TODO:
}
};
function pathsToMapWithObservers(path, idx, branch, observer) {
var curr = path[idx];
// Object / Array
if (typeof curr === 'object') {
if (Array.isArray(curr)) {
curr.forEach(function(v) {
readyNode(branch, v, observer);
if (path.length > idx + 1) {
pathsToMapWithObservers(path, idx + 1, branch[v], observer);
}
});
} else {
var from = curr.from || 0;
var to = curr.to >= 0 ? curr.to : curr.length;
for (var i = from; i <= to; i++) {
readyNode(branch, i, observer);
if (path.length > idx + 1) {
pathsToMapWithObservers(path, idx + 1, branch[i], observer);
}
}
}
} else {
readyNode(branch, curr, observer);
if (path.length > idx + 1) {
pathsToMapWithObservers(path, idx + 1, branch[curr], observer);
}
}
}
/**
* Builds the set of collapsed
* queries by traversing the tree
* once
*/
var charPattern = /\D/i;
function readyNode(branch, key, observer) {
if (key === null) {
branch.__observers = branch.__observers || [];
!containsObserver(branch.__observers, observer) && branch.__observers.push(observer);
return branch;
}
if (!branch[key]) {
branch[key] = {__observers: []};
}
!containsObserver(branch[key].__observers, observer) && branch[key].__observers.push(observer);
return branch;
}
function containsObserver(observers, observer) {
if (!observer) {
return;
}
return observers.reduce(function(acc, x) {
return acc || x.__observerId === observer.__observerId;
}, false);
}
function collapse(pathMap) {
return rangeCollapse(buildQueries(pathMap));
}
/**
* Collapse ranges, e.g. when there is a continuous range
* in an array, turn it into an object instead
*
* [1,2,3,4,5,6] => {"from":1, "to":6}
*
*/
function rangeCollapse(paths) {
paths.forEach(function (path) {
path.forEach(function (elt, index) {
var range;
if (Array.isArray(elt) && elt.every(isNumber) && allUnique(elt)) {
elt.sort(function(a, b) {
return a - b;
});
if (elt[elt.length-1] - elt[0] === elt.length-1) {
// create range
range = {};
range.from = elt[0];
range.to = elt[elt.length-1];
path[index] = range;
}
}
});
});
return paths;
}
/* jshint forin: false */
function buildQueries(root) {
if (root == null || typeof root !== 'object') {
return [ [] ];
}
var children = Object.keys(root).filter(notPathMapInternalKeys),
child, memo, paths, key, childIsNum,
list, head, tail, clone, results,
i = -1, n = children.length,
j, k, x;
if (n === 0 || Array.isArray(root) === true) {
return [ [] ];
}
memo = {};
while(++i < n) {
child = children[i];
paths = buildQueries(root[child]);
key = createKey(paths);
childIsNum = typeof child === 'string' && !charPattern.test(child);
if ((list = memo[key]) && (head = list.head)) {
head[head.length] = childIsNum ? parseInt(child, 10) : child;
} else {
memo[key] = {
head: [childIsNum ? parseInt(child, 10) : child],
tail: paths
};
}
}
results = [];
for(x in memo) {
head = (list = memo[x]).head;
tail = list.tail;
i = -1;
n = tail.length;
while(++i < n) {
list = tail[i];
j = -1;
k = list.length;
if(head[0] === '') {
clone = [];
} else {
clone = [head.length === 1 ? head[0] : head];
while(++j < k) {
clone[j + 1] = list[j];
}
}
results[results.length] = clone;
}
}
return results;
}
function notPathMapInternalKeys(key) {
return (
key !== "__observers" &&
key !== "__pending" &&
key !== "__batchID"
);
}
/**
* Return true if argument is a number
*/
function isNumber(val) {
return typeof val === "number";
}
/**
* allUnique
* return true if every number in an array is unique
*/
function allUnique(arr) {
var hash = {},
index,
len;
for (index = 0, len = arr.length; index < len; index++) {
if (hash[arr[index]]) {
return false;
}
hash[arr[index]] = true;
}
return true;
}
/**
* Sort a list-of-lists
* Used for generating a unique hash
* key for each subtree; used by the
* memoization
*/
function sortLol(lol) {
return lol.reduce(function (result, curr) {
if (curr instanceof Array) {
result.push(sortLol(curr).slice(0).sort());
return result;
}
return result.concat(curr);
}, []).slice(0).sort();
}
/**
* Create a unique hash key for a set
* of paths
*/
function createKey(list) {
return JSON.stringify(sortLol(list));
}
// Note: For testing
falcor.__Internals.buildQueries = buildQueries;
module.exports = RequestQueue;
},{"./../Falcor":2}],37:[function(require,module,exports){
function ImmediateScheduler() {
}
ImmediateScheduler.prototype = {
schedule: function(action) {
action();
}
};
module.exports = ImmediateScheduler;
},{}],38:[function(require,module,exports){
function TimeoutScheduler(delay) {
this.delay = delay;
}
TimeoutScheduler.prototype = {
schedule: function(action) {
setTimeout(action, this.delay);
}
};
module.exports = TimeoutScheduler;
},{}],39:[function(require,module,exports){
var hardLink = require('./util/hardlink');
var createHardlink = hardLink.create;
var onValue = require('./onValue');
var isExpired = require('./util/isExpired');
var $path = require('./../types/path.js');
var __context = require("../internal/context");
function followReference(model, root, node, referenceContainer, reference, seed, outputFormat) {
var depth = 0;
var k, next;
while (true) {
if (depth === 0 && referenceContainer[__context]) {
depth = reference.length;
next = referenceContainer[__context];
} else {
k = reference[depth++];
next = node[k];
}
if (next) {
var type = next.$type;
var value = type && next.value || next;
if (depth < reference.length) {
if (type) {
node = next;
break;
}
node = next;
continue;
}
// We need to report a value or follow another reference.
else {
node = next;
if (type && isExpired(next)) {
break;
}
if (!referenceContainer[__context]) {
createHardlink(referenceContainer, next);
}
// Restart the reference follower.
if (type === $path) {
if (outputFormat === 'JSONG') {
onValue(model, next, seed, null, null, reference, null, outputFormat);
}
depth = 0;
reference = value;
referenceContainer = next;
node = root;
continue;
}
break;
}
} else {
node = undefined;
}
break;
}
if (depth < reference.length && node !== undefined) {
var ref = [];
for (var i = 0; i < depth; i++) {
ref[i] = reference[i];
}
reference = ref;
}
return [node, reference];
}
module.exports = followReference;
},{"../internal/context":61,"./../types/path.js":135,"./onValue":51,"./util/hardlink":53,"./util/isExpired":54}],40:[function(require,module,exports){
var getBoundValue = require('./getBoundValue');
var isPathValue = require('./util/isPathValue');
module.exports = function(walk) {
return function getAsJSON(model, paths, values) {
var results = {
values: [],
errors: [],
requestedPaths: [],
optimizedPaths: [],
requestedMissingPaths: [],
optimizedMissingPaths: []
};
var requestedMissingPaths = results.requestedMissingPaths;
var inputFormat = Array.isArray(paths[0]) || isPathValue(paths[0]) ?
'Paths' : 'JSON';
var cache = model._cache;
var boundPath = model._path;
var currentCachePosition;
var missingIdx = 0;
var boundOptimizedPath, optimizedPath;
var i, j, len, bLen;
results.values = values;
if (!values) {
values = [];
}
if (boundPath.length) {
var boundValue = getBoundValue(model, boundPath);
currentCachePosition = boundValue.value;
optimizedPath = boundOptimizedPath = boundValue.path;
} else {
currentCachePosition = cache;
optimizedPath = boundOptimizedPath = [];
}
for (i = 0, len = paths.length; i < len; i++) {
var valueNode = undefined;
var pathSet = paths[i];
if (values[i]) {
valueNode = values[i];
}
if (len > 1) {
optimizedPath = [];
for (j = 0, bLen = boundOptimizedPath.length; j < bLen; j++) {
optimizedPath[j] = boundOptimizedPath[j];
}
}
if (pathSet.path) {
pathSet = pathSet.path;
}
walk(model, cache, currentCachePosition, pathSet, 0, valueNode, [], results, optimizedPath, [], inputFormat, 'JSON');
if (missingIdx < requestedMissingPaths.length) {
for (j = missingIdx, length = requestedMissingPaths.length; j < length; j++) {
requestedMissingPaths[j].pathSetIndex = i;
}
missingIdx = length;
}
}
return results;
};
};
},{"./getBoundValue":44,"./util/isPathValue":56}],41:[function(require,module,exports){
var getBoundValue = require('./getBoundValue');
var isPathValue = require('./util/isPathValue');
module.exports = function(walk) {
return function getAsJSONG(model, paths, values) {
var results = {
values: [],
errors: [],
requestedPaths: [],
optimizedPaths: [],
requestedMissingPaths: [],
optimizedMissingPaths: []
};
var inputFormat = Array.isArray(paths[0]) || isPathValue(paths[0]) ?
'Paths' : 'JSON';
results.values = values;
var cache = model._cache;
var boundPath = model._path;
var currentCachePosition;
if (boundPath.length) {
throw 'It is not legal to use the JSON Graph format from a bound Model. JSON Graph format can only be used from a root model.';
} else {
currentCachePosition = cache;
}
for (var i = 0, len = paths.length; i < len; i++) {
var pathSet = paths[i];
if (pathSet.path) {
pathSet = pathSet.path;
}
walk(model, cache, currentCachePosition, pathSet, 0, values[0], [], results, [], [], inputFormat, 'JSONG');
}
return results;
};
};
},{"./getBoundValue":44,"./util/isPathValue":56}],42:[function(require,module,exports){
var getBoundValue = require('./getBoundValue');
var isPathValue = require('./util/isPathValue');
module.exports = function(walk) {
return function getAsPathMap(model, paths, values) {
var valueNode;
var results = {
values: [],
errors: [],
requestedPaths: [],
optimizedPaths: [],
requestedMissingPaths: [],
optimizedMissingPaths: []
};
var inputFormat = Array.isArray(paths[0]) || isPathValue(paths[0]) ?
'Paths' : 'JSON';
valueNode = values[0];
results.values = values;
var cache = model._cache;
var boundPath = model._path;
var currentCachePosition;
var optimizedPath, boundOptimizedPath;
if (boundPath.length) {
var boundValue = getBoundValue(model, boundPath);
currentCachePosition = boundValue.value;
optimizedPath = boundOptimizedPath = boundValue.path;
} else {
currentCachePosition = cache;
optimizedPath = boundOptimizedPath = [];
}
for (var i = 0, len = paths.length; i < len; i++) {
if (len > 1) {
optimizedPath = [];
for (j = 0, bLen = boundOptimizedPath.length; j < bLen; j++) {
optimizedPath[j] = boundOptimizedPath[j];
}
}
var pathSet = paths[i];
if (pathSet.path) {
pathSet = pathSet.path;
}
walk(model, cache, currentCachePosition, pathSet, 0, valueNode, [], results, optimizedPath, [], inputFormat, 'PathMap');
}
return results;
};
};
},{"./getBoundValue":44,"./util/isPathValue":56}],43:[function(require,module,exports){
var getBoundValue = require('./getBoundValue');
var isPathValue = require('./util/isPathValue');
module.exports = function(walk) {
return function getAsValues(model, paths, onNext) {
var results = {
values: [],
errors: [],
requestedPaths: [],
optimizedPaths: [],
requestedMissingPaths: [],
optimizedMissingPaths: []
};
var inputFormat = Array.isArray(paths[0]) || isPathValue(paths[0]) ?
'Paths' : 'JSON';
var cache = model._cache;
var boundPath = model._path;
var currentCachePosition;
var optimizedPath, boundOptimizedPath;
if (boundPath.length) {
var boundValue = getBoundValue(model, boundPath);
currentCachePosition = boundValue.value;
optimizedPath = boundOptimizedPath = boundValue.path;
} else {
currentCachePosition = cache;
optimizedPath = boundOptimizedPath = [];
}
for (var i = 0, len = paths.length; i < len; i++) {
if (len > 1) {
optimizedPath = [];
for (j = 0, bLen = boundOptimizedPath.length; j < bLen; j++) {
optimizedPath[j] = boundOptimizedPath[j];
}
}
var pathSet = paths[i];
if (pathSet.path) {
pathSet = pathSet.path;
}
walk(model, cache, currentCachePosition, pathSet, 0, onNext, null, results, optimizedPath, [], inputFormat, 'Values');
}
return results;
};
};
},{"./getBoundValue":44,"./util/isPathValue":56}],44:[function(require,module,exports){
var getValueSync = require('./getValueSync');
module.exports = function getBoundValue(model, path) {
var boxed, value, shorted;
boxed = model._boxed;
model._boxed = true;
value = getValueSync(model, path.concat(null));
model._boxed = boxed;
path = value.optimizedPath;
shorted = value.shorted;
value = value.value;
while (path.length && path[path.length - 1] === null) {
path.pop();
}
return {
path: path,
value: value,
shorted: shorted
};
};
},{"./getValueSync":45}],45:[function(require,module,exports){
var followReference = require('./followReference');
var clone = require('./util/clone');
var isExpired = require('./util/isExpired');
var promote = require('./util/lru').promote;
var $path = require('./../types/path.js');
var $sentinel = require('./../types/sentinel.js');
var $error = require('./../types/error.js');
module.exports = function getValueSync(model, simplePath) {
var root = model._cache;
var len = simplePath.length;
var optimizedPath = [];
var shorted = false, shouldShort = false;
var depth = 0;
var key, i, next = root, type, curr = root, out, ref, refNode;
do {
key = simplePath[depth++];
if (key !== null) {
next = curr[key];
optimizedPath.push(key);
}
if (!next) {
out = undefined;
shorted = true;
break;
}
type = next.$type;
// Up to the last key we follow references
if (depth < len) {
if (type === $path) {
ref = followReference(model, root, root, next, next.value);
refNode = ref[0];
if (!refNode) {
out = undefined;
break;
}
type = refNode.$type;
next = refNode;
optimizedPath = ref[1];
}
if (type) {
break;
}
}
// If there is a value, then we have great success, else, report an undefined.
else {
out = next;
}
curr = next;
} while (next && depth < len);
if (depth < len) {
// Unfortunately, if all that follows are nulls, then we have not shorted.
for (i = depth; i < len; ++i) {
if (simplePath[depth] !== null) {
shouldShort = true;
break;
}
}
// if we should short or report value. Values are reported on nulls.
if (shouldShort) {
shorted = true;
out = undefined;
} else {
out = next;
}
for (i = depth; i < len; ++i) {
optimizedPath[optimizedPath.length] = simplePath[i];
}
}
// promotes if not expired
if (out) {
if (isExpired(out)) {
out = undefined;
} else {
promote(model, out);
}
}
if (out && out.$type === $error && !model._treatErrorsAsValues) {
throw {path: simplePath, value: out.value};
} else if (out && model._boxed) {
out = !!type ? clone(out) : out;
} else if (!out && model._materialized) {
out = {$type: $sentinel};
} else if (out) {
out = out.value;
}
return {
value: out,
shorted: shorted,
optimizedPath: optimizedPath
};
};
},{"./../types/error.js":134,"./../types/path.js":135,"./../types/sentinel.js":136,"./followReference":39,"./util/clone":52,"./util/isExpired":54,"./util/lru":57}],46:[function(require,module,exports){
var followReference = require('./followReference');
var onError = require('./onError');
var onMissing = require('./onMissing');
var onValue = require('./onValue');
var lru = require('./util/lru');
var hardLink = require('./util/hardlink');
var isMaterialized = require('./util/isMaterialzed');
var removeHardlink = hardLink.remove;
var splice = lru.splice;
var isExpired = require('./util/isExpired');
var permuteKey = require('./util/permuteKey');
var $path = require('./../types/path');
var $error = require('./../types/error');
var __invalidated = require("../internal/invalidated");
function walk(model, root, curr, pathOrJSON, depth, seedOrFunction, positionalInfo, outerResults, optimizedPath, requestedPath, inputFormat, outputFormat, fromReference) {
if ((!curr || curr && curr.$type) &&
evaluateNode(model, curr, pathOrJSON, depth, seedOrFunction, requestedPath, optimizedPath, positionalInfo, outerResults, outputFormat, fromReference)) {
return;
}
// We continue the search to the end of the path/json structure.
else {
// Base case of the searching: Have we hit the end of the road?
// Paths
// 1) depth === path.length
// PathMaps (json input)
// 2) if its an object with no keys
// 3) its a non-object
var jsonQuery = inputFormat === 'JSON';
var atEndOfJSONQuery = false;
var k, i, len;
if (jsonQuery) {
// it has a $type property means we have hit a end.
if (pathOrJSON && pathOrJSON.$type) {
atEndOfJSONQuery = true;
}
// is it an object?
else if (pathOrJSON && typeof pathOrJSON === 'object') {
// A terminating condition
k = Object.keys(pathOrJSON);
if (k.length === 1) {
k = k[0];
}
}
// found a primitive, we hit the end.
else {
atEndOfJSONQuery = true;
}
} else {
k = pathOrJSON[depth];
}
// BaseCase: we have hit the end of our query without finding a 'leaf' node, therefore emit missing.
if (atEndOfJSONQuery || !jsonQuery && depth === pathOrJSON.length) {
if (isMaterialized(model)) {
onValue(model, curr, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat, fromReference);
return;
}
onMissing(model, curr, pathOrJSON, depth, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat);
return;
}
var memo = {done: false};
var permutePosition = positionalInfo;
var permuteRequested = requestedPath;
var permuteOptimized = optimizedPath;
var asJSONG = outputFormat === 'JSONG';
var asJSON = outputFormat === 'JSON';
var isKeySet = false;
var hasChildren = false;
depth++;
var key;
if (k && typeof k === 'object') {
memo.isArray = Array.isArray(k);
memo.arrOffset = 0;
key = permuteKey(k, memo);
isKeySet = true;
// The complex key provided is actual empty
if (memo.done) {
return;
}
} else {
key = k;
memo.done = true;
}
if (asJSON && isKeySet) {
permutePosition = [];
for (i = 0, len = positionalInfo.length; i < len; i++) {
permutePosition[i] = positionalInfo[i];
}
permutePosition.push(depth - 1);
}
do {
fromReference = false;
if (!memo.done) {
permuteOptimized = [];
permuteRequested = [];
for (i = 0, len = requestedPath.length; i < len; i++) {
permuteRequested[i] = requestedPath[i];
}
for (i = 0, len = optimizedPath.length; i < len; i++) {
permuteOptimized[i] = optimizedPath[i];
}
}
var nextPathOrPathMap = jsonQuery ? pathOrJSON[key] : pathOrJSON;
if (jsonQuery && nextPathOrPathMap) {
if (typeof nextPathOrPathMap === 'object') {
if (nextPathOrPathMap.$type) {
hasChildren = false;
} else {
hasChildren = Object.keys(nextPathOrPathMap).length > 0;
}
}
}
var next;
if (key === null || jsonQuery && key === '__null') {
next = curr;
} else {
next = curr[key];
permuteOptimized.push(key);
permuteRequested.push(key);
}
if (next) {
var nType = next.$type;
var value = nType && next.value || next;
if (jsonQuery && hasChildren || !jsonQuery && depth < pathOrJSON.length) {
if (nType && nType === $path && !isExpired(next)) {
if (asJSONG) {
onValue(model, next, seedOrFunction, outerResults, false, permuteOptimized, permutePosition, outputFormat);
}
var ref = followReference(model, root, root, next, value, seedOrFunction, outputFormat);
fromReference = true;
next = ref[0];
var refPath = ref[1];
permuteOptimized = [];
for (i = 0, len = refPath.length; i < len; i++) {
permuteOptimized[i] = refPath[i];
}
}
}
}
walk(model, root, next, nextPathOrPathMap, depth, seedOrFunction, permutePosition, outerResults, permuteOptimized, permuteRequested, inputFormat, outputFormat, fromReference);
if (!memo.done) {
key = permuteKey(k, memo);
}
} while (!memo.done);
}
}
function evaluateNode(model, curr, pathOrJSON, depth, seedOrFunction, requestedPath, optimizedPath, positionalInfo, outerResults, outputFormat, fromReference) {
// BaseCase: This position does not exist, emit missing.
if (!curr) {
if (isMaterialized(model)) {
onValue(model, curr, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat, fromReference);
} else {
onMissing(model, curr, pathOrJSON, depth, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat);
}
return true;
}
var currType = curr.$type;
positionalInfo = positionalInfo || [];
// The Base Cases. There is a type, therefore we have hit a 'leaf' node.
if (currType === $error) {
if (fromReference) {
requestedPath.push(null);
}
if (outputFormat === 'JSONG' || model._treatErrorsAsValues) {
onValue(model, curr, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat, fromReference);
} else {
onError(model, curr, requestedPath, optimizedPath, outerResults);
}
}
// Else we have found a value, emit the current position information.
else {
if (isExpired(curr)) {
if (!curr[__invalidated]) {
splice(model, curr);
removeHardlink(curr);
}
onMissing(model, curr, pathOrJSON, depth, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat);
} else {
onValue(model, curr, seedOrFunction, outerResults, requestedPath, optimizedPath, positionalInfo, outputFormat, fromReference);
}
}
return true;
}
module.exports = walk;
},{"../internal/invalidated":64,"./../types/error":134,"./../types/path":135,"./followReference":39,"./onError":49,"./onMissing":50,"./onValue":51,"./util/hardlink":53,"./util/isExpired":54,"./util/isMaterialzed":55,"./util/lru":57,"./util/permuteKey":58}],47:[function(require,module,exports){
var walk = require('./getWalk');
module.exports = {
getAsJSON: require('./getAsJSON')(walk),
getAsJSONG: require('./getAsJSONG')(walk),
getAsValues: require('./getAsValues')(walk),
getAsPathMap: require('./getAsPathMap')(walk),
getValueSync: require('./getValueSync'),
getBoundValue: require('./getBoundValue'),
setCache: require('./legacy_setCache')
};
},{"./getAsJSON":40,"./getAsJSONG":41,"./getAsPathMap":42,"./getAsValues":43,"./getBoundValue":44,"./getValueSync":45,"./getWalk":46,"./legacy_setCache":48}],48:[function(require,module,exports){
/* istanbul ignore next */
var NOOP = function NOOP() {},
__GENERATION_GUID = 0,
__GENERATION_VERSION = 0,
__CONTAINER = "__reference_container",
__CONTEXT = "__context",
__GENERATION = "__generation",
__GENERATION_UPDATED = "__generation_updated",
__INVALIDATED = "__invalidated",
__KEY = "__key",
__KEYS = "__keys",
__IS_KEY_SET = "__is_key_set",
__NULL = "__null",
__SELF = "./",
__PARENT = "../",
__REF = "__ref",
__REF_INDEX = "__ref_index",
__REFS_LENGTH = "__refs_length",
__ROOT = "/",
__OFFSET = "__offset",
__FALKOR_EMPTY_OBJECT = '__FALKOR_EMPTY_OBJECT',
__INTERNAL_KEYS = [
__CONTAINER, __CONTEXT, __GENERATION, __GENERATION_UPDATED,
__INVALIDATED, __KEY, __KEYS, __IS_KEY_SET, __NULL, __SELF,
__PARENT, __REF, __REF_INDEX, __REFS_LENGTH, __OFFSET, __ROOT
],
$TYPE = "$type",
$SIZE = "$size",
$EXPIRES = "$expires",
$TIMESTAMP = "$timestamp",
SENTINEL = "sentinel",
PATH = "ref",
ERROR = "error",
VALUE = "value",
EXPIRED = "expired",
LEAF = "leaf";
/* istanbul ignore next */
module.exports = function setCache(model, map) {
var root = model._root, expired = root.expired, depth = 0, height = 0, mapStack = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;
mapStack[0] = map;
nodes[-1] = nodeParent;
while (depth > -1) {
/* Walk Path Map */
var isTerminus = false, offset = 0, keys = void 0, index = void 0, key = void 0, isKeySet = false;
node = nodeParent = nodes[depth - 1];
depth = depth;
follow_path_map_9177:
do {
height = depth;
nodeType = node && node[$TYPE] || void 0;
nodeValue = nodeType === SENTINEL ? node[VALUE] : node;
if ((isTerminus = !((map = mapStack[offset = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset + 1] || (mapStack[offset + 1] = Object.keys(map))) && ((index = mapStack[offset + 2] || (mapStack[offset + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {
if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {
nodeType = void 0;
nodeValue = void 0;
node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;
}
if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {
if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {
key = null;
node = node;
depth = depth;
continue follow_path_map_9177;
}
} else {
if (key != null) {
var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;
nodeType = map && map[$TYPE] || void 0;
nV2 = nodeType ? map[VALUE] : void 0;
nodeValue = nodeType === SENTINEL ? map[VALUE] : map;
newNode = map;
if ((!nodeType || nodeType === SENTINEL || nodeType === PATH) && Array.isArray(nodeValue)) {
delete nodeValue[$SIZE];
// console.log(1);
if (nodeType) {
nodeSize = 50 + (nodeValue.length || 1);
} else {
nodeSize = nodeValue.length || 1;
}
newNode[$SIZE] = nodeSize;
nodeValue[__CONTAINER] = newNode;
} else if (nodeType === SENTINEL || nodeType === PATH) {
newNode[$SIZE] = nodeSize = 50 + (nV2 && typeof nV2.length === 'number' ? nV2.length : 1);
} else if (nodeType === ERROR) {
newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;
} else if (!(map != null && typeof map === 'object')) {
nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);
nodeType = 'sentinel';
newNode = {};
newNode[VALUE] = nodeValue;
newNode[$TYPE] = nodeType;
newNode[$SIZE] = nodeSize;
} else {
nodeType = newNode[$TYPE] = nodeType || GROUP;
newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;
}
;
if (node !== newNode && (node != null && typeof node === 'object')) {
var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = newNode[__REFS_LENGTH] || 0, i = -1, ref;
while (++i < nodeRefsLength) {
if ((ref = node[__REF + i]) !== void 0) {
ref[__CONTEXT] = newNode;
newNode[__REF + (destRefsLength + i)] = ref;
node[__REF + i] = void 0;
}
}
newNode[__REFS_LENGTH] = nodeRefsLength + destRefsLength;
node[__REFS_LENGTH] = ref = void 0;
var invParent = nodeParent, invChild = node, invKey = key, keys$2, index$2, offset$2, childType, childValue, isBranch, stack = [
nodeParent,
invKey,
node
], depth$2 = 0;
while (depth$2 > -1) {
nodeParent = stack[offset$2 = depth$2 * 8];
invKey = stack[offset$2 + 1];
node = stack[offset$2 + 2];
if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {
childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;
}
childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);
if ((isBranch = stack[offset$2 + 5]) === void 0) {
isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);
}
if (isBranch === true) {
if ((keys$2 = stack[offset$2 + 6]) === void 0) {
keys$2 = stack[offset$2 + 6] = [];
index$2 = -1;
for (var childKey in node) {
!(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$2] = childKey);
}
}
index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);
if (index$2 < keys$2.length) {
stack[offset$2 + 7] = index$2 + 1;
stack[offset$2 = ++depth$2 * 8] = node;
stack[offset$2 + 1] = invKey = keys$2[index$2];
stack[offset$2 + 2] = node[invKey];
continue;
}
}
var ref$2 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;
if (ref$2 && Array.isArray(ref$2)) {
destination = ref$2[__CONTEXT];
if (destination) {
var i$2 = (ref$2[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;
while (++i$2 <= n) {
destination[__REF + i$2] = destination[__REF + (i$2 + 1)];
}
destination[__REFS_LENGTH] = n;
ref$2[__REF_INDEX] = ref$2[__CONTEXT] = destination = void 0;
}
}
if (node != null && typeof node === 'object') {
var ref$3, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;
while (++i$3 < n$2) {
if ((ref$3 = node[__REF + i$3]) !== void 0) {
ref$3[__CONTEXT] = node[__REF + i$3] = void 0;
}
}
node[__REFS_LENGTH] = void 0;
var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;
next != null && typeof next === 'object' && (next.__prev = prev);
prev != null && typeof prev === 'object' && (prev.__next = next);
node === head && (root$2.__head = root$2.__next = next);
node === tail && (root$2.__tail = root$2.__prev = prev);
node.__next = node.__prev = void 0;
head = tail = next = prev = void 0;
;
nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;
}
;
delete stack[offset$2 + 0];
delete stack[offset$2 + 1];
delete stack[offset$2 + 2];
delete stack[offset$2 + 3];
delete stack[offset$2 + 4];
delete stack[offset$2 + 5];
delete stack[offset$2 + 6];
delete stack[offset$2 + 7];
--depth$2;
}
nodeParent = invParent;
node = invChild;
}
nodeParent[key] = node = newNode;
nodeType = node && node[$TYPE] || void 0;
node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;
sizeOffset = edgeSize - nodeSize;
var self = nodeParent, child = node;
while (node = nodeParent) {
nodeParent = node[__PARENT];
if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {
var ref$4 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;
if (ref$4 && Array.isArray(ref$4)) {
destination$2 = ref$4[__CONTEXT];
if (destination$2) {
var i$4 = (ref$4[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;
while (++i$4 <= n$3) {
destination$2[__REF + i$4] = destination$2[__REF + (i$4 + 1)];
}
destination$2[__REFS_LENGTH] = n$3;
ref$4[__REF_INDEX] = ref$4[__CONTEXT] = destination$2 = void 0;
}
}
if (node != null && typeof node === 'object') {
var ref$5, i$5 = -1, n$4 = node[__REFS_LENGTH] || 0;
while (++i$5 < n$4) {
if ((ref$5 = node[__REF + i$5]) !== void 0) {
ref$5[__CONTEXT] = node[__REF + i$5] = void 0;
}
}
node[__REFS_LENGTH] = void 0;
var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;
next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);
prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);
node === head$2 && (root$3.__head = root$3.__next = next$2);
node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);
node.__next = node.__prev = void 0;
head$2 = tail$2 = next$2 = prev$2 = void 0;
;
nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;
}
} else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {
var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$6, i$6, k, n$5;
while (depth$3 > -1) {
if ((linkPaths = stack$2[depth$3]) === void 0) {
i$6 = k = -1;
n$5 = node[__REFS_LENGTH] || 0;
node[__GENERATION_UPDATED] = __GENERATION_VERSION;
node[__GENERATION] = ++__GENERATION_GUID;
if ((ref$6 = node[__PARENT]) !== void 0 && ref$6[__GENERATION_UPDATED] !== __GENERATION_VERSION) {
stack$2[depth$3] = linkPaths = new Array(n$5 + 1);
linkPaths[++k] = ref$6;
} else if (n$5 > 0) {
stack$2[depth$3] = linkPaths = new Array(n$5);
}
while (++i$6 < n$5) {
if ((ref$6 = node[__REF + i$6]) !== void 0 && ref$6[__GENERATION_UPDATED] !== __GENERATION_VERSION) {
linkPaths[++k] = ref$6;
}
}
}
if ((node = linkPaths && linkPaths.pop()) !== void 0) {
++depth$3;
} else {
stack$2[depth$3--] = void 0;
}
}
node = self$2;
}
}
nodeParent = self;
node = child;
}
;
node = node;
break follow_path_map_9177;
}
}
if ((key = keys[index]) == null) {
node = node;
break follow_path_map_9177;
} else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {
mapStack[(depth + 1) * 4 + 3] = key;
} else {
mapStack[offset + 2] = index + 1;
node = node;
depth = depth;
continue follow_path_map_9177;
}
nodes[depth - 1] = nodeParent = node;
if (key != null) {
node = nodeParent && nodeParent[key];
if (typeof map === 'object') {
for (var key$2 in map) {
key$2[0] === '$' && key$2 !== $SIZE && (nodeParent && (nodeParent[key$2] = map[key$2]) || true);
}
map = map[key];
}
var mapType = map && map[$TYPE] || void 0;
var mapValue = mapType === SENTINEL ? map[VALUE] : map;
if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType && (map != null && typeof map === 'object') && !Array.isArray(mapValue))) {
nodeType = void 0;
nodeValue = {};
nodeSize = node && node[$SIZE] || 0;
if (node !== nodeValue && (node != null && typeof node === 'object')) {
var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = nodeValue[__REFS_LENGTH] || 0, i$7 = -1, ref$7;
while (++i$7 < nodeRefsLength$2) {
if ((ref$7 = node[__REF + i$7]) !== void 0) {
ref$7[__CONTEXT] = nodeValue;
nodeValue[__REF + (destRefsLength$2 + i$7)] = ref$7;
node[__REF + i$7] = void 0;
}
}
nodeValue[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;
node[__REFS_LENGTH] = ref$7 = void 0;
var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [
nodeParent,
invKey$2,
node
], depth$4 = 0;
while (depth$4 > -1) {
nodeParent = stack$3[offset$3 = depth$4 * 8];
invKey$2 = stack$3[offset$3 + 1];
node = stack$3[offset$3 + 2];
if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {
childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;
}
childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);
if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {
isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);
}
if (isBranch$2 === true) {
if ((keys$3 = stack$3[offset$3 + 6]) === void 0) {
keys$3 = stack$3[offset$3 + 6] = [];
index$3 = -1;
for (var childKey$2 in node) {
!(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$3] = childKey$2);
}
}
index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);
if (index$3 < keys$3.length) {
stack$3[offset$3 + 7] = index$3 + 1;
stack$3[offset$3 = ++depth$4 * 8] = node;
stack$3[offset$3 + 1] = invKey$2 = keys$3[index$3];
stack$3[offset$3 + 2] = node[invKey$2];
continue;
}
}
var ref$8 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;
if (ref$8 && Array.isArray(ref$8)) {
destination$3 = ref$8[__CONTEXT];
if (destination$3) {
var i$8 = (ref$8[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;
while (++i$8 <= n$6) {
destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];
}
destination$3[__REFS_LENGTH] = n$6;
ref$8[__REF_INDEX] = ref$8[__CONTEXT] = destination$3 = void 0;
}
}
if (node != null && typeof node === 'object') {
var ref$9, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;
while (++i$9 < n$7) {
if ((ref$9 = node[__REF + i$9]) !== void 0) {
ref$9[__CONTEXT] = node[__REF + i$9] = void 0;
}
}
node[__REFS_LENGTH] = void 0;
var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;
next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);
prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);
node === head$3 && (root$4.__head = root$4.__next = next$3);
node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);
node.__next = node.__prev = void 0;
head$3 = tail$3 = next$3 = prev$3 = void 0;
;
nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;
}
;
delete stack$3[offset$3 + 0];
delete stack$3[offset$3 + 1];
delete stack$3[offset$3 + 2];
delete stack$3[offset$3 + 3];
delete stack$3[offset$3 + 4];
delete stack$3[offset$3 + 5];
delete stack$3[offset$3 + 6];
delete stack$3[offset$3 + 7];
--depth$4;
}
nodeParent = invParent$2;
node = invChild$2;
}
nodeParent[key] = node = nodeValue;
node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;
var self$3 = node, node$2;
while (node$2 = node) {
if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {
var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$10, i$10, k$2, n$8;
while (depth$5 > -1) {
if ((linkPaths$2 = stack$4[depth$5]) === void 0) {
i$10 = k$2 = -1;
n$8 = node[__REFS_LENGTH] || 0;
node[__GENERATION_UPDATED] = __GENERATION_VERSION;
node[__GENERATION] = ++__GENERATION_GUID;
if ((ref$10 = node[__PARENT]) !== void 0 && ref$10[__GENERATION_UPDATED] !== __GENERATION_VERSION) {
stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);
linkPaths$2[++k$2] = ref$10;
} else if (n$8 > 0) {
stack$4[depth$5] = linkPaths$2 = new Array(n$8);
}
while (++i$10 < n$8) {
if ((ref$10 = node[__REF + i$10]) !== void 0 && ref$10[__GENERATION_UPDATED] !== __GENERATION_VERSION) {
linkPaths$2[++k$2] = ref$10;
}
}
}
if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {
++depth$5;
} else {
stack$4[depth$5--] = void 0;
}
}
node = self$4;
}
node = node$2[__PARENT];
}
node = self$3;
}
}
node = node;
depth = depth + 1;
continue follow_path_map_9177;
} while (true);
node = node;
var offset$4 = depth * 4, keys$4, index$4;
do {
delete mapStack[offset$4 + 0];
delete mapStack[offset$4 + 1];
delete mapStack[offset$4 + 2];
delete mapStack[offset$4 + 3];
} while ((keys$4 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$4.length);
}
return nodeRoot;
}
},{}],49:[function(require,module,exports){
var lru = require('./util/lru');
var clone = require('./util/clone');
var promote = lru.promote;
module.exports = function onError(model, node, permuteRequested, permuteOptimized, outerResults) {
outerResults.errors.push({path: permuteRequested, value: node.value});
promote(model, node);
if (permuteOptimized) {
outerResults.requestedPaths.push(permuteRequested);
outerResults.optimizedPaths.push(permuteOptimized);
}
};
},{"./util/clone":52,"./util/lru":57}],50:[function(require,module,exports){
var support = require('./util/support');
var fastCat = support.fastCat,
fastCatSkipNulls = support.fastCatSkipNulls,
fastCopy = support.fastCopy;
var isExpired = require('./util/isExpired');
var spreadJSON = require('./util/spreadJSON');
var clone = require('./util/clone');
module.exports = function onMissing(model, node, path, depth, seedOrFunction, outerResults, permuteRequested, permuteOptimized, permutePosition, outputFormat) {
var pathSlice;
if (Array.isArray(path)) {
if (depth < path.length) {
pathSlice = fastCopy(path, depth);
} else {
pathSlice = [];
}
concatAndInsertMissing(pathSlice, outerResults, permuteRequested, permuteOptimized, permutePosition, outputFormat);
} else {
pathSlice = [];
spreadJSON(path, pathSlice);
for (var i = 0, len = pathSlice.length; i < len; i++) {
concatAndInsertMissing(pathSlice[i], outerResults, permuteRequested, permuteOptimized, permutePosition, outputFormat, true);
}
}
};
function concatAndInsertMissing(remainingPath, results, permuteRequested, permuteOptimized, permutePosition, outputFormat, __null) {
var i = 0, len;
if (__null) {
for (i = 0, len = remainingPath.length; i < len; i++) {
if (remainingPath[i] === '__null') {
remainingPath[i] = null;
}
}
}
if (outputFormat === 'JSON') {
permuteRequested = fastCat(permuteRequested, remainingPath);
for (i = 0, len = permutePosition.length; i < len; i++) {
var idx = permutePosition[i];
var r = permuteRequested[idx];
permuteRequested[idx] = [r];
}
results.requestedMissingPaths.push(permuteRequested);
results.optimizedMissingPaths.push(fastCatSkipNulls(permuteOptimized, remainingPath));
} else {
results.requestedMissingPaths.push(fastCat(permuteRequested, remainingPath));
results.optimizedMissingPaths.push(fastCatSkipNulls(permuteOptimized, remainingPath));
}
}
},{"./util/clone":52,"./util/isExpired":54,"./util/spreadJSON":59,"./util/support":60}],51:[function(require,module,exports){
var lru = require('./util/lru');
var clone = require('./util/clone');
var promote = lru.promote;
var $path = require('./../types/path');
var $sentinel = require('./../types/sentinel');
var $error = require('./../types/error');
module.exports = function onValue(model, node, seedOrFunction, outerResults, permuteRequested, permuteOptimized, permutePosition, outputFormat, fromReference) {
var i, len, k, key, curr, prev, prevK;
var materialized = false, valueNode;
if (node) {
promote(model, node);
}
if (!node || node.value === undefined) {
materialized = model._materialized;
}
// materialized
if (materialized) {
valueNode = {$type: $sentinel};
}
// Boxed Mode & Reference Node & Error node (only happens when model is in treat errors as values).
else if (model._boxed) {
valueNode = clone(node);
}
else if (node.$type === $path || node.$type === $error) {
if (outputFormat === 'JSONG') {
valueNode = clone(node);
} else {
valueNode = node.value;
}
}
else {
if (outputFormat === 'JSONG') {
if (typeof node.value === 'object') {
valueNode = clone(node);
} else {
valueNode = node.value;
}
} else {
valueNode = node.value;
}
}
if (permuteRequested) {
if (fromReference && permuteRequested[permuteRequested.length - 1] !== null) {
permuteRequested.push(null);
}
outerResults.requestedPaths.push(permuteRequested);
outerResults.optimizedPaths.push(permuteOptimized);
}
switch (outputFormat) {
case 'Values':
// in any subscription situation, onNexts are always provided, even as a noOp.
seedOrFunction({path: permuteRequested, value: valueNode});
break;
case 'PathMap':
len = permuteRequested.length - 1;
if (len === -1) {
seedOrFunction.json = valueNode;
} else {
curr = seedOrFunction.json;
if (!curr) {
curr = seedOrFunction.json = {};
}
for (i = 0; i < len; i++) {
k = permuteRequested[i];
if (!curr[k]) {
curr[k] = {};
}
prev = curr;
prevK = k;
curr = curr[k];
}
k = permuteRequested[i];
if (k !== null) {
curr[k] = valueNode;
} else {
prev[prevK] = valueNode;
}
}
break;
case 'JSON':
if (seedOrFunction) {
if (permutePosition.length) {
if (!seedOrFunction.json) {
seedOrFunction.json = {};
}
curr = seedOrFunction.json;
for (i = 0, len = permutePosition.length - 1; i < len; i++) {
k = permutePosition[i];
key = permuteRequested[k];
if (!curr[key]) {
curr[key] = {};
}
curr = curr[key];
}
// assign the last
k = permutePosition[i];
key = permuteRequested[k];
curr[key] = valueNode;
} else {
seedOrFunction.json = valueNode;
}
}
break;
case 'JSONG':
curr = seedOrFunction.jsong;
if (!curr) {
curr = seedOrFunction.jsong = {};
seedOrFunction.paths = [];
}
for (i = 0, len = permuteOptimized.length - 1; i < len; i++) {
key = permuteOptimized[i];
if (!curr[key]) {
curr[key] = {};
}
curr = curr[key];
}
// assign the last
key = permuteOptimized[i];
// TODO: Special case? do string comparisons make big difference?
curr[key] = materialized ? {$type: $sentinel} : valueNode;
if (permuteRequested) {
seedOrFunction.paths.push(permuteRequested);
}
break;
}
};
},{"./../types/error":134,"./../types/path":135,"./../types/sentinel":136,"./util/clone":52,"./util/lru":57}],52:[function(require,module,exports){
// Copies the node
var prefix = require("../../internal/prefix");
module.exports = function clone(node) {
var outValue, i, len;
var keys = Object.keys(node);
outValue = {};
for (i = 0, len = keys.length; i < len; i++) {
var k = keys[i];
if (k[0] === prefix) {
continue;
}
outValue[k] = node[k];
}
return outValue;
};
},{"../../internal/prefix":69}],53:[function(require,module,exports){
var __ref = require("../../internal/ref");
var __context = require("../../internal/context");
var __ref_index = require("../../internal/ref-index");
var __refs_length = require("../../internal/refs-length");
function createHardlink(from, to) {
// create a back reference
var backRefs = to[__refs_length] || 0;
to[__ref + backRefs] = from;
to[__refs_length] = backRefs + 1;
// create a hard reference
from[__ref_index] = backRefs;
from[__context] = to;
}
function removeHardlink(cacheObject) {
var context = cacheObject[__context];
if (context) {
var idx = cacheObject[__ref_index];
var len = context[__refs_length];
while (idx < len) {
context[__ref + idx] = context[__REF + idx + 1];
++idx;
}
context[__refs_length] = len - 1;
cacheObject[__context] = undefined;
cacheObject[__ref_index] = undefined;
}
}
module.exports = {
create: createHardlink,
remove: removeHardlink
};
},{"../../internal/context":61,"../../internal/ref":72,"../../internal/ref-index":71,"../../internal/refs-length":73}],54:[function(require,module,exports){
var now = require('../../support/now');
module.exports = function isExpired(node) {
var $expires = node.$expires === undefined && -1 || node.$expires;
return $expires !== -1 && $expires !== 1 && ($expires === 0 || $expires < now());
};
},{"../../support/now":121}],55:[function(require,module,exports){
module.exports = function isMaterialized(model) {
return model._materialized && !(model._router || model._dataSource);
};
},{}],56:[function(require,module,exports){
module.exports = function(x) {
return x.path && x.value;
};
},{}],57:[function(require,module,exports){
var __head = require("../../internal/head");
var __tail = require("../../internal/tail");
var __next = require("../../internal/next");
var __prev = require("../../internal/prev");
var __invalidated = require("../../internal/invalidated");
// [H] -> Next -> ... -> [T]
// [T] -> Prev -> ... -> [H]
function lruPromote(model, object) {
var root = model._root;
var head = root[__head];
if (head === object) {
return;
}
// First insert
if (!head) {
root[__head] = object;
return;
}
// The head and the tail need to separate
if (!root[__tail]) {
root[__head] = object;
root[__tail] = head;
object[__next] = head;
// Now tail
head[__prev] = object;
return;
}
// Its in the cache. Splice out.
var prev = object[__prev];
var next = object[__next];
if (next) {
next[__prev] = prev;
}
if (prev) {
prev[__next] = next;
}
object[__prev] = undefined;
// Insert into head position
root[__head] = object;
object[__next] = head;
head[__prev] = object;
}
function lruSplice(model, object) {
var root = model._root;
// Its in the cache. Splice out.
var prev = object[__prev];
var next = object[__next];
if (next) {
next[__prev] = prev;
}
if (prev) {
prev[__next] = next;
}
object[__prev] = undefined;
if (object === root[__head]) {
root[__head] = undefined;
}
if (object === root[__tail]) {
root[__tail] = undefined;
}
object[__invalidated] = true;
root.expired.push(object);
}
module.exports = {
promote: lruPromote,
splice: lruSplice
};
},{"../../internal/head":63,"../../internal/invalidated":64,"../../internal/next":66,"../../internal/prev":70,"../../internal/tail":74}],58:[function(require,module,exports){
var prefix = require("../../internal/prefix");
module.exports = function permuteKey(key, memo) {
if (memo.isArray) {
if (memo.loaded && memo.rangeOffset > memo.to) {
memo.arrOffset++;
memo.loaded = false;
}
var idx = memo.arrOffset, length = key.length;
if (idx === length) {
memo.done = true;
return '';
}
var el = key[memo.arrOffset];
var type = typeof el;
if (type === 'object') {
if (!memo.loaded) {
memo.from = el.from || 0;
memo.to = el.to ||
typeof el.length === 'number' && memo.from + el.length - 1 || 0;
memo.rangeOffset = memo.from;
memo.loaded = true;
}
return memo.rangeOffset++;
} else {
do {
// if (type !== 'string') {
// break;
// }
if (el[0] !== prefix && el[0] !== '$') {
break;
}
el = key[++idx];
} while (el !== undefined || idx < length);
if (el === undefined || idx === length) {
memo.done = true;
return '';
}
memo.arrOffset = idx + 1;
return el;
}
} else {
if (!memo.loaded) {
memo.from = key.from || 0;
memo.to = key.to ||
typeof key.length === 'number' && memo.from + key.length - 1 || 0;
memo.rangeOffset = memo.from;
memo.loaded = true;
}
if (memo.rangeOffset > memo.to) {
memo.done = true;
return '';
}
return memo.rangeOffset++;
}
};
},{"../../internal/prefix":69}],59:[function(require,module,exports){
var fastCopy = require('./support').fastCopy;
module.exports = function spreadJSON(root, bins, bin) {
bin = bin || [];
if (!bins.length) {
bins.push(bin);
}
if (!root || typeof root !== 'object' || root.$type) {
return [];
}
var keys = Object.keys(root);
if (keys.length === 1) {
bin.push(keys[0]);
spreadJSON(root[keys[0]], bins, bin);
} else {
for (var i = 0, len = keys.length; i < len; i++) {
var k = keys[i];
var nextBin = fastCopy(bin);
nextBin.push(k);
bins.push(nextBin);
spreadJSON(root[k], bins, nextBin);
}
}
};
},{"./support":60}],60:[function(require,module,exports){
function fastCopy(arr, i) {
var a = [], len, j;
for (j = 0, i = i || 0, len = arr.length; i < len; j++, i++) {
a[j] = arr[i];
}
return a;
}
function fastCatSkipNulls(arr1, arr2) {
var a = [], i, len, j;
for (i = 0, len = arr1.length; i < len; i++) {
a[i] = arr1[i];
}
for (j = 0, len = arr2.length; j < len; j++) {
if (arr2[j] !== null) {
a[i++] = arr2[j];
}
}
return a;
}
function fastCat(arr1, arr2) {
var a = [], i, len, j;
for (i = 0, len = arr1.length; i < len; i++) {
a[i] = arr1[i];
}
for (j = 0, len = arr2.length; j < len; j++) {
a[i++] = arr2[j];
}
return a;
}
module.exports = {
fastCat: fastCat,
fastCatSkipNulls: fastCatSkipNulls,
fastCopy: fastCopy
};
},{}],61:[function(require,module,exports){
module.exports = require("./prefix") + "context";
},{"./prefix":69}],62:[function(require,module,exports){
module.exports = require("./prefix") + "generation";
},{"./prefix":69}],63:[function(require,module,exports){
module.exports = require("./prefix") + "head";
},{"./prefix":69}],64:[function(require,module,exports){
module.exports = require("./prefix") + "invalidated";
},{"./prefix":69}],65:[function(require,module,exports){
module.exports = require("./prefix") + "key";
},{"./prefix":69}],66:[function(require,module,exports){
module.exports = require("./prefix") + "next";
},{"./prefix":69}],67:[function(require,module,exports){
module.exports = require("./prefix") + "offset";
},{"./prefix":69}],68:[function(require,module,exports){
module.exports = require("./prefix") + "parent";
},{"./prefix":69}],69:[function(require,module,exports){
// This may look like an empty string, but it's actually a single zero-width-space character.
module.exports = "";
},{}],70:[function(require,module,exports){
module.exports = require("./prefix") + "prev";
},{"./prefix":69}],71:[function(require,module,exports){
module.exports = require("./prefix") + "ref-index";
},{"./prefix":69}],72:[function(require,module,exports){
module.exports = require("./prefix") + "ref";
},{"./prefix":69}],73:[function(require,module,exports){
module.exports = require("./prefix") + "refs-length";
},{"./prefix":69}],74:[function(require,module,exports){
module.exports = require("./prefix") + "tail";
},{"./prefix":69}],75:[function(require,module,exports){
module.exports = require("./prefix") + "version";
},{"./prefix":69}],76:[function(require,module,exports){
module.exports = {
invPathSetsAsJSON: require("./invalidate-path-sets-as-json-dense"),
invPathSetsAsJSONG: require("./invalidate-path-sets-as-json-graph"),
invPathSetsAsPathMap: require("./invalidate-path-sets-as-json-sparse"),
invPathSetsAsValues: require("./invalidate-path-sets-as-json-values")
};
},{"./invalidate-path-sets-as-json-dense":77,"./invalidate-path-sets-as-json-graph":78,"./invalidate-path-sets-as-json-sparse":79,"./invalidate-path-sets-as-json-values":80}],77:[function(require,module,exports){
module.exports = invalidate_path_sets_as_json_dense;
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var array_slice = require("../support/array-slice");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var update_graph = require("../support/update-graph");
var invalidate_node = require("../support/invalidate-node");
var collect = require("../lru/collect");
function invalidate_path_sets_as_json_dense(model, pathsets, values) {
var roots = options([], model);
var index = -1;
var count = pathsets.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json, hasValue;
roots[0] = roots.root;
while (++index < count) {
json = values && values[index];
if (is_object(json)) {
roots[3] = parents[3] = nodes[3] = json.json || (json.json = {})
} else {
roots[3] = parents[3] = nodes[3] = undefined;
}
var pathset = pathsets[index];
roots.index = index;
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
if (is_object(json)) {
json.json = roots.json;
}
delete roots.json;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: true,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[3];
parent = parents[0];
} else {
json = is_keyset && nodes[3] || parents[3];
parent = nodes[0];
}
var node = parent[key];
if (!is_top_level) {
parents[0] = parent;
nodes[0] = node;
return;
}
if (is_branch) {
parents[0] = nodes[0] = node;
if (is_keyset && !!(parents[3] = json)) {
nodes[3] = json[keyset] || (json[keyset] = {});
}
return;
}
nodes[0] = node;
if (!!json) {
var type = is_object(node) && node.$type || undefined;
var jsonkey = keyset;
if (jsonkey == null) {
json = roots;
jsonkey = 3;
}
json[jsonkey] = clone(roots, node, type, node && node.value);
}
var lru = roots.lru;
var size = node.$size || 0;
var version = roots.version;
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, version, lru);
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
roots.json = roots[3];
roots.hasValue = true;
roots.requestedPaths.push(array_slice(requested, roots.offset));
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/array-slice":100,"../support/clone-dense-json":101,"../support/get-valid-key":111,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/update-graph":132,"../walk/walk-path-set":142}],78:[function(require,module,exports){
module.exports = invalidate_path_sets_as_json_graph;
var $path = require("../types/path");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var update_graph = require("../support/update-graph");
var invalidate_node = require("../support/invalidate-node");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function invalidate_path_sets_as_json_graph(model, pathsets, values) {
var roots = options([], model);
var index = -1;
var count = pathsets.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json = values[0];
roots[0] = roots.root;
roots[1] = parents[1] = nodes[1] = json.jsong || (json.jsong = {});
roots.requestedPaths = json.paths || (json.paths = roots.requestedPaths);
while (++index < count) {
var pathset = pathsets[index];
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: true,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[1];
parent = parents[0];
} else {
json = nodes[1];
parent = nodes[0];
}
var jsonkey = key;
var node = parent[key];
if (!is_top_level) {
parents[0] = parent;
nodes[0] = node;
parents[1] = json;
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
return;
}
var type = is_object(node) && node.$type || undefined;
if (is_branch) {
parents[0] = nodes[0] = node;
parents[1] = json;
if (type == $path) {
json[jsonkey] = clone(roots, node, type, node.value);
} else {
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
}
return;
}
nodes[0] = node;
json[jsonkey] = clone(roots, node, type, node && node.value);
var lru = roots.lru;
var size = node.$size || 0;
var version = roots.version;
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, version, lru);
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
clone_success(roots, requested, optimized);
roots.json = roots[1];
roots.hasValue = true;
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/get-valid-key":111,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/update-graph":132,"../types/path":135,"../walk/walk-path-set-soft-link":141}],79:[function(require,module,exports){
module.exports = invalidate_path_sets_as_json_sparse;
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var array_slice = require("../support/array-slice");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var update_graph = require("../support/update-graph");
var invalidate_node = require("../support/invalidate-node");
var collect = require("../lru/collect");
function invalidate_path_sets_as_json_sparse(model, pathsets, values) {
var roots = options([], model);
var index = -1;
var count = pathsets.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json = values[0];
roots[0] = roots.root;
roots[3] = parents[3] = nodes[3] = json.json || (json.json = {});
while (++index < count) {
var pathset = pathsets[index];
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: true,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json, jsonkey;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
jsonkey = get_valid_key(requested);
json = parents[3];
parent = parents[0];
} else {
jsonkey = key;
json = nodes[3];
parent = nodes[0];
}
var node = parent[key];
if (!is_top_level) {
parents[0] = parent;
nodes[0] = node;
return;
}
if (is_branch) {
parents[0] = nodes[0] = node;
parents[3] = json;
nodes[3] = json[jsonkey] || (json[jsonkey] = {});
return;
}
nodes[0] = node;
var type = is_object(node) && node.$type || undefined;
json[jsonkey] = clone(roots, node, type, node && node.value);
var lru = roots.lru;
var size = node.$size || 0;
var version = roots.version;
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, version, lru);
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
roots.json = roots[3];
roots.hasValue = true;
roots.requestedPaths.push(array_slice(requested, roots.offset));
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/array-slice":100,"../support/clone-dense-json":101,"../support/get-valid-key":111,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/update-graph":132,"../walk/walk-path-set":142}],80:[function(require,module,exports){
module.exports = invalidate_path_sets_as_json_values;
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var array_slice = require("../support/array-slice");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var update_graph = require("../support/update-graph");
var invalidate_node = require("../support/invalidate-node");
var collect = require("../lru/collect");
function invalidate_path_sets_as_json_values(model, pathsets, onNext) {
var roots = options([], model);
var index = -1;
var count = pathsets.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
roots[0] = roots.root;
roots.onNext = onNext;
while (++index < count) {
var pathset = pathsets[index];
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: null,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
parent = parents[0];
} else {
parent = nodes[0];
}
var node = parent[key];
if (!is_top_level) {
parents[0] = parent;
nodes[0] = node;
return;
}
if (is_branch) {
parents[0] = nodes[0] = node;
return;
}
nodes[0] = node;
var lru = roots.lru;
var size = node.$size || 0;
var version = roots.version;
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, version, lru);
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var node = nodes[0];
var type = is_object(node) && node.$type || undefined;
var onNext = roots.onNext;
if (!!type && onNext) {
onNext({
path: array_clone(requested),
value: clone(roots, node, type, node && node.value)
});
}
roots.requestedPaths.push(array_slice(requested, roots.offset));
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/array-slice":100,"../support/clone-dense-json":101,"../support/get-valid-key":111,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/update-graph":132,"../walk/walk-path-set":142}],81:[function(require,module,exports){
var __head = require("../internal/head");
var __tail = require("../internal/tail");
var __next = require("../internal/next");
var __prev = require("../internal/prev");
var update_graph = require("../support/update-graph");
module.exports = function(lru, expired, version, total, max, ratio) {
var targetSize = max * ratio;
var node, size;
while(!!(node = expired.pop())) {
size = node.$size || 0;
total -= size;
update_graph(node, size, version, lru);
}
if(total >= max) {
var prev = lru[__tail];
while((total >= targetSize) && !!(node = prev)) {
prev = prev[__prev];
size = node.$size || 0;
total -= size;
update_graph(node, size, version, lru);
}
if((lru[__tail] = lru[__prev] = prev) == null) {
lru[__head] = lru[__next] = undefined;
} else {
prev[__next] = undefined;
}
}
};
},{"../internal/head":63,"../internal/next":66,"../internal/prev":70,"../internal/tail":74,"../support/update-graph":132}],82:[function(require,module,exports){
var $expires_never = require("../values/expires-never");
var __head = require("../internal/head");
var __tail = require("../internal/tail");
var __next = require("../internal/next");
var __prev = require("../internal/prev");
var is_object = require("../support/is-object");
module.exports = function(root, node) {
if(is_object(node) && (node.$expires !== $expires_never)) {
var head = root[__head], tail = root[__tail],
next = node[__next], prev = node[__prev];
if (node !== head) {
(next != null && typeof next === "object") && (next[__prev] = prev);
(prev != null && typeof prev === "object") && (prev[__next] = next);
(next = head) && (head != null && typeof head === "object") && (head[__prev] = node);
(root[__head] = root[__next] = head = node);
(head[__next] = next);
(head[__prev] = undefined);
}
if (tail == null || node === tail) {
root[__tail] = root[__prev] = tail = prev || node;
}
}
return node;
};
},{"../internal/head":63,"../internal/next":66,"../internal/prev":70,"../internal/tail":74,"../support/is-object":117,"../values/expires-never":137}],83:[function(require,module,exports){
var __head = require("../internal/head");
var __tail = require("../internal/tail");
var __next = require("../internal/next");
var __prev = require("../internal/prev");
module.exports = function(root, node) {
var head = root[__head], tail = root[__tail],
next = node[__next], prev = node[__prev];
(next != null && typeof next === "object") && (next[__prev] = prev);
(prev != null && typeof prev === "object") && (prev[__next] = next);
(node === head) && (root[__head] = root[__next] = next);
(node === tail) && (root[__tail] = root[__prev] = prev);
node[__next] = node[__prev] = undefined;
head = tail = next = prev = undefined;
};
},{"../internal/head":63,"../internal/next":66,"../internal/prev":70,"../internal/tail":74}],84:[function(require,module,exports){
module.exports = {
setPathSetsAsJSON: require('./set-json-values-as-json-dense'),
setPathSetsAsJSONG: require('./set-json-values-as-json-graph'),
setPathSetsAsPathMap: require('./set-json-values-as-json-sparse'),
setPathSetsAsValues: require('./set-json-values-as-json-values'),
setPathMapsAsJSON: require('./set-json-sparse-as-json-dense'),
setPathMapsAsJSONG: require('./set-json-sparse-as-json-graph'),
setPathMapsAsPathMap: require('./set-json-sparse-as-json-sparse'),
setPathMapsAsValues: require('./set-json-sparse-as-json-values'),
setJSONGsAsJSON: require('./set-json-graph-as-json-dense'),
setJSONGsAsJSONG: require('./set-json-graph-as-json-graph'),
setJSONGsAsPathMap: require('./set-json-graph-as-json-sparse'),
setJSONGsAsValues: require('./set-json-graph-as-json-values'),
setCache: require('./set-cache')
};
},{"./set-cache":85,"./set-json-graph-as-json-dense":86,"./set-json-graph-as-json-graph":87,"./set-json-graph-as-json-sparse":88,"./set-json-graph-as-json-values":89,"./set-json-sparse-as-json-dense":90,"./set-json-sparse-as-json-graph":91,"./set-json-sparse-as-json-sparse":92,"./set-json-sparse-as-json-values":93,"./set-json-values-as-json-dense":94,"./set-json-values-as-json-graph":95,"./set-json-values-as-json-sparse":96,"./set-json-values-as-json-values":97}],85:[function(require,module,exports){
module.exports = set_cache;
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_map = require("../walk/walk-path-map");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var collect = require("../lru/collect");
function set_cache(model, pathmap, error_selector) {
var roots = options([], model, error_selector);
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var keys_stack = [];
roots[0] = roots.root;
walk_path_map(onNode, onEdge, pathmap, keys_stack, 0, roots, parents, nodes, requested, optimized);
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return model;
}
function onNode(pathmap, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
parent = parents[0];
} else {
parent = nodes[0];
}
var node = parent[key],
type;
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = nodes[0] = node;
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = pathmap;
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
nodes[0] = node;
}
function onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset) {
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/sentinel":136,"../walk/walk-path-map":140}],86:[function(require,module,exports){
module.exports = set_json_graph_as_json_dense;
var $path = require("../types/path");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var merge_node = require("../support/merge-node");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_graph_as_json_dense(model, envelopes, values, error_selector) {
var roots = [];
roots.offset = model._path.length;
roots.bound = [];
roots = options(roots, model, error_selector);
var index = -1;
var index2 = -1;
var count = envelopes.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json, hasValue, hasValues;
roots[0] = roots.root;
while (++index < count) {
var envelope = envelopes[index];
var pathsets = envelope.paths;
var jsong = envelope.jsong || envelope.values || envelope.value;
var index3 = -1;
var count2 = pathsets.length;
roots[2] = jsong;
nodes[2] = jsong;
while (++index3 < count2) {
json = values && values[++index2];
if (is_object(json)) {
roots.json = roots[3] = parents[3] = nodes[3] = json.json || (json.json = {});
} else {
roots.json = roots[3] = parents[3] = nodes[3] = undefined;
}
var pathset = pathsets[index3];
roots.index = index3;
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
hasValue = roots.hasValue;
if (!!hasValue) {
hasValues = true;
if (is_object(json)) {
json.json = roots.json;
}
delete roots.json;
delete roots.hasValue;
} else if (is_object(json)) {
delete json.json;
}
}
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, messageParent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[3];
parent = parents[0];
messageParent = parents[2];
} else {
json = is_keyset && nodes[3] || parents[3];
parent = nodes[0];
messageParent = nodes[2];
}
var node = parent[key];
var message = messageParent && messageParent[key];
nodes[2] = message;
nodes[0] = node = merge_node(roots, parent, node, messageParent, message, key);
if (!is_top_level) {
parents[0] = parent;
parents[2] = messageParent;
return;
}
var length = requested.length;
var offset = roots.offset;
parents[3] = json;
if (is_branch) {
parents[0] = node;
parents[2] = message;
if ((length > offset) && is_keyset && !!json) {
nodes[3] = json[keyset] || (json[keyset] = {});
}
}
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
if(keyset == null) {
roots.json = clone(roots, node, type, node && node.value);
} else if(!!(json = parents[3])) {
json[keyset] = clone(roots, node, type, node && node.value);
}
roots.hasValue = true;
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/get-valid-key":111,"../support/is-object":117,"../support/merge-node":120,"../support/options":122,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../types/path":135,"../walk/walk-path-set-soft-link":141}],87:[function(require,module,exports){
module.exports = set_json_graph_as_json_graph;
var $path = require("../types/path");
var clone = require("../support/clone-graph-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var merge_node = require("../support/merge-node");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var promote = require("../lru/promote");
var collect = require("../lru/collect");
function set_json_graph_as_json_graph(model, envelopes, values, error_selector) {
var roots = [];
roots.offset = 0;
roots.bound = [];
roots = options(roots, model, error_selector);
var index = -1;
var count = envelopes.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json = values[0];
var hasValue;
roots[0] = roots.root;
roots[1] = parents[1] = nodes[1] = json.jsong || (json.jsong = {});
roots.requestedPaths = json.paths || (json.paths = roots.requestedPaths);
while (++index < count) {
var envelope = envelopes[index];
var pathsets = envelope.paths;
var jsong = envelope.jsong || envelope.values || envelope.value;
var index2 = -1;
var count2 = pathsets.length;
roots[2] = jsong;
nodes[2] = jsong;
while (++index2 < count2) {
var pathset = pathsets[index2];
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
}
hasValue = roots.hasValue;
if(hasValue) {
json.jsong = roots[1];
} else {
delete json.jsong;
delete json.paths;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, messageParent, json, jsonkey;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[1];
parent = parents[0];
messageParent = parents[2];
} else {
json = nodes[1];
parent = nodes[0];
messageParent = nodes[2];
}
var jsonkey = key;
var node = parent[key];
var message = messageParent && messageParent[key];
nodes[2] = message;
nodes[0] = node = merge_node(roots, parent, node, messageParent, message, key);
if (!is_top_level) {
parents[0] = parent;
parents[2] = messageParent;
parents[1] = json;
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
return;
}
var type = is_object(node) && node.$type || undefined;
if (is_branch) {
parents[0] = node;
parents[2] = message;
parents[1] = json;
if (type == $path) {
json[jsonkey] = clone(roots, node, type, node.value);
roots.hasValue = true;
} else {
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
}
return;
}
json[jsonkey] = clone(roots, node, type, node && node.value);
roots.hasValue = true;
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
promote(roots.lru, node);
if (keyset == null && !roots.hasValue && (keyset = get_valid_key(optimized)) == null) {
node = clone(roots, node, type, node && node.value);
json = roots[1];
json.$type = node.$type;
json.value = node.value;
}
roots.hasValue = true;
}
}
},{"../lru/collect":81,"../lru/promote":82,"../support/array-clone":99,"../support/clone-graph-json":102,"../support/clone-success-paths":107,"../support/get-valid-key":111,"../support/is-object":117,"../support/merge-node":120,"../support/options":122,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../types/path":135,"../walk/walk-path-set-soft-link":141}],88:[function(require,module,exports){
module.exports = set_json_graph_as_json_sparse;
var $path = require("../types/path");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var merge_node = require("../support/merge-node");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_graph_as_json_sparse(model, envelopes, values, error_selector) {
var roots = [];
roots.offset = model._path.length;
roots.bound = [];
roots = options(roots, model, error_selector);
var index = -1;
var count = envelopes.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json = values[0];
var hasValue;
roots[0] = roots.root;
roots[3] = parents[3] = nodes[3] = json.json || (json.json = {});
while (++index < count) {
var envelope = envelopes[index];
var pathsets = envelope.paths;
var jsong = envelope.jsong || envelope.values || envelope.value;
var index2 = -1;
var count2 = pathsets.length;
roots[2] = jsong;
nodes[2] = jsong;
while (++index2 < count2) {
var pathset = pathsets[index2];
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
}
hasValue = roots.hasValue;
if(hasValue) {
json.json = roots[3];
} else {
delete json.json;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, messageParent, json, jsonkey;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
jsonkey = get_valid_key(requested);
json = parents[3];
parent = parents[0];
messageParent = parents[2];
} else {
jsonkey = key;
json = nodes[3];
parent = nodes[0];
messageParent = nodes[2];
}
var node = parent[key];
var message = messageParent && messageParent[key];
nodes[2] = message;
nodes[0] = node = merge_node(roots, parent, node, messageParent, message, key);
if (!is_top_level) {
parents[0] = parent;
parents[2] = messageParent;
return;
}
parents[3] = json;
if (is_branch) {
var length = requested.length;
var offset = roots.offset;
var type = is_object(node) && node.$type || undefined;
parents[0] = node;
parents[2] = message;
if ((length > offset) && (!type || type == $path)) {
nodes[3] = json[jsonkey] || (json[jsonkey] = {});
}
}
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
if (keyset == null && !roots.hasValue && (keyset = get_valid_key(optimized)) == null) {
node = clone(roots, node, type, node && node.value);
json = roots[3];
json.$type = node.$type;
json.value = node.value;
} else {
json = parents[3];
json[key] = clone(roots, node, type, node && node.value);
}
roots.hasValue = true;
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/get-valid-key":111,"../support/is-object":117,"../support/merge-node":120,"../support/options":122,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../types/path":135,"../walk/walk-path-set-soft-link":141}],89:[function(require,module,exports){
module.exports = set_json_graph_as_json_values;
var $path = require("../types/path");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var array_slice = require("../support/array-slice");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var merge_node = require("../support/merge-node");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_graph_as_json_values(model, envelopes, onNext, error_selector) {
var roots = [];
roots.offset = model._path.length;
roots.bound = [];
roots = options(roots, model, error_selector);
var index = -1;
var count = envelopes.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
roots[0] = roots.root;
roots.onNext = onNext;
while (++index < count) {
var envelope = envelopes[index];
var pathsets = envelope.paths;
var jsong = envelope.jsong || envelope.values || envelope.value;
var index2 = -1;
var count2 = pathsets.length;
roots[2] = jsong;
nodes[2] = jsong;
while (++index2 < count2) {
var pathset = pathsets[index2];
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: null,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset) {
var parent, messageParent;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
parent = parents[0];
messageParent = parents[2];
} else {
parent = nodes[0];
messageParent = nodes[2];
}
var node = parent[key];
var message = messageParent && messageParent[key];
nodes[2] = message;
nodes[0] = node = merge_node(roots, parent, node, messageParent, message, key);
if (!is_top_level) {
parents[0] = parent;
parents[2] = messageParent;
return;
}
if (is_branch) {
parents[0] = node;
parents[2] = message;
}
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset, is_keyset) {
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
roots.onNext({
path: array_slice(requested, roots.offset),
value: clone(roots, node, type, node && node.value)
});
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/array-slice":100,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/get-valid-key":111,"../support/is-object":117,"../support/merge-node":120,"../support/options":122,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../types/path":135,"../walk/walk-path-set-soft-link":141}],90:[function(require,module,exports){
module.exports = set_json_sparse_as_json_dense;
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_map = require("../walk/walk-path-map");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-map");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_sparse_as_json_dense(model, pathmaps, values, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathmaps.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var keys_stack = [];
var json, hasValue, hasValues;
roots[0] = roots.root;
while (++index < count) {
json = values && values[index];
if (is_object(json)) {
roots.json = roots[3] = parents[3] = nodes[3] = json.json || (json.json = {})
} else {
roots.json = roots[3] = parents[3] = nodes[3] = undefined;
}
var pathmap = pathmaps[index];
roots.index = index;
walk_path_map(onNode, onEdge, pathmap, keys_stack, 0, roots, parents, nodes, requested, optimized);
hasValue = roots.hasValue;
if (!!hasValue) {
hasValues = true;
if (is_object(json)) {
json.json = roots.json;
}
delete roots.json;
delete roots.hasValue;
} else if (is_object(json)) {
delete json.json;
}
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: hasValues,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathmap, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[3];
parent = parents[0];
} else {
json = is_keyset && nodes[3] || parents[3];
parent = nodes[0];
}
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
parents[3] = json;
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = nodes[0] = node;
if (is_keyset && !!json) {
nodes[3] = json[keyset] || (json[keyset] = {});
}
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = pathmap;
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
nodes[0] = node;
}
function onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathmap, keys_stack, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
if(keyset == null) {
roots.json = clone(roots, node, type, node && node.value);
} else if(!!(json = parents[3])) {
json[keyset] = clone(roots, node, type, node && node.value);
}
roots.hasValue = true;
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-map":128,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/path":135,"../types/sentinel":136,"../walk/walk-path-map":140}],91:[function(require,module,exports){
module.exports = set_json_sparse_as_json_graph;
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-graph-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_map = require("../walk/walk-path-map-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-map");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var promote = require("../lru/promote");
var collect = require("../lru/collect");
function set_json_sparse_as_json_graph(model, pathmaps, values, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathmaps.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var keys_stack = [];
var json = values[0];
var hasValue;
roots[0] = roots.root;
roots[1] = parents[1] = nodes[1] = json.jsong || (json.jsong = {});
roots.requestedPaths = json.paths || (json.paths = roots.requestedPaths);
while (++index < count) {
var pathmap = pathmaps[index];
walk_path_map(onNode, onEdge, pathmap, keys_stack, 0, roots, parents, nodes, requested, optimized);
}
hasValue = roots.hasValue;
if(hasValue) {
json.jsong = roots[1];
} else {
delete json.jsong;
delete json.paths;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: hasValue,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathmap, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[1];
parent = parents[0];
} else {
json = nodes[1];
parent = nodes[0];
}
var jsonkey = key;
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
parents[1] = json;
if (type == $path) {
json[jsonkey] = clone(roots, node, type, node.value);
roots.hasValue = true;
} else {
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
}
return;
}
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
type = node.$type;
parents[0] = nodes[0] = node;
parents[1] = json;
if (type == $path) {
json[jsonkey] = clone(roots, node, type, node.value);
roots.hasValue = true;
} else {
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
}
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = pathmap;
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
nodes[0] = node;
json[jsonkey] = clone(roots, node, type, node && node.value);
roots.hasValue = true;
}
function onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathmap, keys_stack, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
promote(roots.lru, node);
if (keyset == null && !roots.hasValue && (keyset = get_valid_key(optimized)) == null) {
node = clone(roots, node, type, node && node.value);
json = roots[1];
json.$type = node.$type;
json.value = node.value;
}
roots.hasValue = true;
}
}
},{"../lru/collect":81,"../lru/promote":82,"../support/array-clone":99,"../support/clone-graph-json":102,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-map":128,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/path":135,"../types/sentinel":136,"../walk/walk-path-map-soft-link":139}],92:[function(require,module,exports){
module.exports = set_json_sparse_as_json_sparse;
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_map = require("../walk/walk-path-map");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-map");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_sparse_as_json_sparse(model, pathmaps, values, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathmaps.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var keys_stack = [];
var json = values[0];
var hasValue;
roots[0] = roots.root;
roots[3] = parents[3] = nodes[3] = json.json || (json.json = {});
while (++index < count) {
var pathmap = pathmaps[index];
walk_path_map(onNode, onEdge, pathmap, keys_stack, 0, roots, parents, nodes, requested, optimized);
}
hasValue = roots.hasValue;
if(hasValue) {
json.json = roots[3];
} else {
delete json.json;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: hasValue,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathmap, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json, jsonkey;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
jsonkey = get_valid_key(requested);
json = parents[3];
parent = parents[0];
} else {
jsonkey = key;
json = nodes[3];
parent = nodes[0];
}
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
parents[3] = json;
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = nodes[0] = node;
nodes[3] = json[jsonkey] || (json[jsonkey] = {});
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = pathmap;
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
nodes[0] = node;
}
function onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathmap, keys_stack, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
if (keyset == null && !roots.hasValue && (keyset = get_valid_key(optimized)) == null) {
node = clone(roots, node, type, node && node.value);
json = roots[3];
json.$type = node.$type;
json.value = node.value;
} else {
json = parents[3];
json[key] = clone(roots, node, type, node && node.value);
}
roots.hasValue = true;
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-map":128,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/path":135,"../types/sentinel":136,"../walk/walk-path-map":140}],93:[function(require,module,exports){
module.exports = set_path_map_as_json_values;
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_map = require("../walk/walk-path-map");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-map");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_path_map_as_json_values(model, pathmaps, onNext, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathmaps.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var keys_stack = [];
roots[0] = roots.root;
roots.onNext = onNext;
while (++index < count) {
var pathmap = pathmaps[index];
walk_path_map(onNode, onEdge, pathmap, keys_stack, 0, roots, parents, nodes, requested, optimized);
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: null,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathmap, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
parent = parents[0];
} else {
parent = nodes[0];
}
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = nodes[0] = node;
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = pathmap;
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
nodes[0] = node;
}
function onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathmap, keys_stack, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
roots.onNext({
path: array_clone(requested),
value: clone(roots, node, type, node && node.value)
});
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-map":128,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/sentinel":136,"../walk/walk-path-map":140}],94:[function(require,module,exports){
module.exports = set_json_values_as_json_dense;
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var invalidate_node = require("../support/invalidate-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_values_as_json_dense(model, pathvalues, values, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathvalues.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json, hasValue, hasValues;
roots[0] = roots.root;
while (++index < count) {
json = values && values[index];
if (is_object(json)) {
roots.json = roots[3] = parents[3] = nodes[3] = json.json || (json.json = {})
} else {
roots.json = roots[3] = parents[3] = nodes[3] = undefined;
}
var pv = pathvalues[index];
var pathset = pv.path;
roots.value = pv.value;
roots.index = index;
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
hasValue = roots.hasValue;
if (!!hasValue) {
hasValues = true;
if (is_object(json)) {
json.json = roots.json;
}
delete roots.json;
delete roots.hasValue;
} else if (is_object(json)) {
delete json.json;
}
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: hasValues,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[3];
parent = parents[0];
} else {
json = is_keyset && nodes[3] || parents[3];
parent = nodes[0];
}
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
parents[3] = json;
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
if (is_keyset && !!json) {
nodes[3] = json[keyset] || (json[keyset] = {});
}
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = roots.value;
if(mess === undefined && roots.headless) {
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, roots.version, roots.lru);
node = undefined;
} else {
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
}
nodes[0] = node;
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
if(keyset == null) {
roots.json = clone(roots, node, type, node && node.value);
} else if(!!(json = parents[3])) {
json[keyset] = clone(roots, node, type, node && node.value);
}
roots.hasValue = true;
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/path":135,"../types/sentinel":136,"../walk/walk-path-set":142}],95:[function(require,module,exports){
module.exports = set_json_values_as_json_graph;
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-graph-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set-soft-link");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var invalidate_node = require("../support/invalidate-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var promote = require("../lru/promote");
var collect = require("../lru/collect");
function set_json_values_as_json_graph(model, pathvalues, values, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathvalues.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json = values[0];
var hasValue;
roots[0] = roots.root;
roots[1] = parents[1] = nodes[1] = json.jsong || (json.jsong = {});
roots.requestedPaths = json.paths || (json.paths = roots.requestedPaths);
while (++index < count) {
var pv = pathvalues[index];
var pathset = pv.path;
roots.value = pv.value;
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
hasValue = roots.hasValue;
if(hasValue) {
json.jsong = roots[1];
} else {
delete json.jsong;
delete json.paths;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: hasValue,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
json = parents[1];
parent = parents[0];
} else {
json = nodes[1];
parent = nodes[0];
}
var jsonkey = key;
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
parents[1] = json;
if (type == $path) {
json[jsonkey] = clone(roots, node, type, node.value);
roots.hasValue = true;
} else {
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
}
return;
}
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
type = node.$type;
parents[0] = parent;
nodes[0] = node;
parents[1] = json;
if (type == $path) {
json[jsonkey] = clone(roots, node, type, node.value);
roots.hasValue = true;
} else {
nodes[1] = json[jsonkey] || (json[jsonkey] = {});
}
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = roots.value;
if(mess === undefined && roots.headless) {
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, roots.version, roots.lru);
node = undefined;
} else {
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
}
nodes[0] = node;
json[jsonkey] = clone(roots, node, type, node && node.value);
roots.hasValue = true;
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
promote(roots.lru, node);
if (keyset == null && !roots.hasValue && (keyset = get_valid_key(optimized)) == null) {
node = clone(roots, node, type, node && node.value);
json = roots[1];
json.$type = node.$type;
json.value = node.value;
}
roots.hasValue = true;
}
}
},{"../lru/collect":81,"../lru/promote":82,"../support/array-clone":99,"../support/clone-graph-json":102,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/path":135,"../types/sentinel":136,"../walk/walk-path-set-soft-link":141}],96:[function(require,module,exports){
module.exports = set_json_values_as_json_sparse;
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var invalidate_node = require("../support/invalidate-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_values_as_json_sparse(model, pathvalues, values, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathvalues.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
var json = values[0];
var hasValue;
roots[0] = roots.root;
roots[3] = parents[3] = nodes[3] = json.json || (json.json = {});
while (++index < count) {
var pv = pathvalues[index];
var pathset = pv.path;
roots.value = pv.value;
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
hasValue = roots.hasValue;
if(hasValue) {
json.json = roots[3];
} else {
delete json.json;
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: values,
errors: roots.errors,
hasValue: hasValue,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent, json, jsonkey;
if (key == null) {
if ((key = get_valid_key(optimized)) == null) {
return;
}
jsonkey = get_valid_key(requested);
json = parents[3];
parent = parents[0];
} else {
jsonkey = key;
json = nodes[3];
parent = nodes[0];
}
var node = parent[key],
type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
parents[3] = json;
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
nodes[3] = json[jsonkey] || (json[jsonkey] = {});
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = roots.value;
if(mess === undefined && roots.headless) {
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, roots.version, roots.lru);
node = undefined;
} else {
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
}
nodes[0] = node;
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var json;
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
if (keyset == null && !roots.hasValue && (keyset = get_valid_key(optimized)) == null) {
node = clone(roots, node, type, node && node.value);
json = roots[3];
json.$type = node.$type;
json.value = node.value;
} else {
json = parents[3];
json[key] = clone(roots, node, type, node && node.value);
}
roots.hasValue = true;
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/path":135,"../types/sentinel":136,"../walk/walk-path-set":142}],97:[function(require,module,exports){
module.exports = set_json_values_as_json_values;
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var clone = require("../support/clone-dense-json");
var array_clone = require("../support/array-clone");
var options = require("../support/options");
var walk_path_set = require("../walk/walk-path-set");
var is_object = require("../support/is-object");
var get_valid_key = require("../support/get-valid-key");
var create_branch = require("../support/create-branch");
var wrap_node = require("../support/wrap-node");
var invalidate_node = require("../support/invalidate-node");
var replace_node = require("../support/replace-node");
var graph_node = require("../support/graph-node");
var update_back_refs = require("../support/update-back-refs");
var update_graph = require("../support/update-graph");
var inc_generation = require("../support/inc-generation");
var node_as_miss = require("../support/treat-node-as-missing-path-set");
var node_as_error = require("../support/treat-node-as-error");
var clone_success = require("../support/clone-success-paths");
var collect = require("../lru/collect");
function set_json_values_as_json_values(model, pathvalues, onNext, error_selector) {
var roots = options([], model, error_selector);
var index = -1;
var count = pathvalues.length;
var nodes = roots.nodes;
var parents = array_clone(nodes);
var requested = [];
var optimized = [];
roots[0] = roots.root;
roots.onNext = onNext;
while (++index < count) {
var pv = pathvalues[index];
var pathset = pv.path;
roots.value = pv.value;
walk_path_set(onNode, onEdge, pathset, 0, roots, parents, nodes, requested, optimized);
}
collect(
roots.lru,
roots.expired,
roots.version,
roots.root.$size || 0,
model._maxSize,
model._collectRatio
);
return {
values: null,
errors: roots.errors,
requestedPaths: roots.requestedPaths,
optimizedPaths: roots.optimizedPaths,
requestedMissingPaths: roots.requestedMissingPaths,
optimizedMissingPaths: roots.optimizedMissingPaths
};
}
function onNode(pathset, roots, parents, nodes, requested, optimized, is_top_level, is_branch, key, keyset, is_keyset) {
var parent;
if (key == null) {
if ((key = get_valid_key(optimized, nodes)) == null) {
return;
}
parent = parents[0];
} else {
parent = nodes[0];
}
var node = parent[key], type;
if (!is_top_level) {
type = is_object(node) && node.$type || undefined;
type = type && is_branch && "." || type;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
if (is_branch) {
type = is_object(node) && node.$type || undefined;
node = create_branch(roots, parent, node, type, key);
parents[0] = parent;
nodes[0] = node;
return;
}
var selector = roots.error_selector;
var root = roots[0];
var size = is_object(node) && node.$size || 0;
var mess = roots.value;
if(mess === undefined && roots.headless) {
invalidate_node(parent, node, key, roots.lru);
update_graph(parent, size, roots.version, roots.lru);
node = undefined;
} else {
type = is_object(mess) && mess.$type || undefined;
mess = wrap_node(mess, type, !!type ? mess.value : mess);
type || (type = $sentinel);
if (type == $error && !!selector) {
mess = selector(requested, mess);
}
node = replace_node(parent, node, mess, key, roots.lru);
node = graph_node(root, parent, node, key, inc_generation());
update_graph(parent, size - node.$size, roots.version, roots.lru);
}
nodes[0] = node;
}
function onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset) {
var node = nodes[0];
var type = is_object(node) && node.$type || (node = undefined);
if (node_as_miss(roots, node, type, pathset, depth, requested, optimized) === false) {
clone_success(roots, requested, optimized);
if (node_as_error(roots, node, type, requested) === false) {
roots.onNext({
path: array_clone(requested),
value: clone(roots, node, type, node && node.value)
});
}
}
}
},{"../lru/collect":81,"../support/array-clone":99,"../support/clone-dense-json":101,"../support/clone-success-paths":107,"../support/create-branch":109,"../support/get-valid-key":111,"../support/graph-node":112,"../support/inc-generation":113,"../support/invalidate-node":115,"../support/is-object":117,"../support/options":122,"../support/replace-node":125,"../support/treat-node-as-error":127,"../support/treat-node-as-missing-path-set":129,"../support/update-back-refs":131,"../support/update-graph":132,"../support/wrap-node":133,"../types/error":134,"../types/sentinel":136,"../walk/walk-path-set":142}],98:[function(require,module,exports){
module.exports = function(array, value) {
var i = -1;
var n = array.length;
var array2 = new Array(n + 1);
while(++i < n) { array2[i] = array[i]; }
array2[i] = value;
return array2;
};
},{}],99:[function(require,module,exports){
module.exports = function(array) {
var i = -1;
var n = array.length;
var array2 = new Array(n);
while(++i < n) { array2[i] = array[i]; }
return array2;
};
},{}],100:[function(require,module,exports){
module.exports = function(array, index) {
var i = -1;
var n = array.length - index;
var array2 = new Array(n);
while(++i < n) { array2[i] = array[i + index]; }
return array2;
};
},{}],101:[function(require,module,exports){
var $sentinel = require("../types/sentinel");
var clone = require("./clone");
module.exports = function(roots, node, type, value) {
if(node == null || value === undefined) {
return { $type: $sentinel };
}
if(roots.boxed == true) {
return !!type && clone(node) || node;
}
return value;
}
},{"../types/sentinel":136,"./clone":108}],102:[function(require,module,exports){
var $sentinel = require("../types/sentinel");
var clone = require("./clone");
var is_primitive = require("./is-primitive");
module.exports = function(roots, node, type, value) {
if(node == null || value === undefined) {
return { $type: $sentinel };
}
if(roots.boxed == true) {
return !!type && clone(node) || node;
}
if(!type || (type === $sentinel && is_primitive(value))) {
return value;
}
return clone(node);
}
},{"../types/sentinel":136,"./clone":108,"./is-primitive":118}],103:[function(require,module,exports){
var clone_requested = require("./clone-requested-path");
var clone_optimized = require("./clone-optimized-path");
var walk_path_map = require("../walk/walk-path-map-soft-link");
var is_object = require("./is-object");
var empty = [];
module.exports = function(roots, pathmap, keys_stack, depth, requested, optimized) {
var patset_keys = explode_keys(pathmap, keys_stack.concat(), depth);
var pathset = patset_keys.map(function(keys) {
keys = keys.filter(function(key) { return key != "null"; });
switch(keys.length) {
case 0:
return null;
case 1:
return keys[0];
default:
return keys;
}
});
roots.requestedMissingPaths.push(clone_requested(roots.bound, requested, pathset, depth, roots.index));
roots.optimizedMissingPaths.push(clone_optimized(optimized, pathset, depth));
}
function explode_keys(pathmap, keys_stack, depth) {
if(is_object(pathmap)) {
var keys = Object.keys(pathmap);
var keys2 = keys_stack[depth] || (keys_stack[depth] = []);
keys2.push.apply(keys2, keys);
keys.forEach(function(key) {
explode_keys(pathmap[key], keys_stack, depth + 1);
});
}
return keys_stack;
}
},{"../walk/walk-path-map-soft-link":139,"./clone-optimized-path":105,"./clone-requested-path":106,"./is-object":117}],104:[function(require,module,exports){
var clone_requested_path = require("./clone-requested-path");
var clone_optimized_path = require("./clone-optimized-path");
module.exports = function(roots, pathset, depth, requested, optimized) {
roots.requestedMissingPaths.push(clone_requested_path(roots.bound, requested, pathset, depth, roots.index));
roots.optimizedMissingPaths.push(clone_optimized_path(optimized, pathset, depth));
}
},{"./clone-optimized-path":105,"./clone-requested-path":106}],105:[function(require,module,exports){
module.exports = function(optimized, pathset, depth) {
var x;
var i = -1;
var j = depth - 1;
var n = optimized.length;
var m = pathset.length;
var array2 = [];
while(++i < n) {
array2[i] = optimized[i];
}
while(++j < m) {
if((x = pathset[j]) != null) {
array2[i++] = x;
}
}
return array2;
}
},{}],106:[function(require,module,exports){
var is_object = require("./is-object");
module.exports = function(bound, requested, pathset, depth, index) {
var x;
var i = -1;
var j = -1;
var l = 0;
var m = requested.length;
var n = bound.length;
var array2 = [];
while(++i < n) {
array2[i] = bound[i];
}
while(++j < m) {
if((x = requested[j]) != null) {
if(is_object(pathset[l++])) {
array2[i++] = [x];
} else {
array2[i++] = x;
}
}
}
m = n + l + pathset.length - depth;
while(i < m) {
array2[i++] = pathset[l++];
}
if(index != null) {
array2.pathSetIndex = index;
}
return array2;
}
},{"./is-object":117}],107:[function(require,module,exports){
var array_slice = require("./array-slice");
var array_clone = require("./array-clone");
module.exports = function(roots, requested, optimized) {
roots.requestedPaths.push(array_slice(requested, roots.offset));
roots.optimizedPaths.push(array_clone(optimized));
}
},{"./array-clone":99,"./array-slice":100}],108:[function(require,module,exports){
var is_object = require("./is-object");
var prefix = require("../internal/prefix");
module.exports = function(value) {
var dest = value, src = dest, i = -1, n, keys, key;
if(is_object(dest)) {
dest = {};
keys = Object.keys(src);
n = keys.length;
while(++i < n) {
key = keys[i];
if(key[0] !== prefix) {
dest[key] = src[key];
}
}
}
return dest;
}
},{"../internal/prefix":69,"./is-object":117}],109:[function(require,module,exports){
var $path = require("../types/path");
var $expired = "expired";
var replace_node = require("./replace-node");
var graph_node = require("./graph-node");
var update_back_refs = require("./update-back-refs");
var is_primitive = require("./is-primitive");
var is_expired = require("./is-expired");
module.exports = function(roots, parent, node, type, key) {
if(!!type && is_expired(roots, node)) {
type = $expired;
}
if((!!type && type != $path) || is_primitive(node)) {
node = replace_node(parent, node, {}, key, roots.lru);
node = graph_node(roots[0], parent, node, key, 0);
node = update_back_refs(node, roots.version);
}
return node;
}
},{"../types/path":135,"./graph-node":112,"./is-expired":116,"./is-primitive":118,"./replace-node":125,"./update-back-refs":131}],110:[function(require,module,exports){
var __ref = require("../internal/ref");
var __context = require("../internal/context");
var __ref_index = require("../internal/ref-index");
var __refs_length = require("../internal/refs-length");
module.exports = function(node) {
var ref, i = -1, n = node[__refs_length] || 0;
while(++i < n) {
if((ref = node[__ref + i]) !== undefined) {
ref[__context] = ref[__ref_index] = node[__ref + i] = undefined;
}
}
node[__refs_length] = undefined
}
},{"../internal/context":61,"../internal/ref":72,"../internal/ref-index":71,"../internal/refs-length":73}],111:[function(require,module,exports){
module.exports = function(path) {
var key, index = path.length - 1;
do {
if((key = path[index]) != null) {
return key;
}
} while(--index > -1);
return null;
}
},{}],112:[function(require,module,exports){
var __parent = require("../internal/parent");
var __key = require("../internal/key");
var __generation = require("../internal/generation");
module.exports = function(root, parent, node, key, generation) {
node[__parent] = parent;
node[__key] = key;
node[__generation] = generation;
return node;
}
},{"../internal/generation":62,"../internal/key":65,"../internal/parent":68}],113:[function(require,module,exports){
var generation = 0;
module.exports = function() { return generation++; }
},{}],114:[function(require,module,exports){
var version = 0;
module.exports = function() { return version++; }
},{}],115:[function(require,module,exports){
module.exports = invalidate;
var is_object = require("./is-object");
var remove_node = require("./remove-node");
var prefix = require("../internal/prefix");
function invalidate(parent, node, key, lru) {
if(remove_node(parent, node, key, lru)) {
var type = is_object(node) && node.$type || undefined;
if(type == null) {
var keys = Object.keys(node);
for(var i = -1, n = keys.length; ++i < n;) {
var key = keys[i];
if(key[0] !== prefix && key[0] !== "$") {
invalidate(node, node[key], key, lru);
}
}
}
return true;
}
return false;
}
},{"../internal/prefix":69,"./is-object":117,"./remove-node":124}],116:[function(require,module,exports){
var $expires_now = require("../values/expires-now");
var $expires_never = require("../values/expires-never");
var __invalidated = require("../internal/invalidated");
var now = require("./now");
var splice = require("../lru/splice");
module.exports = function(roots, node) {
var expires = node.$expires;
if((expires != null ) && (
expires != $expires_never ) && (
expires == $expires_now || expires < now())) {
if(!node[__invalidated]) {
node[__invalidated] = true;
roots.expired.push(node);
splice(roots.lru, node);
}
return true;
}
return false;
}
},{"../internal/invalidated":64,"../lru/splice":83,"../values/expires-never":137,"../values/expires-now":138,"./now":121}],117:[function(require,module,exports){
var obj_typeof = "object";
module.exports = function(value) {
return value != null && typeof value == obj_typeof;
}
},{}],118:[function(require,module,exports){
var obj_typeof = "object";
module.exports = function(value) {
return value == null || typeof value != obj_typeof;
}
},{}],119:[function(require,module,exports){
module.exports = key_to_keyset;
var __offset = require("../internal/offset");
var is_array = Array.isArray;
var is_object = require("./is-object");
function key_to_keyset(key, iskeyset) {
if(iskeyset) {
if(is_array(key)) {
key = key[key[__offset]];
return key_to_keyset(key, is_object(key));
} else {
return key[__offset];
}
}
return key;
}
},{"../internal/offset":67,"./is-object":117}],120:[function(require,module,exports){
var $self = "./";
var $path = require("../types/path");
var $sentinel = require("../types/sentinel");
var $expires_now = require("../values/expires-now");
var is_object = require("./is-object");
var is_primitive = require("./is-primitive");
var is_expired = require("./is-expired");
var promote = require("../lru/promote");
var wrap_node = require("./wrap-node");
var graph_node = require("./graph-node");
var replace_node = require("../support/replace-node");
var update_graph = require("../support/update-graph");
var inc_generation = require("./inc-generation");
var invalidate_node = require("./invalidate-node");
module.exports = function(roots, parent, node, messageParent, message, key) {
var type, messageType, node_is_object, message_is_object;
// If the cache and message are the same, we can probably return early:
// - If they're both null, return null.
// - If they're both branches, return the branch.
// - If they're both edges, continue below.
if(node == message) {
if(node == null) {
return null;
} else if(node_is_object = is_object(node)) {
type = node.$type;
if(type == null) {
if(node[$self] == null) {
return graph_node(roots[0], parent, node, key, 0);
}
return node;
}
}
} else if(node_is_object = is_object(node)) {
type = node.$type;
}
var value, messageValue;
if(type == $path) {
if(message == null) {
// If the cache is an expired reference, but the message
// is empty, remove the cache value and return undefined
// so we build a missing path.
if(is_expired(roots, node)) {
invalidate_node(parent, node, key, roots.lru);
return undefined;
}
// If the cache has a reference and the message is empty,
// leave the cache alone and follow the reference.
return node;
} else if(message_is_object = is_object(message)) {
messageType = message.$type;
// If the cache and the message are both references,
// check if we need to replace the cache reference.
if(messageType == $path) {
if(node === message) {
// If the cache and message are the same reference,
// we performed a whole-branch merge of one of the
// grandparents. If we've previously graphed this
// reference, break early.
if(node[$self] != null) {
return node;
}
}
// If the message doesn't expire immediately and is newer than the
// cache (or either cache or message don't have timestamps), attempt
// to use the message value.
// Note: Number and `undefined` compared LT/GT to `undefined` is `false`.
else if((
is_expired(roots, message) === false) && ((
message.$timestamp < node.$timestamp) === false)) {
// Compare the cache and message references.
// - If they're the same, break early so we don't insert.
// - If they're different, replace the cache reference.
value = node.value;
messageValue = message.value;
var count = value.length;
// If the reference lengths are equal, check their keys for equality.
if(count === messageValue.length) {
while(--count > -1) {
// If any of their keys are different, replace the reference
// in the cache with the reference in the message.
if(value[count] !== messageValue[count]) {
break;
}
}
// If all their keys are equal, leave the cache value alone.
if(count === -1) {
return node;
}
}
}
}
}
} else {
if(message_is_object = is_object(message)) {
messageType = message.$type;
}
if(node_is_object && !type) {
// Otherwise if the cache is a branch and the message is either
// null or also a branch, continue with the cache branch.
if(message == null || (message_is_object && !messageType)) {
return node;
}
}
}
// If the message is an expired edge, report it back out so we don't build a missing path, but
// don't insert it into the cache. If a value exists in the cache that didn't come from a
// whole-branch grandparent merge, remove the cache value.
if(!!messageType && !!message[$self] && is_expired(roots, message)) {
if(node_is_object && node != message) {
invalidate_node(parent, node, key, roots.lru);
}
return message;
}
// If the cache is a value, but the message is a branch, merge the branch over the value.
else if(!!type && message_is_object && !messageType) {
node = replace_node(parent, node, message, key, roots.lru);
return graph_node(roots[0], parent, node, key, 0);
}
// If the message is a value, insert it into the cache.
else if(!message_is_object || !!messageType) {
var offset = 0;
// If we've arrived at this message value, but didn't perform a whole-branch merge
// on one of its ancestors, replace the cache node with the message value.
if(node != message) {
messageValue || (messageValue = !!messageType ? message.value : message);
message = wrap_node(message, messageType, messageValue);
var size = node_is_object && node.$size || 0;
var messageSize = message.$size;
offset = size - messageSize;
node = replace_node(parent, node, message, key, roots.lru);
update_graph(parent, offset, roots.version, roots.lru);
node = graph_node(roots[0], parent, node, key, inc_generation());
}
// If the cache and the message are the same value, we branch-merged one of its
// ancestors. Give the message a $size and $type, attach its graph pointers, and
// update the cache sizes and generations.
else if(node_is_object && node[$self] == null) {
node = parent[key] = wrap_node(node, type, node.value);
offset = -node.$size;
update_graph(parent, offset, roots.version, roots.lru);
node = graph_node(roots[0], parent, node, key, inc_generation());
}
// Otherwise, cache and message are the same primitive value. Wrap in a sentinel and insert.
else {
node = parent[key] = wrap_node(node, type, node);
offset = -node.$size;
update_graph(parent, offset, roots.version, roots.lru);
node = graph_node(roots[0], parent, node, key, inc_generation());
}
// If the node is already expired, return undefined to build a missing path.
// if(is_expired(roots, node)) {
// return undefined;
// }
// Promote the message edge in the LRU.
promote(roots.lru, node);
}
// If we get here, the cache is empty and the message is a branch.
// Merge the whole branch over.
else if(node == null) {
node = parent[key] = graph_node(roots[0], parent, message, key, 0);
}
return node;
}
},{"../lru/promote":82,"../support/replace-node":125,"../support/update-graph":132,"../types/path":135,"../types/sentinel":136,"../values/expires-now":138,"./graph-node":112,"./inc-generation":113,"./invalidate-node":115,"./is-expired":116,"./is-object":117,"./is-primitive":118,"./wrap-node":133}],121:[function(require,module,exports){
module.exports = Date.now;
},{}],122:[function(require,module,exports){
var inc_version = require("../support/inc-version");
var getBoundValue = require('../get/getBoundValue');
module.exports = function(options, model, error_selector) {
var bound = options.bound || (options.bound = model._path || []);
var root = options.root || (options.root = model._cache);
var nodes = options.nodes || (options.nodes = []);
var lru = options.lru || (options.lru = model._root);
options.expired || (options.expired = lru.expired);
options.errors || (options.errors = []);
options.requestedPaths || (options.requestedPaths = []);
options.optimizedPaths || (options.optimizedPaths = []);
options.requestedMissingPaths || (options.requestedMissingPaths = []);
options.optimizedMissingPaths || (options.optimizedMissingPaths = []);
options.boxed = model._boxed || false;
options.materialized = model._materialized;
options.errorsAsValues = model._treatErrorsAsValues || false;
options.headless = model._dataSource == null;
options.version = inc_version();
options.offset || (options.offset = 0);
options.error_selector = error_selector || model._errorSelector;
if(bound.length) {
nodes[0] = getBoundValue(model, bound).value;
} else {
nodes[0] = root;
}
return options;
};
},{"../get/getBoundValue":44,"../support/inc-version":114}],123:[function(require,module,exports){
module.exports = permute_keyset;
var __offset = require("../internal/offset");
var is_array = Array.isArray;
var is_object = require("./is-object");
function permute_keyset(key) {
if(is_array(key)) {
if(key[__offset] === undefined) {
key[__offset] = -1;
if(key.length == 0) {
return false;
}
}
if(++key[__offset] >= key.length) {
return permute_keyset(key[key[__offset] = -1]);
} else {
return true;
}
} else if(is_object(key)) {
if(key[__offset] === undefined) {
key[__offset] = (key.from || (key.from = 0)) - 1;
if(key.to === undefined) {
if(key.length === undefined) {
throw new Error("Range keysets must specify at least one index to retrieve.");
} else if(key.length === 0) {
return false;
}
key.to = key.from + (key.length || 1) - 1;
}
}
if(++key[__offset] > key.to) {
key[__offset] = key.from - 1;
return false;
}
return true;
}
return false;
}
},{"../internal/offset":67,"./is-object":117}],124:[function(require,module,exports){
var $path = require("../types/path");
var __parent = require("../internal/parent");
var unlink = require("./unlink");
var delete_back_refs = require("./delete-back-refs");
var splice = require("../lru/splice");
var is_object = require("./is-object");
module.exports = function(parent, node, key, lru) {
if(is_object(node)) {
var type = node.$type;
if(!!type) {
if(type == $path) { unlink(node); }
splice(lru, node);
}
delete_back_refs(node);
parent[key] = node[__parent] = undefined;
return true;
}
return false;
}
},{"../internal/parent":68,"../lru/splice":83,"../types/path":135,"./delete-back-refs":110,"./is-object":117,"./unlink":130}],125:[function(require,module,exports){
var transfer_back_refs = require("./transfer-back-refs");
var invalidate_node = require("./invalidate-node");
module.exports = function(parent, node, replacement, key, lru) {
if(node != null && node !== replacement && typeof node == "object") {
transfer_back_refs(node, replacement);
invalidate_node(parent, node, key, lru);
}
return parent[key] = replacement;
}
},{"./invalidate-node":115,"./transfer-back-refs":126}],126:[function(require,module,exports){
var __ref = require("../internal/ref");
var __context = require("../internal/context");
var __refs_length = require("../internal/refs-length");
module.exports = function(node, dest) {
var nodeRefsLength = node[__refs_length] || 0,
destRefsLength = dest[__refs_length] || 0,
i = -1, ref;
while(++i < nodeRefsLength) {
ref = node[__ref + i];
if(ref !== undefined) {
ref[__context] = dest;
dest[__ref + (destRefsLength + i)] = ref;
node[__ref + i] = undefined;
}
}
dest[__refs_length] = nodeRefsLength + destRefsLength;
node[__refs_length] = ref = undefined;
}
},{"../internal/context":61,"../internal/ref":72,"../internal/refs-length":73}],127:[function(require,module,exports){
var $error = require("../types/error");
var promote = require("../lru/promote");
var array_clone = require("./array-clone");
module.exports = function(roots, node, type, path) {
if(node == null) {
return false;
}
promote(roots.lru, node);
if(type != $error || roots.errorsAsValues) {
return false;
}
roots.errors.push({ path: array_clone(path), value: node.value });
return true;
};
},{"../lru/promote":82,"../types/error":134,"./array-clone":99}],128:[function(require,module,exports){
var $sentinel = require("../types/sentinel");
var clone_misses = require("./clone-missing-path-maps");
var is_expired = require("./is-expired");
module.exports = function(roots, node, type, pathmap, keys_stack, depth, requested, optimized) {
var dematerialized = !roots.materialized;
if(node == null && dematerialized) {
clone_misses(roots, pathmap, keys_stack, depth, requested, optimized);
return true;
} else if(!!type) {
if(type == $sentinel && node.value === undefined && dematerialized && !roots.boxed) {
return true;
} else if(is_expired(roots, node)) {
clone_misses(roots, pathmap, keys_stack, depth, requested, optimized);
return true;
}
}
return false;
};
},{"../types/sentinel":136,"./clone-missing-path-maps":103,"./is-expired":116}],129:[function(require,module,exports){
var $sentinel = require("../types/sentinel");
var clone_misses = require("./clone-missing-path-sets");
var is_expired = require("./is-expired");
module.exports = function(roots, node, type, pathset, depth, requested, optimized) {
var dematerialized = !roots.materialized;
if(node == null && dematerialized) {
clone_misses(roots, pathset, depth, requested, optimized);
return true;
} else if(!!type) {
if(type == $sentinel && node.value === undefined && dematerialized && !roots.boxed) {
return true;
} else if(is_expired(roots, node)) {
clone_misses(roots, pathset, depth, requested, optimized);
return true;
}
}
return false;
};
},{"../types/sentinel":136,"./clone-missing-path-sets":104,"./is-expired":116}],130:[function(require,module,exports){
var __ref = require("../internal/ref");
var __context = require("../internal/context");
var __ref_index = require("../internal/ref-index");
var __refs_length = require("../internal/refs-length");
module.exports = function(ref) {
var destination = ref[__context];
if(destination) {
var i = (ref[__ref_index] || 0) - 1,
n = (destination[__refs_length] || 0) - 1;
while(++i <= n) {
destination[__ref + i] = destination[__ref + (i + 1)];
}
destination[__refs_length] = n;
ref[__ref_index] = ref[__context] = destination = undefined;
}
}
},{"../internal/context":61,"../internal/ref":72,"../internal/ref-index":71,"../internal/refs-length":73}],131:[function(require,module,exports){
module.exports = update_back_refs;
var __ref = require("../internal/ref");
var __parent = require("../internal/parent");
var __version = require("../internal/version");
var __generation = require("../internal/generation");
var __refs_length = require("../internal/refs-length");
var generation = require("./inc-generation");
function update_back_refs(node, version) {
if(node && node[__version] !== version) {
node[__version] = version;
node[__generation] = generation();
update_back_refs(node[__parent], version);
var i = -1, n = node[__refs_length] || 0;
while(++i < n) {
update_back_refs(node[__ref + i], version);
}
}
return node;
}
},{"../internal/generation":62,"../internal/parent":68,"../internal/ref":72,"../internal/refs-length":73,"../internal/version":75,"./inc-generation":113}],132:[function(require,module,exports){
var __key = require("../internal/key");
var __version = require("../internal/version");
var __parent = require("../internal/parent");
var remove_node = require("./remove-node");
var update_back_refs = require("./update-back-refs");
module.exports = function(node, offset, version, lru) {
var child;
while(child = node) {
node = child[__parent];
if((child.$size = (child.$size || 0) - offset) <= 0 && node != null) {
remove_node(node, child, child[__key], lru);
} else if(child[__version] !== version) {
update_back_refs(child, version);
}
}
}
},{"../internal/key":65,"../internal/parent":68,"../internal/version":75,"./remove-node":124,"./update-back-refs":131}],133:[function(require,module,exports){
var $path = require("../types/path");
var $error = require("../types/error");
var $sentinel = require("../types/sentinel");
var now = require("./now");
var clone = require("./clone");
var is_array = Array.isArray;
var is_object = require("./is-object");
module.exports = function(node, type, value) {
var dest = node, size = 0;
if(!!type) {
dest = clone(node);
size = dest.$size;
// }
// if(type == $path) {
// dest = clone(node);
// size = 50 + (value.length || 1);
// } else if(is_object(node) && (type || (type = node.$type))) {
// dest = clone(node);
// size = dest.$size;
} else {
dest = { value: value };
type = $sentinel;
}
if(size <= 0 || size == null) {
switch(typeof value) {
case "number":
case "boolean":
case "function":
case "undefined":
size = 51;
break;
case "object":
size = is_array(value) && (50 + value.length) || 51;
break;
case "string":
size = 50 + value.length;
break;
}
}
var expires = is_object(node) && node.$expires || undefined;
if(typeof expires === "number" && expires < 0) {
dest.$expires = now() + (expires * -1);
}
dest.$type = type;
dest.$size = size;
return dest;
}
},{"../types/error":134,"../types/path":135,"../types/sentinel":136,"./clone":108,"./is-object":117,"./now":121}],134:[function(require,module,exports){
module.exports = "error";
},{}],135:[function(require,module,exports){
module.exports = "ref";
},{}],136:[function(require,module,exports){
module.exports = "sentinel";
},{}],137:[function(require,module,exports){
module.exports = 1;
},{}],138:[function(require,module,exports){
module.exports = 0;
},{}],139:[function(require,module,exports){
module.exports = walk_path_map;
var prefix = require("../internal/prefix");
var $path = require("../types/path");
var walk_reference = require("./walk-reference");
var array_slice = require("../support/array-slice");
var array_clone = require("../support/array-clone");
var array_append = require("../support/array-append");
var is_expired = require("../support/is-expired");
var is_primitive = require("../support/is-primitive");
var is_object = require("../support/is-object");
var is_array = Array.isArray;
var promote = require("../lru/promote");
function walk_path_map(onNode, onEdge, pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset, is_keyset) {
var node = nodes[0];
if(is_primitive(pathmap) || is_primitive(node)) {
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var type = node.$type;
while(type === $path) {
if(is_expired(roots, node)) {
nodes[0] = undefined;
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
promote(roots.lru, node);
var container = node;
var reference = node.value;
nodes[0] = parents[0] = roots[0];
nodes[1] = parents[1] = roots[1];
nodes[2] = parents[2] = roots[2];
walk_reference(onNode, container, reference, roots, parents, nodes, requested, optimized);
node = nodes[0];
if(node == null) {
optimized = array_clone(reference);
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
} else if(is_primitive(node) || ((type = node.$type) && type != $path)) {
onNode(pathmap, roots, parents, nodes, requested, optimized, true, null, keyset, false);
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, array_append(requested, null), optimized, key, keyset);
}
}
if(type != null) {
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var keys = keys_stack[depth] = Object.keys(pathmap);
if(keys.length == 0) {
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var is_outer_keyset = keys.length > 1;
for(var i = -1, n = keys.length; ++i < n;) {
var inner_key = keys[i];
if((inner_key[0] === prefix) || (inner_key[0] === "$")) {
continue;
}
var inner_keyset = is_outer_keyset ? inner_key : keyset;
var nodes2 = array_clone(nodes);
var parents2 = array_clone(parents);
var pathmap2 = pathmap[inner_key];
var requested2, optimized2, is_branch;
var has_child_key = false;
var is_branch = is_object(pathmap2) && !pathmap2.$type;// && !is_array(pathmap2);
if(is_branch) {
for(child_key in pathmap2) {
if((child_key[0] === prefix) || (child_key[0] === "$")) {
continue;
}
child_key = pathmap2.hasOwnProperty(child_key);
break;
}
is_branch = child_key === true;
}
if(inner_key == "null") {
requested2 = array_append(requested, null);
optimized2 = array_clone(optimized);
inner_key = key;
inner_keyset = keyset;
pathmap2 = pathmap;
onNode(pathmap2, roots, parents2, nodes2, requested2, optimized2, true, is_branch, null, inner_keyset, false);
} else {
requested2 = array_append(requested, inner_key);
optimized2 = array_append(optimized, inner_key);
onNode(pathmap2, roots, parents2, nodes2, requested2, optimized2, true, is_branch, inner_key, inner_keyset, is_outer_keyset);
}
if(is_branch) {
walk_path_map(onNode, onEdge,
pathmap2, keys_stack, depth + 1,
roots, parents2, nodes2,
requested2, optimized2,
inner_key, inner_keyset, is_outer_keyset
);
} else {
onEdge(pathmap2, keys_stack, depth, roots, parents2, nodes2, requested2, optimized2, inner_key, inner_keyset);
}
}
}
},{"../internal/prefix":69,"../lru/promote":82,"../support/array-append":98,"../support/array-clone":99,"../support/array-slice":100,"../support/is-expired":116,"../support/is-object":117,"../support/is-primitive":118,"../types/path":135,"./walk-reference":143}],140:[function(require,module,exports){
module.exports = walk_path_map;
var prefix = require("../internal/prefix");
var __context = require("../internal/context");
var $path = require("../types/path");
var walk_reference = require("./walk-reference");
var array_slice = require("../support/array-slice");
var array_clone = require("../support/array-clone");
var array_append = require("../support/array-append");
var is_expired = require("../support/is-expired");
var is_primitive = require("../support/is-primitive");
var is_object = require("../support/is-object");
var is_array = Array.isArray;
var promote = require("../lru/promote");
function walk_path_map(onNode, onEdge, pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset, is_keyset) {
var node = nodes[0];
if(is_primitive(pathmap) || is_primitive(node)) {
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var type = node.$type;
while(type === $path) {
if(is_expired(roots, node)) {
nodes[0] = undefined;
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
promote(roots.lru, node);
var container = node;
var reference = node.value;
node = node[__context];
if(node != null) {
type = node.$type;
optimized = array_clone(reference);
nodes[0] = node;
} else {
nodes[0] = parents[0] = roots[0];
walk_reference(onNode, container, reference, roots, parents, nodes, requested, optimized);
node = nodes[0];
if(node == null) {
optimized = array_clone(reference);
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
} else if(is_primitive(node) || ((type = node.$type) && type != $path)) {
onNode(pathmap, roots, parents, nodes, requested, optimized, true, null, keyset, false);
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, array_append(requested, null), optimized, key, keyset);
}
}
}
if(type != null) {
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var keys = keys_stack[depth] = Object.keys(pathmap);
if(keys.length == 0) {
return onEdge(pathmap, keys_stack, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var is_outer_keyset = keys.length > 1;
for(var i = -1, n = keys.length; ++i < n;) {
var inner_key = keys[i];
if((inner_key[0] === prefix) || (inner_key[0] === "$")) {
continue;
}
var inner_keyset = is_outer_keyset ? inner_key : keyset;
var nodes2 = array_clone(nodes);
var parents2 = array_clone(parents);
var pathmap2 = pathmap[inner_key];
var requested2, optimized2, is_branch;
var child_key = false;
var is_branch = is_object(pathmap2) && !pathmap2.$type;// && !is_array(pathmap2);
if(is_branch) {
for(child_key in pathmap2) {
if((child_key[0] === prefix) || (child_key[0] === "$")) {
continue;
}
child_key = pathmap2.hasOwnProperty(child_key);
break;
}
is_branch = child_key === true;
}
if(inner_key == "null") {
requested2 = array_append(requested, null);
optimized2 = array_clone(optimized);
inner_key = key;
inner_keyset = keyset;
pathmap2 = pathmap;
onNode(pathmap2, roots, parents2, nodes2, requested2, optimized2, true, is_branch, null, inner_keyset, false);
} else {
requested2 = array_append(requested, inner_key);
optimized2 = array_append(optimized, inner_key);
onNode(pathmap2, roots, parents2, nodes2, requested2, optimized2, true, is_branch, inner_key, inner_keyset, is_outer_keyset);
}
if(is_branch) {
walk_path_map(onNode, onEdge,
pathmap2, keys_stack, depth + 1,
roots, parents2, nodes2,
requested2, optimized2,
inner_key, inner_keyset, is_outer_keyset
);
} else {
onEdge(pathmap2, keys_stack, depth, roots, parents2, nodes2, requested2, optimized2, inner_key, inner_keyset);
}
}
}
},{"../internal/context":61,"../internal/prefix":69,"../lru/promote":82,"../support/array-append":98,"../support/array-clone":99,"../support/array-slice":100,"../support/is-expired":116,"../support/is-object":117,"../support/is-primitive":118,"../types/path":135,"./walk-reference":143}],141:[function(require,module,exports){
module.exports = walk_path_set;
var $path = require("../types/path");
var empty_array = new Array(0);
var walk_reference = require("./walk-reference");
var array_slice = require("../support/array-slice");
var array_clone = require("../support/array-clone");
var array_append = require("../support/array-append");
var is_expired = require("../support/is-expired");
var is_primitive = require("../support/is-primitive");
var is_object = require("../support/is-object");
var keyset_to_key = require("../support/keyset-to-key");
var permute_keyset = require("../support/permute-keyset");
var promote = require("../lru/promote");
function walk_path_set(onNode, onEdge, pathset, depth, roots, parents, nodes, requested, optimized, key, keyset, is_keyset) {
var node = nodes[0];
if(depth >= pathset.length || is_primitive(node)) {
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var type = node.$type;
while(type === $path) {
if(is_expired(roots, node)) {
nodes[0] = undefined;
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
promote(roots.lru, node);
var container = node;
var reference = node.value;
nodes[0] = parents[0] = roots[0];
nodes[1] = parents[1] = roots[1];
nodes[2] = parents[2] = roots[2];
walk_reference(onNode, container, reference, roots, parents, nodes, requested, optimized);
node = nodes[0];
if(node == null) {
optimized = array_clone(reference);
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
} else if(is_primitive(node) || ((type = node.$type) && type != $path)) {
onNode(pathset, roots, parents, nodes, requested, optimized, true, false, null, keyset, false);
return onEdge(pathset, depth, roots, parents, nodes, array_append(requested, null), optimized, key, keyset);
}
}
if(type != null) {
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var outer_key = pathset[depth];
var is_outer_keyset = is_object(outer_key);
var is_branch = depth < pathset.length - 1;
var run_once = false;
while(is_outer_keyset && permute_keyset(outer_key) && (run_once = true) || (run_once = !run_once)) {
var inner_key, inner_keyset;
if(is_outer_keyset === true) {
inner_key = keyset_to_key(outer_key, true);
inner_keyset = inner_key;
} else {
inner_key = outer_key;
inner_keyset = keyset;
}
var nodes2 = array_clone(nodes);
var parents2 = array_clone(parents);
var requested2, optimized2;
if(inner_key == null) {
requested2 = array_append(requested, null);
optimized2 = array_clone(optimized);
// optimized2 = optimized;
inner_key = key;
inner_keyset = keyset;
onNode(pathset, roots, parents2, nodes2, requested2, optimized2, true, is_branch, null, inner_keyset, false);
} else {
requested2 = array_append(requested, inner_key);
optimized2 = array_append(optimized, inner_key);
onNode(pathset, roots, parents2, nodes2, requested2, optimized2, true, is_branch, inner_key, inner_keyset, is_outer_keyset);
}
walk_path_set(onNode, onEdge,
pathset, depth + 1,
roots, parents2, nodes2,
requested2, optimized2,
inner_key, inner_keyset, is_outer_keyset
);
}
}
},{"../lru/promote":82,"../support/array-append":98,"../support/array-clone":99,"../support/array-slice":100,"../support/is-expired":116,"../support/is-object":117,"../support/is-primitive":118,"../support/keyset-to-key":119,"../support/permute-keyset":123,"../types/path":135,"./walk-reference":143}],142:[function(require,module,exports){
module.exports = walk_path_set;
var prefix = require("../internal/prefix");
var __context = require("../internal/context");
var $path = require("../types/path");
var empty_array = new Array(0);
var walk_reference = require("./walk-reference");
var array_slice = require("../support/array-slice");
var array_clone = require("../support/array-clone");
var array_append = require("../support/array-append");
var is_expired = require("../support/is-expired");
var is_primitive = require("../support/is-primitive");
var is_object = require("../support/is-object");
var keyset_to_key = require("../support/keyset-to-key");
var permute_keyset = require("../support/permute-keyset");
var promote = require("../lru/promote");
function walk_path_set(onNode, onEdge, pathset, depth, roots, parents, nodes, requested, optimized, key, keyset, is_keyset) {
var node = nodes[0];
if(depth >= pathset.length || is_primitive(node)) {
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var type = node.$type;
while(type === $path) {
if(is_expired(roots, node)) {
nodes[0] = undefined;
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
promote(roots.lru, node);
var container = node;
var reference = node.value;
node = node[__context];
if(node != null) {
type = node.$type;
optimized = array_clone(reference);
nodes[0] = node;
} else {
nodes[0] = parents[0] = roots[0];
// nodes[1] = parents[1] = roots[1];
// nodes[2] = parents[2] = roots[2];
walk_reference(onNode, container, reference, roots, parents, nodes, requested, optimized);
node = nodes[0];
if(node == null) {
optimized = array_clone(reference);
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
} else if(is_primitive(node) || ((type = node.$type) && type != $path)) {
onNode(pathset, roots, parents, nodes, requested, optimized, true, false, null, keyset, false);
return onEdge(pathset, depth, roots, parents, nodes, array_append(requested, null), optimized, key, keyset);
}
}
}
if(type != null) {
return onEdge(pathset, depth, roots, parents, nodes, requested, optimized, key, keyset);
}
var outer_key = pathset[depth];
var is_outer_keyset = is_object(outer_key);
var is_branch = depth < pathset.length - 1;
var run_once = false;
while(is_outer_keyset && permute_keyset(outer_key) && (run_once = true) || (run_once = !run_once)) {
var inner_key, inner_keyset;
if(is_outer_keyset === true) {
inner_key = keyset_to_key(outer_key, true);
inner_keyset = inner_key;
} else {
inner_key = outer_key;
inner_keyset = keyset;
}
var nodes2 = array_clone(nodes);
var parents2 = array_clone(parents);
var requested2, optimized2;
if(inner_key == null) {
requested2 = array_append(requested, null);
optimized2 = array_clone(optimized);
// optimized2 = optimized;
inner_key = key;
inner_keyset = keyset;
onNode(pathset, roots, parents2, nodes2, requested2, optimized2, true, is_branch, null, inner_keyset, false);
} else {
requested2 = array_append(requested, inner_key);
optimized2 = array_append(optimized, inner_key);
onNode(pathset, roots, parents2, nodes2, requested2, optimized2, true, is_branch, inner_key, inner_keyset, is_outer_keyset);
}
walk_path_set(onNode, onEdge,
pathset, depth + 1,
roots, parents2, nodes2,
requested2, optimized2,
inner_key, inner_keyset, is_outer_keyset
);
}
}
},{"../internal/context":61,"../internal/prefix":69,"../lru/promote":82,"../support/array-append":98,"../support/array-clone":99,"../support/array-slice":100,"../support/is-expired":116,"../support/is-object":117,"../support/is-primitive":118,"../support/keyset-to-key":119,"../support/permute-keyset":123,"../types/path":135,"./walk-reference":143}],143:[function(require,module,exports){
module.exports = walk_reference;
var prefix = require("../internal/prefix");
var __ref = require("../internal/ref");
var __context = require("../internal/context");
var __ref_index = require("../internal/ref-index");
var __refs_length = require("../internal/refs-length");
var is_object = require("../support/is-object");
var is_primitive = require("../support/is-primitive");
var array_slice = require("../support/array-slice");
var array_append = require("../support/array-append");
function walk_reference(onNode, container, reference, roots, parents, nodes, requested, optimized) {
optimized.length = 0;
var index = -1;
var count = reference.length;
var node, key, keyset;
while(++index < count) {
node = nodes[0];
if(node == null) {
return nodes;
} else if(is_primitive(node) || node.$type) {
onNode(reference, roots, parents, nodes, requested, optimized, false, false, keyset, null, false);
return nodes;
}
do {
key = reference[index];
if(key != null) {
keyset = key;
optimized.push(key);
onNode(reference, roots, parents, nodes, requested, optimized, false, index < count - 1, key, null, false);
break;
}
} while(++index < count);
}
node = nodes[0];
if(is_object(node) && container[__context] !== node) {
var backrefs = node[__refs_length] || 0;
node[__refs_length] = backrefs + 1;
node[__ref + backrefs] = container;
container[__context] = node;
container[__ref_index] = backrefs;
}
return nodes;
}
},{"../internal/context":61,"../internal/prefix":69,"../internal/ref":72,"../internal/ref-index":71,"../internal/refs-length":73,"../support/array-append":98,"../support/array-slice":100,"../support/is-object":117,"../support/is-primitive":118}],144:[function(require,module,exports){
/*global define:false require:false */
module.exports = (function(){
// Import Events
var events = require('events')
// Export Domain
var domain = {}
domain.createDomain = domain.create = function(){
var d = new events.EventEmitter()
function emitError(e) {
d.emit('error', e)
}
d.add = function(emitter){
emitter.on('error', emitError)
}
d.remove = function(emitter){
emitter.removeListener('error', emitError)
}
d.bind = function(fn){
return function(){
var args = Array.prototype.slice.call(arguments)
try {
fn.apply(null, args)
}
catch (err){
emitError(err)
}
}
}
d.intercept = function(fn){
return function(err){
if ( err ) {
emitError(err)
}
else {
var args = Array.prototype.slice.call(arguments, 1)
try {
fn.apply(null, args)
}
catch (err){
emitError(err)
}
}
}
}
d.run = function(fn){
try {
fn()
}
catch (err) {
emitError(err)
}
return this
};
d.dispose = function(){
this.removeAllListeners()
return this
};
d.enter = d.exit = function(){
return this
}
return d
};
return domain
}).call(this)
},{"events":145}],145:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
EventEmitter.defaultMaxListeners = 10;
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber(n) || n < 0 || isNaN(n))
throw TypeError('n must be a positive number');
this._maxListeners = n;
return this;
};
EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (!this._events)
this._events = {};
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events.error ||
(isObject(this._events.error) && !this._events.error.length)) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
}
throw TypeError('Uncaught, unspecified "error" event.');
}
}
handler = this._events[type];
if (isUndefined(handler))
return false;
if (isFunction(handler)) {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
handler.apply(this, args);
}
} else if (isObject(handler)) {
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
listeners = handler.slice();
len = listeners.length;
for (i = 0; i < len; i++)
listeners[i].apply(this, args);
}
return true;
};
EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events)
this._events = {};
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (this._events.newListener)
this.emit('newListener', type,
isFunction(listener.listener) ?
listener.listener : listener);
if (!this._events[type])
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
else if (isObject(this._events[type]))
// If we've already got an array, just append.
this._events[type].push(listener);
else
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
// Check for listener leak
if (isObject(this._events[type]) && !this._events[type].warned) {
var m;
if (!isUndefined(this._maxListeners)) {
m = this._maxListeners;
} else {
m = EventEmitter.defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
if (typeof console.trace === 'function') {
// not supported in IE 10
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
if (!isFunction(listener))
throw TypeError('listener must be a function');
var fired = false;
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
g.listener = listener;
this.on(type, g);
return this;
};
// emits a 'removeListener' event iff the listener was removed
EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events || !this._events[type])
return this;
list = this._events[type];
length = list.length;
position = -1;
if (list === listener ||
(isFunction(list.listener) && list.listener === listener)) {
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
} else if (isObject(list)) {
for (i = length; i-- > 0;) {
if (list[i] === listener ||
(list[i].listener && list[i].listener === listener)) {
position = i;
break;
}
}
if (position < 0)
return this;
if (list.length === 1) {
list.length = 0;
delete this._events[type];
} else {
list.splice(position, 1);
}
if (this._events.removeListener)
this.emit('removeListener', type, listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events)
return this;
// not listening for removeListener, no need to emit
if (!this._events.removeListener) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
delete this._events[type];
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
listeners = this._events[type];
if (isFunction(listeners)) {
this.removeListener(type, listeners);
} else {
// LIFO order
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
delete this._events[type];
return this;
};
EventEmitter.prototype.listeners = function(type) {
var ret;
if (!this._events || !this._events[type])
ret = [];
else if (isFunction(this._events[type]))
ret = [this._events[type]];
else
ret = this._events[type].slice();
return ret;
};
EventEmitter.listenerCount = function(emitter, type) {
var ret;
if (!emitter._events || !emitter._events[type])
ret = 0;
else if (isFunction(emitter._events[type]))
ret = 1;
else
ret = emitter._events[type].length;
return ret;
};
function isFunction(arg) {
return typeof arg === 'function';
}
function isNumber(arg) {
return typeof arg === 'number';
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
function isUndefined(arg) {
return arg === void 0;
}
},{}],146:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
if (canPost) {
var queue = [];
window.addEventListener('message', function (ev) {
var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
}
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
},{}],147:[function(require,module,exports){
var TokenTypes = {
token: 'token',
dotSeparator: '.',
commaSeparator: ',',
openingBracket: '[',
closingBracket: ']',
openingBrace: '{',
closingBrace: '}',
escape: '\\',
space: ' ',
quote: 'quote',
unknown: 'unknown'
};
module.exports = TokenTypes;
},{}],148:[function(require,module,exports){
module.exports = {
indexer: {
nested: 'Indexers cannot be nested.',
needQuotes: 'unquoted indexers must be numeric.',
empty: 'cannot have empty indexers.',
leadingDot: 'Indexers cannot have leading dots.',
leadingComma: 'Indexers cannot have leading comma.',
requiresComma: 'Indexers require commas between indexer args.'
},
range: {
precedingNaN: 'ranges must be preceded by numbers.',
suceedingNaN: 'ranges must be suceeded by numbers.'
},
quote: {
empty: 'cannot have empty quoted keys.',
illegalEscape: 'Invalid escape character. Only quotes are escapable.'
},
unexpectedToken: 'Unexpected token.',
throwError: function(err, state, token) {
if (token) {
throw err + ' -- ' + state.parseString + ' with next token: ' + token;
}
throw err + ' -- ' + state.parseString;
}
};
},{}],149:[function(require,module,exports){
var Tokenizer = require('./tokenizer');
var head = require('./parse-tree/head');
var parser = function parser(string, extendedRules) {
return head(new Tokenizer(string, extendedRules));
};
module.exports = parser;
// Constructs the paths from paths / pathValues that have strings.
// If it does not have a string, just moves the value into the return
// results.
parser.fromPathsOrPathValues = function(paths, ext) {
var out = [];
for (i = 0, len = paths.length; i < len; i++) {
// Is the path a string
if (typeof paths[i] === 'string') {
out[i] = parser(paths[i], ext);
}
// is the path a path value with a string value.
else if (typeof paths[i].path === 'string') {
out[i] = {
path: parser(paths[i].path, ext), value: paths[i].value
};
}
// just copy it over.
else {
out[i] = paths[i];
}
}
return out;
};
// If the argument is a string, this with convert, else just return
// the path provided.
parser.fromPath = function(path, ext) {
if (typeof path === 'string') {
return parser(path, ext);
}
return path;
};
},{"./parse-tree/head":150,"./tokenizer":154}],150:[function(require,module,exports){
var TokenTypes = require('./../TokenTypes');
var Expections = require('./../exceptions');
var indexer = require('./indexer');
/**
* The top level of the parse tree. This returns the generated path
* from the tokenizer.
*/
module.exports = function head(tokenizer) {
var token = tokenizer.next();
var first = true;
var state = {
parseString: ''
};
var out = [];
while (!token.done) {
// continue to build the parse string.
state.parseString += token.token;
switch (token.type) {
case TokenTypes.token:
out[out.length] = token.token;
break;
// dotSeparators at the top level have no meaning
case TokenTypes.dotSeparator:
if (first) {
// TODO: Fix me
throw 'ohh no!';
}
break;
// Spaces do nothing.
case TokenTypes.space:
// NOTE: Spaces at the top level are allowed.
// titlesById .summary is a valid path.
break;
// Its time to decend the parse tree.
case TokenTypes.openingBracket:
indexer(tokenizer, token, state, out);
break;
// TODO: Fix me
default:
throw 'ohh no!';
}
first = false;
// Keep cycling through the tokenizer.
token = tokenizer.next();
}
if (first) {
// TODO: Ohh no! Fix me
throw 'ohh no!';
}
return out;
};
},{"./../TokenTypes":147,"./../exceptions":148,"./indexer":151}],151:[function(require,module,exports){
var TokenTypes = require('./../TokenTypes');
var E = require('./../exceptions');
var idxE = E.indexer;
var range = require('./range');
var quote = require('./quote');
/**
* The indexer is all the logic that happens in between
* the '[', opening bracket, and ']' closing bracket.
*/
module.exports = function indexer(tokenizer, openingToken, state, out) {
var token = tokenizer.next();
var done = false;
var allowedMaxLength = 1;
// State variables
state.indexer = [];
while (!token.done) {
// continue to build the parse string.
state.parseString += token.token;
switch (token.type) {
case TokenTypes.token:
case TokenTypes.quote:
// ensures that token adders are properly delimited.
if (state.indexer.length === allowedMaxLength) {
E.throwError(idxE.requiresComma, state);
}
break;
}
switch (token.type) {
case TokenTypes.token:
var t = +token.token;
if (isNaN(t)) {
E.throwError(idxE.needQuotes, state);
}
state.indexer[state.indexer.length] = t;
break;
// dotSeparators at the top level have no meaning
case TokenTypes.dotSeparator:
if (!state.indexer.length) {
E.throwError(idxE.leadingDot, state);
}
range(tokenizer, token, state, out);
break;
// Spaces do nothing.
case TokenTypes.space:
break;
case TokenTypes.closingBracket:
done = true;
break;
// The quotes require their own tree due to what can be in it.
case TokenTypes.quote:
quote(tokenizer, token, state, out);
break;
// Its time to decend the parse tree.
case TokenTypes.openingBracket:
E.throwError(idxE.nested, state);
break;
case TokenTypes.commaSeparator:
++allowedMaxLength;
break;
default:
E.throwError(idxE.unexpectedToken, state);
}
// If done, leave loop
if (done) {
break;
}
// Keep cycling through the tokenizer.
token = tokenizer.next();
}
if (state.indexer.length === 0) {
E.throwError(idxE.empty, state);
}
// Remember, if an array of 1, keySets will be generated.
if (state.indexer.length === 1) {
state.indexer = state.indexer[0];
}
out[out.length] = state.indexer;
// Clean state.
state.indexer = undefined;
};
},{"./../TokenTypes":147,"./../exceptions":148,"./quote":152,"./range":153}],152:[function(require,module,exports){
var TokenTypes = require('./../TokenTypes');
var E = require('./../exceptions');
var quoteE = E.quote;
/**
* The indexer is all the logic that happens in between
* the '[', opening bracket, and ']' closing bracket.
*/
module.exports = function quote(tokenizer, openingToken, state, out) {
var token = tokenizer.next();
var innerToken = '';
var openingQuote = openingToken.token;
var escaping = false;
var done = false;
while (!token.done) {
// continue to build the parse string.
state.parseString += token.token;
switch (token.type) {
case TokenTypes.token:
case TokenTypes.space:
case TokenTypes.dotSeparator:
case TokenTypes.commaSeparator:
case TokenTypes.openingBracket:
case TokenTypes.closingBracket:
case TokenTypes.openingBrace:
case TokenTypes.closingBrace:
if (escaping) {
E.throwError(quoteE.illegalEscape, state);
}
innerToken += token.token;
break;
case TokenTypes.quote:
// the simple case. We are escaping
if (escaping) {
innerToken += token.token;
escaping = false;
}
// its not a quote that is the opening quote
else if (token.token !== openingQuote) {
innerToken += token.token;
}
// last thing left. Its a quote that is the opening quote
// therefore we must produce the inner token of the indexer.
else {
done = true;
}
break;
case TokenTypes.escape:
escaping = true;
break;
default:
E.throwError(E.unexpectedToken, state);
}
// If done, leave loop
if (done) {
break;
}
// Keep cycling through the tokenizer.
token = tokenizer.next();
}
if (innerToken.length === 0) {
E.throwError(quoteE.empty, state);
}
state.indexer[state.indexer.length] = innerToken;
};
},{"./../TokenTypes":147,"./../exceptions":148}],153:[function(require,module,exports){
var Tokenizer = require('./../tokenizer');
var TokenTypes = require('./../TokenTypes');
var E = require('./../exceptions');
/**
* The indexer is all the logic that happens in between
* the '[', opening bracket, and ']' closing bracket.
*/
module.exports = function range(tokenizer, openingToken, state, out) {
var token = tokenizer.peek();
var dotCount = 1;
var done = false;
var inclusive = true;
// Grab the last token off the stack. Must be an integer.
var idx = state.indexer.length - 1;
var from = Tokenizer.toNumber(state.indexer[idx]);
var to;
if (isNaN(from)) {
E.throwError(E.range.precedingNaN, state);
}
// Why is number checking so difficult in javascript.
while (!done && !token.done) {
switch (token.type) {
// dotSeparators at the top level have no meaning
case TokenTypes.dotSeparator:
if (dotCount === 3) {
E.throwError(E.unexpectedToken, state);
}
++dotCount;
if (dotCount === 3) {
inclusive = false;
}
break;
case TokenTypes.token:
// move the tokenizer forward and save to.
to = Tokenizer.toNumber(tokenizer.next().token);
// continue to build the parse string.
state.parseString += token.token;
// throw potential error.
if (isNaN(to)) {
E.throwError(E.range.suceedingNaN, state);
}
done = true;
break;
default:
done = true;
break;
}
// Keep cycling through the tokenizer. But ranges have to peek
// before they go to the next token since there is no 'terminating'
// character.
if (!done) {
tokenizer.next();
// continue to build the parse string.
state.parseString += token.token;
// go to the next token without consuming.
token = tokenizer.peek();
}
// break and remove state information.
else {
break;
}
}
state.indexer[idx] = {from: from, to: inclusive ? to : to - 1};
};
},{"./../TokenTypes":147,"./../exceptions":148,"./../tokenizer":154}],154:[function(require,module,exports){
var TokenTypes = require('./../TokenTypes');
var DOT_SEPARATOR = '.';
var COMMA_SEPARATOR = ',';
var OPENING_BRACKET = '[';
var CLOSING_BRACKET = ']';
var OPENING_BRACE = '{';
var CLOSING_BRACE = '}';
var ESCAPE = '\\';
var DOUBLE_OUOTES = '"';
var SINGE_OUOTES = "'";
var SPACE = " ";
var SPECIAL_CHARACTERS = '\\\'"[]., ';
var EXT_SPECIAL_CHARACTERS = '\\{}\'"[]., ';
var Tokenizer = module.exports = function(string, ext) {
this._string = string;
this._idx = -1;
this._extended = ext;
};
Tokenizer.prototype = {
/**
* grabs the next token either from the peek operation or generates the
* next token.
*/
next: function() {
var nextToken = this._nextToken ?
this._nextToken : getNext(this._string, this._idx, this._extended);
this._idx = nextToken.idx;
this._nextToken = false;
return nextToken.token;
},
/**
* will peak but not increment the tokenizer
*/
peek: function() {
var nextToken = this._nextToken ?
this._nextToken : getNext(this._string, this._idx, this._extended);
this._nextToken = nextToken;
return nextToken.token;
}
};
Tokenizer.toNumber = function toNumber(x) {
if (!isNaN(+x)) {
return +x;
}
return NaN;
};
function toOutput(token, type, done) {
return {
token: token,
done: done,
type: type
};
}
function getNext(string, idx, ext) {
var output = false;
var token = '';
var specialChars = ext ?
EXT_SPECIAL_CHARACTERS : SPECIAL_CHARACTERS;
do {
done = idx + 1 >= string.length;
if (done) {
break;
}
// we have to peek at the next token
var character = string[idx + 1];
if (character !== undefined &&
specialChars.indexOf(character) === -1) {
token += character;
++idx;
continue;
}
// The token to delimiting character transition.
else if (token.length) {
break;
}
++idx;
var type;
switch (character) {
case DOT_SEPARATOR:
type = TokenTypes.dotSeparator;
break;
case COMMA_SEPARATOR:
type = TokenTypes.commaSeparator;
break;
case OPENING_BRACKET:
type = TokenTypes.openingBracket;
break;
case CLOSING_BRACKET:
type = TokenTypes.closingBracket;
break;
case OPENING_BRACE:
type = TokenTypes.openingBrace;
break;
case CLOSING_BRACE:
type = TokenTypes.closingBrace;
break;
case SPACE:
type = TokenTypes.space;
break;
case DOUBLE_OUOTES:
case SINGE_OUOTES:
type = TokenTypes.quote;
break;
case ESCAPE:
type = TokenTypes.escape;
break;
default:
type = TokenTypes.unknown;
break;
}
output = toOutput(character, type, false);
break;
} while (!done);
if (!output && token.length) {
output = toOutput(token, TokenTypes.token, false);
}
if (!output) {
output = {done: true};
}
return {
token: output,
idx: idx
};
}
},{"./../TokenTypes":147}],155:[function(require,module,exports){
'use strict';
module.exports = require('./lib')
},{"./lib":160}],156:[function(require,module,exports){
'use strict';
var asap = require('asap/raw')
function noop() {};
// States:
//
// 0 - pending
// 1 - fulfilled with _value
// 2 - rejected with _value
// 3 - adopted the state of another promise, _value
//
// once the state is no longer pending (0) it is immutable
// All `_` prefixed properties will be reduced to `_{random number}`
// at build time to obfuscate them and discourage their use.
// We don't use symbols or Object.defineProperty to fully hide them
// because the performance isn't good enough.
// to avoid using try/catch inside critical functions, we
// extract them to here.
var LAST_ERROR = null;
var IS_ERROR = {};
function getThen(obj) {
try {
return obj.then;
} catch (ex) {
LAST_ERROR = ex;
return IS_ERROR;
}
}
function tryCallOne(fn, a) {
try {
return fn(a);
} catch (ex) {
LAST_ERROR = ex;
return IS_ERROR;
}
}
function tryCallTwo(fn, a, b) {
try {
fn(a, b);
} catch (ex) {
LAST_ERROR = ex;
return IS_ERROR;
}
}
module.exports = Promise;
function Promise(fn) {
if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new')
if (typeof fn !== 'function') throw new TypeError('not a function')
this._71 = 0;
this._18 = null;
this._61 = [];
if (fn === noop) return;
doResolve(fn, this);
}
Promise.prototype._10 = function (onFulfilled, onRejected) {
var self = this;
return new this.constructor(function (resolve, reject) {
var res = new Promise(noop);
res.then(resolve, reject);
self._24(new Handler(onFulfilled, onRejected, res));
});
};
Promise.prototype.then = function(onFulfilled, onRejected) {
if (this.constructor !== Promise) return this._10(onFulfilled, onRejected);
var res = new Promise(noop);
this._24(new Handler(onFulfilled, onRejected, res));
return res;
};
Promise.prototype._24 = function(deferred) {
if (this._71 === 3) {
this._18._24(deferred);
return;
}
if (this._71 === 0) {
this._61.push(deferred);
return;
}
var state = this._71;
var value = this._18;
asap(function() {
var cb = state === 1 ? deferred.onFulfilled : deferred.onRejected
if (cb === null) {
(state === 1 ? deferred.promise._82(value) : deferred.promise._67(value))
return
}
var ret = tryCallOne(cb, value);
if (ret === IS_ERROR) {
deferred.promise._67(LAST_ERROR)
} else {
deferred.promise._82(ret)
}
});
};
Promise.prototype._82 = function(newValue) {
//Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
if (newValue === this) {
return this._67(new TypeError('A promise cannot be resolved with itself.'))
}
if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
var then = getThen(newValue);
if (then === IS_ERROR) {
return this._67(LAST_ERROR);
}
if (
then === this.then &&
newValue instanceof Promise &&
newValue._24 === this._24
) {
this._71 = 3;
this._18 = newValue;
for (var i = 0; i < this._61.length; i++) {
newValue._24(this._61[i]);
}
return;
} else if (typeof then === 'function') {
doResolve(then.bind(newValue), this)
return
}
}
this._71 = 1
this._18 = newValue
this._94()
}
Promise.prototype._67 = function (newValue) {
this._71 = 2
this._18 = newValue
this._94()
}
Promise.prototype._94 = function () {
for (var i = 0; i < this._61.length; i++)
this._24(this._61[i])
this._61 = null
}
function Handler(onFulfilled, onRejected, promise){
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null
this.onRejected = typeof onRejected === 'function' ? onRejected : null
this.promise = promise;
}
/**
* Take a potentially misbehaving resolver function and make sure
* onFulfilled and onRejected are only called once.
*
* Makes no guarantees about asynchrony.
*/
function doResolve(fn, promise) {
var done = false;
var res = tryCallTwo(fn, function (value) {
if (done) return
done = true
promise._82(value)
}, function (reason) {
if (done) return
done = true
promise._67(reason)
})
if (!done && res === IS_ERROR) {
done = true
promise._67(LAST_ERROR)
}
}
},{"asap/raw":164}],157:[function(require,module,exports){
'use strict';
var Promise = require('./core.js')
module.exports = Promise
Promise.prototype.done = function (onFulfilled, onRejected) {
var self = arguments.length ? this.then.apply(this, arguments) : this
self.then(null, function (err) {
setTimeout(function () {
throw err
}, 0)
})
}
},{"./core.js":156}],158:[function(require,module,exports){
'use strict';
//This file contains the ES6 extensions to the core Promises/A+ API
var Promise = require('./core.js')
var asap = require('asap/raw')
module.exports = Promise
/* Static Functions */
function ValuePromise(value) {
this.then = function (onFulfilled) {
if (typeof onFulfilled !== 'function') return this
return new Promise(function (resolve, reject) {
asap(function () {
try {
resolve(onFulfilled(value))
} catch (ex) {
reject(ex);
}
})
})
}
}
ValuePromise.prototype = Promise.prototype
var TRUE = new ValuePromise(true)
var FALSE = new ValuePromise(false)
var NULL = new ValuePromise(null)
var UNDEFINED = new ValuePromise(undefined)
var ZERO = new ValuePromise(0)
var EMPTYSTRING = new ValuePromise('')
Promise.resolve = function (value) {
if (value instanceof Promise) return value
if (value === null) return NULL
if (value === undefined) return UNDEFINED
if (value === true) return TRUE
if (value === false) return FALSE
if (value === 0) return ZERO
if (value === '') return EMPTYSTRING
if (typeof value === 'object' || typeof value === 'function') {
try {
var then = value.then
if (typeof then === 'function') {
return new Promise(then.bind(value))
}
} catch (ex) {
return new Promise(function (resolve, reject) {
reject(ex)
})
}
}
return new ValuePromise(value)
}
Promise.all = function (arr) {
var args = Array.prototype.slice.call(arr)
return new Promise(function (resolve, reject) {
if (args.length === 0) return resolve([])
var remaining = args.length
function res(i, val) {
if (val && (typeof val === 'object' || typeof val === 'function')) {
var then = val.then
if (typeof then === 'function') {
then.call(val, function (val) { res(i, val) }, reject)
return
}
}
args[i] = val
if (--remaining === 0) {
resolve(args);
}
}
for (var i = 0; i < args.length; i++) {
res(i, args[i])
}
})
}
Promise.reject = function (value) {
return new Promise(function (resolve, reject) {
reject(value);
});
}
Promise.race = function (values) {
return new Promise(function (resolve, reject) {
values.forEach(function(value){
Promise.resolve(value).then(resolve, reject);
})
});
}
/* Prototype Methods */
Promise.prototype['catch'] = function (onRejected) {
return this.then(null, onRejected);
}
},{"./core.js":156,"asap/raw":164}],159:[function(require,module,exports){
'use strict';
var Promise = require('./core.js')
module.exports = Promise
Promise.prototype['finally'] = function (f) {
return this.then(function (value) {
return Promise.resolve(f()).then(function () {
return value
})
}, function (err) {
return Promise.resolve(f()).then(function () {
throw err
})
})
}
},{"./core.js":156}],160:[function(require,module,exports){
'use strict';
module.exports = require('./core.js')
require('./done.js')
require('./finally.js')
require('./es6-extensions.js')
require('./node-extensions.js')
},{"./core.js":156,"./done.js":157,"./es6-extensions.js":158,"./finally.js":159,"./node-extensions.js":161}],161:[function(require,module,exports){
'use strict';
//This file contains then/promise specific extensions that are only useful for node.js interop
var Promise = require('./core.js')
var asap = require('asap')
module.exports = Promise
/* Static Functions */
Promise.denodeify = function (fn, argumentCount) {
argumentCount = argumentCount || Infinity
return function () {
var self = this
var args = Array.prototype.slice.call(arguments)
return new Promise(function (resolve, reject) {
while (args.length && args.length > argumentCount) {
args.pop()
}
args.push(function (err, res) {
if (err) reject(err)
else resolve(res)
})
var res = fn.apply(self, args)
if (res && (typeof res === 'object' || typeof res === 'function') && typeof res.then === 'function') {
resolve(res)
}
})
}
}
Promise.nodeify = function (fn) {
return function () {
var args = Array.prototype.slice.call(arguments)
var callback = typeof args[args.length - 1] === 'function' ? args.pop() : null
var ctx = this
try {
return fn.apply(this, arguments).nodeify(callback, ctx)
} catch (ex) {
if (callback === null || typeof callback == 'undefined') {
return new Promise(function (resolve, reject) { reject(ex) })
} else {
asap(function () {
callback.call(ctx, ex)
})
}
}
}
}
Promise.prototype.nodeify = function (callback, ctx) {
if (typeof callback != 'function') return this
this.then(function (value) {
asap(function () {
callback.call(ctx, null, value)
})
}, function (err) {
asap(function () {
callback.call(ctx, err)
})
})
}
},{"./core.js":156,"asap":162}],162:[function(require,module,exports){
"use strict";
// rawAsap provides everything we need except exception management.
var rawAsap = require("./raw");
// RawTasks are recycled to reduce GC churn.
var freeTasks = [];
// We queue errors to ensure they are thrown in right order (FIFO).
// Array-as-queue is good enough here, since we are just dealing with exceptions.
var pendingErrors = [];
var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
function throwFirstError() {
if (pendingErrors.length) {
throw pendingErrors.shift();
}
}
/**
* Calls a task as soon as possible after returning, in its own event, with priority
* over other events like animation, reflow, and repaint. An error thrown from an
* event will not interrupt, nor even substantially slow down the processing of
* other events, but will be rather postponed to a lower priority event.
* @param {{call}} task A callable object, typically a function that takes no
* arguments.
*/
module.exports = asap;
function asap(task) {
var rawTask;
if (freeTasks.length) {
rawTask = freeTasks.pop();
} else {
rawTask = new RawTask();
}
rawTask.task = task;
rawAsap(rawTask);
}
// We wrap tasks with recyclable task objects. A task object implements
// `call`, just like a function.
function RawTask() {
this.task = null;
}
// The sole purpose of wrapping the task is to catch the exception and recycle
// the task object after its single use.
RawTask.prototype.call = function () {
try {
this.task.call();
} catch (error) {
if (asap.onerror) {
// This hook exists purely for testing purposes.
// Its name will be periodically randomized to break any code that
// depends on its existence.
asap.onerror(error);
} else {
// In a web browser, exceptions are not fatal. However, to avoid
// slowing down the queue of pending tasks, we rethrow the error in a
// lower priority turn.
pendingErrors.push(error);
requestErrorThrow();
}
} finally {
this.task = null;
freeTasks[freeTasks.length] = this;
}
};
},{"./raw":163}],163:[function(require,module,exports){
(function (global){
"use strict";
// Use the fastest means possible to execute a task in its own turn, with
// priority over other events including IO, animation, reflow, and redraw
// events in browsers.
//
// An exception thrown by a task will permanently interrupt the processing of
// subsequent tasks. The higher level `asap` function ensures that if an
// exception is thrown by a task, that the task queue will continue flushing as
// soon as possible, but if you use `rawAsap` directly, you are responsible to
// either ensure that no exceptions are thrown from your task, or to manually
// call `rawAsap.requestFlush` if an exception is thrown.
module.exports = rawAsap;
function rawAsap(task) {
if (!queue.length) {
requestFlush();
flushing = true;
}
// Equivalent to push, but avoids a function call.
queue[queue.length] = task;
}
var queue = [];
// Once a flush has been requested, no further calls to `requestFlush` are
// necessary until the next `flush` completes.
var flushing = false;
// `requestFlush` is an implementation-specific method that attempts to kick
// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
// the event queue before yielding to the browser's own event loop.
var requestFlush;
// The position of the next task to execute in the task queue. This is
// preserved between calls to `flush` so that it can be resumed if
// a task throws an exception.
var index = 0;
// If a task schedules additional tasks recursively, the task queue can grow
// unbounded. To prevent memory exhaustion, the task queue will periodically
// truncate already-completed tasks.
var capacity = 1024;
// The flush function processes all tasks that have been scheduled with
// `rawAsap` unless and until one of those tasks throws an exception.
// If a task throws an exception, `flush` ensures that its state will remain
// consistent and will resume where it left off when called again.
// However, `flush` does not make any arrangements to be called again if an
// exception is thrown.
function flush() {
while (index < queue.length) {
var currentIndex = index;
// Advance the index before calling the task. This ensures that we will
// begin flushing on the next task the task throws an error.
index = index + 1;
queue[currentIndex].call();
// Prevent leaking memory for long chains of recursive calls to `asap`.
// If we call `asap` within tasks scheduled by `asap`, the queue will
// grow, but to avoid an O(n) walk for every task we execute, we don't
// shift tasks off the queue after they have been executed.
// Instead, we periodically shift 1024 tasks off the queue.
if (index > capacity) {
// Manually shift all values starting at the index back to the
// beginning of the queue.
for (var scan = 0; scan < index; scan++) {
queue[scan] = queue[scan + index];
}
queue.length -= index;
index = 0;
}
}
queue.length = 0;
index = 0;
flushing = false;
}
// `requestFlush` is implemented using a strategy based on data collected from
// every available SauceLabs Selenium web driver worker at time of writing.
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
// have WebKitMutationObserver but not un-prefixed MutationObserver.
// Must use `global` instead of `window` to work in both frames and web
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
var BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;
// MutationObservers are desirable because they have high priority and work
// reliably everywhere they are implemented.
// They are implemented in all modern browsers.
//
// - Android 4-4.3
// - Chrome 26-34
// - Firefox 14-29
// - Internet Explorer 11
// - iPad Safari 6-7.1
// - iPhone Safari 7-7.1
// - Safari 6-7
if (typeof BrowserMutationObserver === "function") {
requestFlush = makeRequestCallFromMutationObserver(flush);
// MessageChannels are desirable because they give direct access to the HTML
// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
// 11-12, and in web workers in many engines.
// Although message channels yield to any queued rendering and IO tasks, they
// would be better than imposing the 4ms delay of timers.
// However, they do not work reliably in Internet Explorer or Safari.
// Internet Explorer 10 is the only browser that has setImmediate but does
// not have MutationObservers.
// Although setImmediate yields to the browser's renderer, it would be
// preferrable to falling back to setTimeout since it does not have
// the minimum 4ms penalty.
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
// Desktop to a lesser extent) that renders both setImmediate and
// MessageChannel useless for the purposes of ASAP.
// https://github.com/kriskowal/q/issues/396
// Timers are implemented universally.
// We fall back to timers in workers in most engines, and in foreground
// contexts in the following browsers.
// However, note that even this simple case requires nuances to operate in a
// broad spectrum of browsers.
//
// - Firefox 3-13
// - Internet Explorer 6-9
// - iPad Safari 4.3
// - Lynx 2.8.7
} else {
requestFlush = makeRequestCallFromTimer(flush);
}
// `requestFlush` requests that the high priority event queue be flushed as
// soon as possible.
// This is useful to prevent an error thrown in a task from stalling the event
// queue if the exception handled by Node.js’s
// `process.on("uncaughtException")` or by a domain.
rawAsap.requestFlush = requestFlush;
// To request a high priority event, we induce a mutation observer by toggling
// the text of a text node between "1" and "-1".
function makeRequestCallFromMutationObserver(callback) {
var toggle = 1;
var observer = new BrowserMutationObserver(callback);
var node = document.createTextNode("");
observer.observe(node, {characterData: true});
return function requestCall() {
toggle = -toggle;
node.data = toggle;
};
}
// The message channel technique was discovered by Malte Ubl and was the
// original foundation for this library.
// http://www.nonblocking.io/2011/06/windownexttick.html
// Safari 6.0.5 (at least) intermittently fails to create message ports on a
// page's first load. Thankfully, this version of Safari supports
// MutationObservers, so we don't need to fall back in that case.
// function makeRequestCallFromMessageChannel(callback) {
// var channel = new MessageChannel();
// channel.port1.onmessage = callback;
// return function requestCall() {
// channel.port2.postMessage(0);
// };
// }
// For reasons explained above, we are also unable to use `setImmediate`
// under any circumstances.
// Even if we were, there is another bug in Internet Explorer 10.
// It is not sufficient to assign `setImmediate` to `requestFlush` because
// `setImmediate` must be called *by name* and therefore must be wrapped in a
// closure.
// Never forget.
// function makeRequestCallFromSetImmediate(callback) {
// return function requestCall() {
// setImmediate(callback);
// };
// }
// Safari 6.0 has a problem where timers will get lost while the user is
// scrolling. This problem does not impact ASAP because Safari 6.0 supports
// mutation observers, so that implementation is used instead.
// However, if we ever elect to use timers in Safari, the prevalent work-around
// is to add a scroll event listener that calls for a flush.
// `setTimeout` does not call the passed callback if the delay is less than
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
// even then.
function makeRequestCallFromTimer(callback) {
return function requestCall() {
// We dispatch a timeout with a specified delay of 0 for engines that
// can reliably accommodate that request. This will usually be snapped
// to a 4 milisecond delay, but once we're flushing, there's no delay
// between events.
var timeoutHandle = setTimeout(handleTimer, 0);
// However, since this timer gets frequently dropped in Firefox
// workers, we enlist an interval handle that will try to fire
// an event 20 times per second until it succeeds.
var intervalHandle = setInterval(handleTimer, 50);
function handleTimer() {
// Whichever timer succeeds will cancel both timers and
// execute the callback.
clearTimeout(timeoutHandle);
clearInterval(intervalHandle);
callback();
}
};
}
// This is for `asap.js` only.
// Its name will be periodically randomized to break any code that depends on
// its existence.
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
// ASAP was originally a nextTick shim included in Q. This was factored out
// into this ASAP package. It was later adapted to RSVP which made further
// amendments. These decisions, particularly to marginalize MessageChannel and
// to capture the MutationObserver implementation in a closure, were integrated
// back into ASAP proper.
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],164:[function(require,module,exports){
(function (process){
"use strict";
var domain; // The domain module is executed on demand
var hasSetImmediate = typeof setImmediate === "function";
// Use the fastest means possible to execute a task in its own turn, with
// priority over other events including network IO events in Node.js.
//
// An exception thrown by a task will permanently interrupt the processing of
// subsequent tasks. The higher level `asap` function ensures that if an
// exception is thrown by a task, that the task queue will continue flushing as
// soon as possible, but if you use `rawAsap` directly, you are responsible to
// either ensure that no exceptions are thrown from your task, or to manually
// call `rawAsap.requestFlush` if an exception is thrown.
module.exports = rawAsap;
function rawAsap(task) {
if (!queue.length) {
requestFlush();
flushing = true;
}
// Avoids a function call
queue[queue.length] = task;
}
var queue = [];
// Once a flush has been requested, no further calls to `requestFlush` are
// necessary until the next `flush` completes.
var flushing = false;
// The position of the next task to execute in the task queue. This is
// preserved between calls to `flush` so that it can be resumed if
// a task throws an exception.
var index = 0;
// If a task schedules additional tasks recursively, the task queue can grown
// unbounded. To prevent memory excaustion, the task queue will periodically
// truncate already-completed tasks.
var capacity = 1024;
// The flush function processes all tasks that have been scheduled with
// `rawAsap` unless and until one of those tasks throws an exception.
// If a task throws an exception, `flush` ensures that its state will remain
// consistent and will resume where it left off when called again.
// However, `flush` does not make any arrangements to be called again if an
// exception is thrown.
function flush() {
while (index < queue.length) {
var currentIndex = index;
// Advance the index before calling the task. This ensures that we will
// begin flushing on the next task the task throws an error.
index = index + 1;
queue[currentIndex].call();
// Prevent leaking memory for long chains of recursive calls to `asap`.
// If we call `asap` within tasks scheduled by `asap`, the queue will
// grow, but to avoid an O(n) walk for every task we execute, we don't
// shift tasks off the queue after they have been executed.
// Instead, we periodically shift 1024 tasks off the queue.
if (index > capacity) {
// Manually shift all values starting at the index back to the
// beginning of the queue.
for (var scan = 0; scan < index; scan++) {
queue[scan] = queue[scan + index];
}
queue.length -= index;
index = 0;
}
}
queue.length = 0;
index = 0;
flushing = false;
}
rawAsap.requestFlush = requestFlush;
function requestFlush() {
// Ensure flushing is not bound to any domain.
// It is not sufficient to exit the domain, because domains exist on a stack.
// To execute code outside of any domain, the following dance is necessary.
var parentDomain = process.domain;
if (parentDomain) {
if (!domain) {
// Lazy execute the domain module.
// Only employed if the user elects to use domains.
domain = require("domain");
}
domain.active = process.domain = null;
}
// `setImmediate` is slower that `process.nextTick`, but `process.nextTick`
// cannot handle recursion.
// `requestFlush` will only be called recursively from `asap.js`, to resume
// flushing after an error is thrown into a domain.
// Conveniently, `setImmediate` was introduced in the same version
// `process.nextTick` started throwing recursion errors.
if (flushing && hasSetImmediate) {
setImmediate(flush);
} else {
process.nextTick(flush);
}
if (parentDomain) {
domain.active = process.domain = parentDomain;
}
}
}).call(this,require("FWaASH"))
},{"FWaASH":146,"domain":144}],165:[function(require,module,exports){
(function (process,global){
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}
Rx.config.longStackSupport = false;
var hasStacks = false;
try {
throw new Error();
} catch (e) {
hasStacks = !!e.stack;
}
// All code after this point will be filtered from stack traces reported by RxJS
var rStartingLine = captureLine(), rFileName;
var STACK_JUMP_SEPARATOR = "From previous event:";
function makeStackTraceLong(error, observable) {
// If possible, transform the error stack trace by removing Node and RxJS
// cruft, then concatenating with the stack trace of `observable`.
if (hasStacks &&
observable.stack &&
typeof error === "object" &&
error !== null &&
error.stack &&
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
) {
var stacks = [];
for (var o = observable; !!o; o = o.source) {
if (o.stack) {
stacks.unshift(o.stack);
}
}
stacks.unshift(error.stack);
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
error.stack = filterStackString(concatedStacks);
}
}
function filterStackString(stackString) {
var lines = stackString.split("\n"),
desiredLines = [];
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
desiredLines.push(line);
}
}
return desiredLines.join("\n");
}
function isInternalFrame(stackLine) {
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
if (!fileNameAndLineNumber) {
return false;
}
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
return fileName === rFileName &&
lineNumber >= rStartingLine &&
lineNumber <= rEndingLine;
}
function isNodeFrame(stackLine) {
return stackLine.indexOf("(module.js:") !== -1 ||
stackLine.indexOf("(node.js:") !== -1;
}
function captureLine() {
if (!hasStacks) { return; }
try {
throw new Error();
} catch (e) {
var lines = e.stack.split("\n");
var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
if (!fileNameAndLineNumber) { return; }
rFileName = fileNameAndLineNumber[0];
return fileNameAndLineNumber[1];
}
}
function getFileNameAndLineNumber(stackLine) {
// Named functions: "at functionName (filename:lineNumber:columnNumber)"
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
// Anonymous functions: "at filename:lineNumber:columnNumber"
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
// Firefox style: "function@filename:lineNumber or @filename:lineNumber"
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
}
var EmptyError = Rx.EmptyError = function() {
this.message = 'Sequence contains no elements.';
Error.call(this);
};
EmptyError.prototype = Error.prototype;
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
this.message = 'Object has been disposed';
Error.call(this);
};
ObjectDisposedError.prototype = Error.prototype;
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
this.message = 'Argument out of range';
Error.call(this);
};
ArgumentOutOfRangeError.prototype = Error.prototype;
var NotSupportedError = Rx.NotSupportedError = function (message) {
this.message = message || 'This operation is not supported';
Error.call(this);
};
NotSupportedError.prototype = Error.prototype;
var NotImplementedError = Rx.NotImplementedError = function (message) {
this.message = message || 'This operation is not implemented';
Error.call(this);
};
NotImplementedError.prototype = Error.prototype;
var notImplemented = Rx.helpers.notImplemented = function () {
throw new NotImplementedError();
};
var notSupported = Rx.helpers.notSupported = function () {
throw new NotSupportedError();
};
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {
if (typeof thisArg === 'undefined') { return func; }
switch(argCount) {
case 0:
return function() {
return func.call(thisArg)
};
case 1:
return function(arg) {
return func.call(thisArg, arg);
}
case 2:
return function(value, index) {
return func.call(thisArg, value, index);
};
case 3:
return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
}
return function() {
return func.apply(thisArg, arguments);
};
};
/** Used to determine if values are of the language type Object */
var dontEnums = ['toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'],
dontEnumsLength = dontEnums.length;
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
supportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
supportNodeClass = true;
}
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
var isObject = Rx.internals.isObject = function(value) {
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
};
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = dontEnumsLength;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = dontEnums[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
var isArguments = function(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var hasProp = {}.hasOwnProperty,
slice = Array.prototype.slice;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
var source = sources[idx];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
c === 0 && (c = this.id - other.id);
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
this.items[this.length] = undefined;
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
len = args.length;
} else {
len = arguments.length;
args = new Array(len);
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
}
for(i = 0; i < len; i++) {
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
}
this.disposables = args;
this.isDisposed = false;
this.length = args.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
this.disposables = [];
this.length = 0;
for (i = 0; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
var isDisposable = Disposable.isDisposable = function (d) {
return d && isFunction(d.dispose);
};
var checkDisposed = Disposable.checkDisposed = function (disposable) {
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
};
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function () {
function BooleanDisposable () {
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable;
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed && !this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed && !this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
function scheduleItem(s, self) {
if (!self.isDisposed) {
self.isDisposed = true;
self.disposable.dispose();
}
}
ScheduledDisposable.prototype.dispose = function () {
this.scheduler.scheduleWithState(this, scheduleItem);
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
}
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method](state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState([state, action], invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative([state, action], dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute([state, action], dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
period = normalizeTime(period);
var s = state, id = root.setInterval(function () { s = action(s); }, period);
return disposableCreate(function () { root.clearInterval(id); });
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchError = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
}(Scheduler.prototype));
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/** Gets a scheduler that schedules work immediately on the current thread. */
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline () {
while (queue.length > 0) {
var item = queue.dequeue();
!item.isCancelled() && item.invoke();
}
}
function scheduleNow(state, action) {
var si = new ScheduledItem(this, state, action, this.now());
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
var result = tryCatch(runTrampoline)();
queue = null;
if (result === errorObj) { return thrower(result.e); }
} else {
queue.enqueue(si);
}
return si.disposable;
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
currentScheduler.scheduleRequired = function () { return !queue; };
return currentScheduler;
}());
var scheduleMethod, clearMethod;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if (!!root.WScript) {
localSetTimeout = function (fn, time) {
root.WScript.Sleep(time);
fn();
};
} else if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else {
throw new NotSupportedError();
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
clearMethod = function (handle) {
delete tasksByHandle[handle];
};
function runTask(handle) {
if (currentlyRunning) {
localSetTimeout(function () { runTask(handle) }, 0);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunning = true;
var result = tryCatch(task)();
clearMethod(handle);
currentlyRunning = false;
if (result === errorObj) { return thrower(result.e); }
}
}
}
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false, oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (isFunction(setImmediate)) {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
setImmediate(function () { runTask(id); });
return id;
};
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
process.nextTick(function () { runTask(id); });
return id;
};
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
runTask(event.data.substring(MSG_PREFIX.length));
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
return id;
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel();
channel.port1.onmessage = function (e) { runTask(e.data); };
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
channel.port2.postMessage(id);
return id;
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
var id = nextHandle++;
tasksByHandle[id] = action;
scriptElement.onreadystatechange = function () {
runTask(id);
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
return id;
};
} else {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
localSetTimeout(function () {
runTask(id);
}, 0);
return id;
};
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = Scheduler.default = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this, dt = Scheduler.normalize(dueTime);
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
var disposable = new SingleAssignmentDisposable();
var id = localSetTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
var CatchScheduler = (function (__super__) {
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, __super__);
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
__super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute);
}
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, value, exception, accept, acceptObservable, toString) {
this.kind = kind;
this.value = value;
this.exception = exception;
this._accept = accept;
this._acceptObservable = acceptObservable;
this.toString = toString;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var self = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithState(self, function (_, notification) {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept(onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString() { return 'OnNext(' + this.value + ')'; }
return function (value) {
return new Notification('N', value, null, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
return new Notification('E', null, e, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
return new Notification('C', null, null, _accept, _acceptObservable, toString);
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {
return o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function(err) { o.onError(err); },
self)
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return observer.onError(ex);
}
if (currentItem.done) {
if (lastException !== null) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
self,
function() { o.onCompleted(); }));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
var sources = this;
return new AnonymousObservable(function (o) {
var exceptions = new Subject(),
notifier = new Subject(),
handled = notificationHandler(exceptions),
notificationDisposable = handled.subscribe(notifier);
var e = sources[$iterator$]();
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {
if (lastException) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var outer = new SingleAssignmentDisposable();
var inner = new SingleAssignmentDisposable();
subscription.setDisposable(new CompositeDisposable(inner, outer));
outer.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function (exn) {
inner.setDisposable(notifier.subscribe(self, function(ex) {
o.onError(ex);
}, function() {
o.onCompleted();
}));
exceptions.onNext(exn);
},
function() { o.onCompleted(); }));
});
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
if (selector) {
var selectorFn = bindCallback(selector, thisArg, 3);
}
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: !selector ? source[index] : selectorFn(source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.prototype.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
Observer.prototype.makeSafe = function(disposable) {
return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
// Must be implemented by other observers
AbstractObserver.prototype.next = notImplemented;
AbstractObserver.prototype.error = notImplemented;
AbstractObserver.prototype.completed = notImplemented;
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) { this.next(value); }
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (__super__) {
inherits(CheckedObserver, __super__);
function CheckedObserver(observer) {
__super__.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
var res = tryCatch(this._observer.onNext).call(this._observer, value);
this._state = 0;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
var res = tryCatch(this._observer.onError).call(this._observer, err);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
var res = tryCatch(this._observer.onCompleted).call(this._observer);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () { self.observer.onNext(value); });
};
ScheduledObserver.prototype.error = function (e) {
var self = this;
this.queue.push(function () { self.observer.onError(e); });
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () { self.observer.onCompleted(); });
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver(scheduler, observer, cancel) {
__super__.call(this, scheduler, observer);
this._cancel = cancel;
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
ObserveOnObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this._cancel && this._cancel.dispose();
this._cancel = null;
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
if (Rx.config.longStackSupport && hasStacks) {
try {
throw new Error();
} catch (e) {
this.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
}
var self = this;
this._subscribe = function (observer) {
var oldOnError = observer.onError.bind(observer);
observer.onError = function (err) {
makeStackTraceLong(err, self);
oldOnError(err);
};
return subscribe.call(self, observer);
};
} else {
this._subscribe = subscribe;
}
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __super__);
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], self = state[1];
var sub = tryCatch(self.subscribeCore).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function subscribe(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, this];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
function ObservableBase() {
__super__.call(this, subscribe);
}
ObservableBase.prototype.subscribeCore = notImplemented;
return ObservableBase;
}(Observable));
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
}, source);
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
}, source);
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
subject.onNext(value);
subject.onCompleted();
},
subject.onError.bind(subject));
return subject;
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
var ToArrayObservable = (function(__super__) {
inherits(ToArrayObservable, __super__);
function ToArrayObservable(source) {
this.source = source;
__super__.call(this);
}
ToArrayObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ToArrayObserver(observer));
};
return ToArrayObservable;
}(ObservableBase));
function ToArrayObserver(observer) {
this.observer = observer;
this.a = [];
this.isStopped = false;
}
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
ToArrayObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
ToArrayObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onNext(this.a);
this.observer.onCompleted();
}
};
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
ToArrayObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
return new ToArrayObservable(this);
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe, parent) {
return new AnonymousObservable(subscribe, parent);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithState(null, function () {
observer.onCompleted();
});
});
};
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, mapper, scheduler) {
this.iterable = iterable;
this.mapper = mapper;
this.scheduler = scheduler;
__super__.call(this);
}
FromObservable.prototype.subscribeCore = function (observer) {
var sink = new FromSink(observer, this);
return sink.run();
};
return FromObservable;
}(ObservableBase));
var FromSink = (function () {
function FromSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable),
it = getIterable(list),
observer = this.observer,
mapper = this.parent.mapper;
function loopRecursive(i, recurse) {
try {
var next = it.next();
} catch (e) {
return observer.onError(e);
}
if (next.done) {
return observer.onCompleted();
}
var result = next.value;
if (mapper) {
try {
result = mapper(result, i);
} catch (e) {
return observer.onError(e);
}
}
observer.onNext(result);
recurse(i + 1);
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return FromSink;
}());
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
if (mapFn) {
var mapper = bindCallback(mapFn, thisArg, 2);
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromObservable(iterable, mapper, scheduler);
}
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromArraySink.prototype.run = function () {
var observer = this.observer, args = this.parent.args, len = args.length;
function loopRecursive(i, recurse) {
if (i < len) {
observer.onNext(args[i]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler)
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (o) {
var first = true;
return scheduler.scheduleRecursiveWithState(initialState, function (state, self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
hasResult && (result = resultSelector(state));
} catch (e) {
return o.onError(e);
}
if (hasResult) {
o.onNext(result);
self(state);
} else {
o.onCompleted();
}
});
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler);
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new FromArrayObservable(args, currentThreadScheduler);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};
/**
* Creates an Observable sequence from changes to an array using Array.observe.
* @param {Array} array An array to observe changes.
* @returns {Observable} An observable sequence containing changes to an array from Array.observe.
*/
Observable.ofArrayChanges = function(array) {
if (!Array.isArray(array)) { throw new TypeError('Array.observe only accepts arrays.'); }
if (typeof Array.observe !== 'function' && typeof Array.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {
function observerFn(changes) {
for(var i = 0, len = changes.length; i < len; i++) {
observer.onNext(changes[i]);
}
}
Array.observe(array, observerFn);
return function () {
Array.unobserve(array, observerFn);
};
});
};
/**
* Creates an Observable sequence from changes to an object using Object.observe.
* @param {Object} obj An object to observe changes.
* @returns {Observable} An observable sequence containing changes to an object from Object.observe.
*/
Observable.ofObjectChanges = function(obj) {
if (obj == null) { throw new TypeError('object must not be null or undefined.'); }
if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {
function observerFn(changes) {
for(var i = 0, len = changes.length; i < len; i++) {
observer.onNext(changes[i]);
}
}
Object.observe(obj, observerFn);
return function () {
Object.unobserve(obj, observerFn);
};
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Convert an object into an observable sequence of [key, value] pairs.
* @param {Object} obj The object to inspect.
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} An observable sequence of [key, value] pairs from the object.
*/
Observable.pairs = function (obj, scheduler) {
scheduler || (scheduler = Rx.Scheduler.currentThread);
return new AnonymousObservable(function (observer) {
var keys = Object.keys(obj), len = keys.length;
return scheduler.scheduleRecursiveWithState(0, function (idx, self) {
if (idx < len) {
var key = keys[idx];
observer.onNext([key, obj[key]]);
self(idx + 1);
} else {
observer.onCompleted();
}
});
});
};
var RangeObservable = (function(__super__) {
inherits(RangeObservable, __super__);
function RangeObservable(start, count, scheduler) {
this.start = start;
this.count = count;
this.scheduler = scheduler;
__super__.call(this);
}
RangeObservable.prototype.subscribeCore = function (observer) {
var sink = new RangeSink(observer, this);
return sink.run();
};
return RangeObservable;
}(ObservableBase));
var RangeSink = (function () {
function RangeSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.count, observer = this.observer;
function loopRecursive(i, recurse) {
if (i < count) {
observer.onNext(start + i);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return RangeSink;
}());
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RangeObservable(start, count, scheduler);
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just' or browsers <IE9.
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (o) {
return scheduler.scheduleWithState(value, function(_,v) {
o.onNext(v);
o.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} error An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwError = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(error);
});
});
};
/** @deprecated use #some instead */
Observable.throwException = function () {
//deprecate('throwException', 'throwError');
return Observable.throwError.apply(null, arguments);
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
resource && (disposable = resource);
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(), items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (o) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(function (x) { o.onNext(x); }, function (e) {
try {
var result = handler(e);
} catch (ex) {
return o.onError(ex);
}
isPromise(result) && (result = observableFromPromise(result));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(o));
}, function (x) { o.onCompleted(x); }));
return subscription;
}, source);
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchError = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function () {
var items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
return enumerableOf(items).catchError();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop();
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (o) {
var n = args.length,
falseFactory = function () { return false; },
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
var res = resultSelector.apply(null, values);
} catch (e) {
return o.onError(e);
}
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}
function done (i) {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
},
function(e) { o.onError(e); },
function () { done(i); }
));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
}, this);
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
args.unshift(this);
return observableConcat.apply(null, args);
};
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(arguments.length);
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
}
return enumerableOf(args).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = observableProto.concatObservable = function () {
return this.merge(1);
};
var MergeObservable = (function (__super__) {
inherits(MergeObservable, __super__);
function MergeObservable(source, maxConcurrent) {
this.source = source;
this.maxConcurrent = maxConcurrent;
__super__.call(this);
}
MergeObservable.prototype.subscribeCore = function(observer) {
var g = new CompositeDisposable();
g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));
return g;
};
return MergeObservable;
}(ObservableBase));
var MergeObserver = (function () {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
this.done = false;
this.q = [];
this.activeCount = 0;
this.isStopped = false;
}
MergeObserver.prototype.handleSubscribe = function (xs) {
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(xs) && (xs = observableFromPromise(xs));
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
};
MergeObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
if(this.activeCount < this.max) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
MergeObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.done = true;
this.activeCount === 0 && this.o.onCompleted();
}
};
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
MergeObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
var parent = this.parent;
parent.g.remove(this.sad);
if (parent.q.length > 0) {
parent.handleSubscribe(parent.q.shift());
} else {
parent.activeCount--;
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeObserver;
}());
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
return typeof maxConcurrentOrOther !== 'number' ?
observableMerge(this, maxConcurrentOrOther) :
new MergeObservable(this, maxConcurrentOrOther);
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources = [], i, len = arguments.length;
if (!arguments[0]) {
scheduler = immediateScheduler;
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else if (isScheduler(arguments[0])) {
scheduler = arguments[0];
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else {
scheduler = immediateScheduler;
for(i = 0; i < len; i++) { sources.push(arguments[i]); }
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
var MergeAllObservable = (function (__super__) {
inherits(MergeAllObservable, __super__);
function MergeAllObservable(source) {
this.source = source;
__super__.call(this);
}
MergeAllObservable.prototype.subscribeCore = function (observer) {
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
g.add(m);
m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));
return g;
};
return MergeAllObservable;
}(ObservableBase));
var MergeAllObserver = (function() {
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.isStopped = false;
this.done = false;
}
MergeAllObserver.prototype.onNext = function(innerSource) {
if(this.isStopped) { return; }
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad)));
};
MergeAllObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeAllObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.done = true;
this.g.length === 1 && this.o.onCompleted();
}
};
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
MergeAllObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, g, sad) {
this.parent = parent;
this.g = g;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
this.isStopped = true;
parent.g.remove(this.sad);
parent.done && parent.g.length === 1 && parent.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeAllObserver;
}());
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = observableProto.mergeObservable = function () {
return new MergeAllObservable(this);
};
var CompositeError = Rx.CompositeError = function(errors) {
this.name = "NotImplementedError";
this.innerErrors = errors;
this.message = 'This contains multiple errors. Check the innerErrors';
Error.call(this);
}
CompositeError.prototype = Error.prototype;
/**
* Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to
* receive all successfully emitted items from all of the source Observables without being interrupted by
* an error notification from one of them.
*
* This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an
* error via the Observer's onError, mergeDelayError will refrain from propagating that
* error notification until all of the merged Observables have finished emitting items.
* @param {Array | Arguments} args Arguments or an array to merge.
* @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable
*/
Observable.mergeDelayError = function() {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
var len = arguments.length;
args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
var source = observableOf(null, args);
return new AnonymousObservable(function (o) {
var group = new CompositeDisposable(),
m = new SingleAssignmentDisposable(),
isStopped = false,
errors = [];
function setCompletion() {
if (errors.length === 0) {
o.onCompleted();
} else if (errors.length === 1) {
o.onError(errors[0]);
} else {
o.onError(new CompositeError(errors));
}
}
group.add(m);
m.setDisposable(source.subscribe(
function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) { o.onNext(x); },
function (e) {
errors.push(e);
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
},
function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
}));
},
function (e) {
errors.push(e);
isStopped = true;
group.length === 1 && setCompletion();
},
function () {
isStopped = true;
group.length === 1 && setCompletion();
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) { throw new Error('Second observable is required'); }
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = [];
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
}
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (o) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && o.onNext(left);
}, function (e) { o.onError(e); }, function () {
isOpen && o.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, function (e) { o.onError(e); }, function () {
rightSubscription.dispose();
}));
return disposables;
}, source);
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(
function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(
function (x) { latest === id && observer.onNext(x); },
function (e) { latest === id && observer.onError(e); },
function () {
if (latest === id) {
hasLatest = false;
isStopped && observer.onCompleted();
}
}));
},
function (e) { observer.onError(e); },
function () {
isStopped = true;
!hasLatest && observer.onCompleted();
});
return new CompositeDisposable(subscription, innerSubscription);
}, sources);
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (o) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(o),
other.subscribe(function () { o.onCompleted(); }, function (e) { o.onError(e); }, noop)
);
}, source);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
*
* @example
* 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = obs1.withLatestFrom([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.withLatestFrom = function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop(), source = this;
if (typeof source === 'undefined') {
throw new Error('Source observable not found for withLatestFrom().');
}
if (typeof resultSelector !== 'function') {
throw new Error('withLatestFrom() expects a resultSelector function.');
}
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
values = new Array(n);
var subscriptions = new Array(n + 1);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var other = args[i], sad = new SingleAssignmentDisposable();
isPromise(other) && (other = observableFromPromise(other));
sad.setDisposable(other.subscribe(function (x) {
values[i] = x;
hasValue[i] = true;
hasValueAll = hasValue.every(identity);
}, observer.onError.bind(observer), function () {}));
subscriptions[i] = sad;
}(idx));
}
var sad = new SingleAssignmentDisposable();
sad.setDisposable(source.subscribe(function (x) {
var res;
var allValues = [x].concat(values);
if (!hasValueAll) return;
try {
res = resultSelector.apply(null, allValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
}, observer.onError.bind(observer), function () {
observer.onCompleted();
}));
subscriptions[n] = sad;
return new CompositeDisposable(subscriptions);
}, this);
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
return observer.onError(e);
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, function (e) { observer.onError(e); }, function () { observer.onCompleted(); });
}, first);
}
function falseFactory() { return false; }
function emptyArrayFactory() { return []; }
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var parent = this, resultSelector = args.pop();
args.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = args.length,
queues = arrayInitialize(n, emptyArrayFactory),
isDone = arrayInitialize(n, falseFactory);
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
}, parent);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources;
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
var len = arguments.length;
sources = new Array(len);
for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }
}
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (o) { return source.subscribe(o); }, this);
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var key = value;
if (keySelector) {
try {
key = keySelector(value);
} catch (e) {
o.onError(e);
return;
}
}
if (hasCurrentKey) {
try {
var comparerEquals = comparer(currentKey, key);
} catch (e) {
o.onError(e);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
o.onNext(value);
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this;
return new AnonymousObservable(function (observer) {
var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
observerOrOnNext;
return source.subscribe(function (x) {
try {
tapObserver.onNext(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
try {
tapObserver.onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}, function () {
try {
tapObserver.onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
});
}, this);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.ensure = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
}, this);
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
//deprecate('finallyAction', 'finally or ensure');
return this.ensure(action);
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(noop, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
}, source);
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates.
* if the notifier completes, the observable sequence completes.
*
* @example
* var timer = Observable.timer(500);
* var source = observable.retryWhen(timer);
* @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retryWhen = function (notifier) {
return enumerableRepeat(this).catchErrorWhen(notifier);
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
o.onError(e);
return;
}
o.onNext(accumulation);
},
function (e) { o.onError(e); },
function () {
!hasValue && hasSeed && o.onNext(seed);
o.onCompleted();
}
);
}, source);
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && o.onNext(q.shift());
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
while (q.length > 0) { o.onNext(q.shift()); }
o.onCompleted();
});
}, source);
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
o.onNext(q);
o.onCompleted();
});
}, source);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
function concatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {
var source = this,
onNextFunc = bindCallback(onNext, thisArg, 2),
onErrorFunc = bindCallback(onError, thisArg, 1),
onCompletedFunc = bindCallback(onCompleted, thisArg, 0);
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNextFunc(x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onErrorFunc(err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompletedFunc();
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, this).concatAll();
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
defaultValue === undefined && (defaultValue = null);
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
},
function (e) { observer.onError(e); },
function () {
!found && observer.onNext(defaultValue);
observer.onCompleted();
});
}, source);
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
}
hashSet.push(key) && o.onNext(x);
},
function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [comparer] Used to determine whether the objects are equal.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, comparer) {
return this.groupByUntil(keySelector, elementSelector, observableNever, comparer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [comparer] Used to compare objects. When not specified, the default comparer is used.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, comparer) {
var source = this;
elementSelector || (elementSelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
function handleError(e) { return function (item) { item.onError(e); }; }
var map = new Dictionary(0, comparer),
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
var fireNewMapEntry = false,
writer = map.tryGetValue(key);
if (!writer) {
writer = new Subject();
map.set(key, writer);
fireNewMapEntry = true;
}
if (fireNewMapEntry) {
var group = new GroupedObservable(key, writer, refCountDisposable),
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(group);
var md = new SingleAssignmentDisposable();
groupDisposable.add(md);
var expire = function () {
map.remove(key) && writer.onCompleted();
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(
noop,
function (exn) {
map.getValues().forEach(handleError(exn));
observer.onError(exn);
},
expire)
);
}
var element;
try {
element = elementSelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
map.getValues().forEach(handleError(ex));
observer.onError(ex);
}, function () {
map.getValues().forEach(function (item) { item.onCompleted(); });
observer.onCompleted();
}));
return refCountDisposable;
}, source);
};
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
this.selector = bindCallback(selector, thisArg, 3);
__super__.call(this);
}
MapObservable.prototype.internalMap = function (selector, thisArg) {
var self = this;
return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg)
};
MapObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new MapObserver(observer, this.selector, this));
};
return MapObservable;
}(ObservableBase));
function MapObserver(observer, selector, source) {
this.observer = observer;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
MapObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
if (result === errorObj) {
return this.observer.onError(result.e);
}
this.observer.onNext(result);
};
MapObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
MapObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
MapObserver.prototype.dispose = function() { this.isStopped = true; };
MapObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.map = observableProto.select = function (selector, thisArg) {
var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };
return this instanceof MapObservable ?
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
};
/**
* Retrieves the value of a specified nested property from all elements in
* the Observable sequence.
* @param {Arguments} arguments The nested properties to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function () {
var args = arguments, len = arguments.length;
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
return this.map(function (x) {
var currentProp = x;
for (var i = 0; i < len; i++) {
var p = currentProp[args[i]];
if (typeof p !== 'undefined') {
currentProp = p;
} else {
return undefined;
}
}
return currentProp;
});
};
function flatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, source).mergeAll();
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining <= 0) {
o.onNext(x);
} else {
remaining--;
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
}
running && o.onNext(x);
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
if (count === 0) { return observableEmpty(scheduler); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining-- > 0) {
o.onNext(x);
remaining === 0 && o.onCompleted();
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = true;
return source.subscribe(function (x) {
if (running) {
try {
running = callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
if (running) {
o.onNext(x);
} else {
o.onCompleted();
}
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
this.predicate = bindCallback(predicate, thisArg, 3);
__super__.call(this);
}
FilterObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new FilterObserver(observer, this.predicate, this));
};
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
var self = this;
return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }, thisArg);
};
return FilterObservable;
}(ObservableBase));
function FilterObserver(observer, predicate, source) {
this.observer = observer;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
FilterObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.observer.onError(shouldYield.e);
}
shouldYield && this.observer.onNext(x);
};
FilterObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
FilterObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
FilterObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.filter = observableProto.where = function (predicate, thisArg) {
return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :
new FilterObservable(this, predicate, thisArg);
};
function extremaBy(source, keySelector, comparer) {
return new AnonymousObservable(function (o) {
var hasValue = false, lastKey = null, list = [];
return source.subscribe(function (x) {
var comparison, key;
try {
key = keySelector(x);
} catch (ex) {
o.onError(ex);
return;
}
comparison = 0;
if (!hasValue) {
hasValue = true;
lastKey = key;
} else {
try {
comparison = comparer(key, lastKey);
} catch (ex1) {
o.onError(ex1);
return;
}
}
if (comparison > 0) {
lastKey = key;
list = [];
}
if (comparison >= 0) { list.push(x); }
}, function (e) { o.onError(e); }, function () {
o.onNext(list);
o.onCompleted();
});
}, source);
}
function firstOnly(x) {
if (x.length === 0) { throw new EmptyError(); }
return x[0];
}
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @deprecated Use #reduce instead
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.aggregate = function () {
var hasSeed = false, accumulator, seed, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
return o.onError(e);
}
},
function (e) { o.onError(e); },
function () {
hasValue && o.onNext(accumulation);
!hasValue && hasSeed && o.onNext(seed);
!hasValue && !hasSeed && o.onError(new EmptyError());
o.onCompleted();
}
);
}, source);
};
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function (accumulator) {
var hasSeed = false, seed, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[1];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
return o.onError(e);
}
},
function (e) { o.onError(e); },
function () {
hasValue && o.onNext(accumulation);
!hasValue && hasSeed && o.onNext(seed);
!hasValue && !hasSeed && o.onError(new EmptyError());
o.onCompleted();
}
);
}, source);
};
/**
* Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.
* @param {Function} [predicate] A function to test each element for a condition.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.some = function (predicate, thisArg) {
var source = this;
return predicate ?
source.filter(predicate, thisArg).some() :
new AnonymousObservable(function (observer) {
return source.subscribe(function () {
observer.onNext(true);
observer.onCompleted();
}, function (e) { observer.onError(e); }, function () {
observer.onNext(false);
observer.onCompleted();
});
}, source);
};
/** @deprecated use #some instead */
observableProto.any = function () {
//deprecate('any', 'some');
return this.some.apply(this, arguments);
};
/**
* Determines whether an observable sequence is empty.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/
observableProto.isEmpty = function () {
return this.any().map(not);
};
/**
* Determines whether all elements of an observable sequence satisfy a condition.
* @param {Function} [predicate] A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.every = function (predicate, thisArg) {
return this.filter(function (v) { return !predicate(v); }, thisArg).some().map(not);
};
/** @deprecated use #every instead */
observableProto.all = function () {
//deprecate('all', 'every');
return this.every.apply(this, arguments);
};
/**
* Determines whether an observable sequence includes a specified element with an optional equality comparer.
* @param searchElement The value to locate in the source sequence.
* @param {Number} [fromIndex] An equality comparer to compare elements.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index.
*/
observableProto.includes = function (searchElement, fromIndex) {
var source = this;
function comparer(a, b) {
return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));
}
return new AnonymousObservable(function (o) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
o.onNext(false);
o.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i++ >= n && comparer(x, searchElement)) {
o.onNext(true);
o.onCompleted();
}
},
function (e) { o.onError(e); },
function () {
o.onNext(false);
o.onCompleted();
});
}, this);
};
/**
* @deprecated use #includes instead.
*/
observableProto.contains = function (searchElement, fromIndex) {
//deprecate('contains', 'includes');
observableProto.includes(searchElement, fromIndex);
};
/**
* Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
* @example
* res = source.count();
* res = source.count(function (x) { return x > 3; });
* @param {Function} [predicate]A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.
*/
observableProto.count = function (predicate, thisArg) {
return predicate ?
this.filter(predicate, thisArg).count() :
this.reduce(function (count) { return count + 1; }, 0);
};
/**
* Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
* @param {Any} searchElement Element to locate in the array.
* @param {Number} [fromIndex] The index to start the search. If not specified, defaults to 0.
* @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
*/
observableProto.indexOf = function(searchElement, fromIndex) {
var source = this;
return new AnonymousObservable(function (o) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
o.onNext(-1);
o.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i >= n && x === searchElement) {
o.onNext(i);
o.onCompleted();
}
i++;
},
function (e) { o.onError(e); },
function () {
o.onNext(-1);
o.onCompleted();
});
}, source);
};
/**
* Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/
observableProto.sum = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).sum() :
this.reduce(function (prev, curr) { return prev + curr; }, 0);
};
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
observableProto.minBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, function (x, y) { return comparer(x, y) * -1; });
};
/**
* Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.
* @example
* var res = source.min();
* var res = source.min(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/
observableProto.min = function (comparer) {
return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
observableProto.maxBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, comparer);
};
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
* @example
* var res = source.max();
* var res = source.max(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {
return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/
observableProto.average = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).average() :
this.reduce(function (prev, cur) {
return {
sum: prev.sum + cur,
count: prev.count + 1
};
}, {sum: 0, count: 0 }).map(function (s) {
if (s.count === 0) { throw new EmptyError(); }
return s.sum / s.count;
});
};
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
observableProto.sequenceEqual = function (second, comparer) {
var first = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var donel = false, doner = false, ql = [], qr = [];
var subscription1 = first.subscribe(function (x) {
var equal, v;
if (qr.length > 0) {
v = qr.shift();
try {
equal = comparer(v, x);
} catch (e) {
o.onError(e);
return;
}
if (!equal) {
o.onNext(false);
o.onCompleted();
}
} else if (doner) {
o.onNext(false);
o.onCompleted();
} else {
ql.push(x);
}
}, function(e) { o.onError(e); }, function () {
donel = true;
if (ql.length === 0) {
if (qr.length > 0) {
o.onNext(false);
o.onCompleted();
} else if (doner) {
o.onNext(true);
o.onCompleted();
}
}
});
(isArrayLike(second) || isIterable(second)) && (second = observableFrom(second));
isPromise(second) && (second = observableFromPromise(second));
var subscription2 = second.subscribe(function (x) {
var equal;
if (ql.length > 0) {
var v = ql.shift();
try {
equal = comparer(v, x);
} catch (exception) {
o.onError(exception);
return;
}
if (!equal) {
o.onNext(false);
o.onCompleted();
}
} else if (donel) {
o.onNext(false);
o.onCompleted();
} else {
qr.push(x);
}
}, function(e) { o.onError(e); }, function () {
doner = true;
if (qr.length === 0) {
if (ql.length > 0) {
o.onNext(false);
o.onCompleted();
} else if (donel) {
o.onNext(true);
o.onCompleted();
}
}
});
return new CompositeDisposable(subscription1, subscription2);
}, first);
};
function elementAtOrDefault(source, index, hasDefault, defaultValue) {
if (index < 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (o) {
var i = index;
return source.subscribe(function (x) {
if (i-- === 0) {
o.onNext(x);
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
if (!hasDefault) {
o.onError(new ArgumentOutOfRangeError());
} else {
o.onNext(defaultValue);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the element at a specified index in a sequence.
* @example
* var res = source.elementAt(5);
* @param {Number} index The zero-based index of the element to retrieve.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/
observableProto.elementAt = function (index) {
return elementAtOrDefault(this, index, false);
};
/**
* Returns the element at a specified index in a sequence or a default value if the index is out of range.
* @example
* var res = source.elementAtOrDefault(5);
* var res = source.elementAtOrDefault(5, 0);
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/
observableProto.elementAtOrDefault = function (index, defaultValue) {
return elementAtOrDefault(this, index, true, defaultValue);
};
function singleOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
if (seenValue) {
o.onError(new Error('Sequence contains more than one element'));
} else {
value = x;
seenValue = true;
}
}, function (e) { o.onError(e); }, function () {
if (!seenValue && !hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(value);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.single = function (predicate, thisArg) {
return predicate && isFunction(predicate) ?
this.where(predicate, thisArg).single() :
singleOrDefaultAsync(this, false);
};
/**
* Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
* @example
* var res = res = source.singleOrDefault();
* var res = res = source.singleOrDefault(function (x) { return x === 42; });
* res = source.singleOrDefault(function (x) { return x === 42; }, 0);
* res = source.singleOrDefault(null, 0);
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
return predicate && isFunction(predicate) ?
this.filter(predicate, thisArg).singleOrDefault(null, defaultValue) :
singleOrDefaultAsync(this, true, defaultValue);
};
function firstOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) {
o.onNext(x);
o.onCompleted();
}, function (e) { o.onError(e); }, function () {
if (!hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(defaultValue);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.
* @example
* var res = res = source.first();
* var res = res = source.first(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.
*/
observableProto.first = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).first() :
firstOrDefaultAsync(this, false);
};
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate).firstOrDefault(null, defaultValue) :
firstOrDefaultAsync(this, true, defaultValue);
};
function lastOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
value = x;
seenValue = true;
}, function (e) { o.onError(e); }, function () {
if (!seenValue && !hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(value);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.last = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).last() :
lastOrDefaultAsync(this, false);
};
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate, thisArg).lastOrDefault(null, defaultValue) :
lastOrDefaultAsync(this, true, defaultValue);
};
function findValue (source, predicate, thisArg, yieldIndex) {
var callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0;
return source.subscribe(function (x) {
var shouldRun;
try {
shouldRun = callback(x, i, source);
} catch (e) {
o.onError(e);
return;
}
if (shouldRun) {
o.onNext(yieldIndex ? i : x);
o.onCompleted();
} else {
i++;
}
}, function (e) { o.onError(e); }, function () {
o.onNext(yieldIndex ? -1 : undefined);
o.onCompleted();
});
}, source);
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.
*/
observableProto.find = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, false);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.
*/
observableProto.findIndex = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, true);
};
/**
* Converts the observable sequence to a Set if it exists.
* @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.
*/
observableProto.toSet = function () {
if (typeof root.Set === 'undefined') { throw new TypeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var s = new root.Set();
return source.subscribe(
function (x) { s.add(x); },
function (e) { o.onError(e); },
function () {
o.onNext(s);
o.onCompleted();
});
}, source);
};
/**
* Converts the observable sequence to a Map if it exists.
* @param {Function} keySelector A function which produces the key for the Map.
* @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.
* @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.
*/
observableProto.toMap = function (keySelector, elementSelector) {
if (typeof root.Map === 'undefined') { throw new TypeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var m = new root.Map();
return source.subscribe(
function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
var element = x;
if (elementSelector) {
try {
element = elementSelector(x);
} catch (e) {
o.onError(e);
return;
}
}
m.set(key, element);
},
function (e) { o.onError(e); },
function () {
o.onNext(m);
o.onCompleted();
});
}, source);
};
var fnString = 'function',
throwString = 'throw',
isObject = Rx.internals.isObject;
function toThunk(obj, ctx) {
if (Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
if (isGeneratorFunction(obj)) { return observableSpawn(obj.call(ctx)); }
if (isGenerator(obj)) { return observableSpawn(obj); }
if (isObservable(obj)) { return observableToThunk(obj); }
if (isPromise(obj)) { return promiseToThunk(obj); }
if (typeof obj === fnString) { return obj; }
if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
return obj;
}
function objectToThunk(obj) {
var ctx = this;
return function (done) {
var keys = Object.keys(obj),
pending = keys.length,
results = new obj.constructor(),
finished;
if (!pending) {
timeoutScheduler.schedule(function () { done(null, results); });
return;
}
for (var i = 0, len = keys.length; i < len; i++) {
run(obj[keys[i]], keys[i]);
}
function run(fn, key) {
if (finished) { return; }
try {
fn = toThunk(fn, ctx);
if (typeof fn !== fnString) {
results[key] = fn;
return --pending || done(null, results);
}
fn.call(ctx, function(err, res) {
if (finished) { return; }
if (err) {
finished = true;
return done(err);
}
results[key] = res;
--pending || done(null, results);
});
} catch (e) {
finished = true;
done(e);
}
}
}
}
function observableToThunk(observable) {
return function (fn) {
var value, hasValue = false;
observable.subscribe(
function (v) {
value = v;
hasValue = true;
},
fn,
function () {
hasValue && fn(null, value);
});
}
}
function promiseToThunk(promise) {
return function(fn) {
promise.then(function(res) {
fn(null, res);
}, fn);
}
}
function isObservable(obj) {
return obj && typeof obj.subscribe === fnString;
}
function isGeneratorFunction(obj) {
return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
}
function isGenerator(obj) {
return obj && typeof obj.next === fnString && typeof obj[throwString] === fnString;
}
/*
* Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
* @param {Function} The spawning function.
* @returns {Function} a function which has a done continuation.
*/
var observableSpawn = Rx.spawn = function (fn) {
var isGenFun = isGeneratorFunction(fn);
return function (done) {
var ctx = this,
gen = fn;
if (isGenFun) {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = args.length,
hasCallback = len && typeof args[len - 1] === fnString;
done = hasCallback ? args.pop() : handleError;
gen = fn.apply(this, args);
} else {
done = done || handleError;
}
next();
function exit(err, res) {
timeoutScheduler.schedule(done.bind(ctx, err, res));
}
function next(err, res) {
var ret;
// multiple args
if (arguments.length > 2) {
for(var res = [], i = 1, len = arguments.length; i < len; i++) { res.push(arguments[i]); }
}
if (err) {
try {
ret = gen[throwString](err);
} catch (e) {
return exit(e);
}
}
if (!err) {
try {
ret = gen.next(res);
} catch (e) {
return exit(e);
}
}
if (ret.done) {
return exit(null, ret.value);
}
ret.value = toThunk(ret.value, ctx);
if (typeof ret.value === fnString) {
var called = false;
try {
ret.value.call(ctx, function() {
if (called) {
return;
}
called = true;
next.apply(ctx, arguments);
});
} catch (e) {
timeoutScheduler.schedule(function () {
if (called) {
return;
}
called = true;
next.call(ctx, e);
});
}
return;
}
// Not supported
next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
}
}
};
function handleError(err) {
if (!err) { return; }
timeoutScheduler.schedule(function() {
throw err;
});
}
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* var res = Rx.Observable.start(function () { console.log('hello'); });
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
Observable.start = function (func, context, scheduler) {
return observableToAsync(func, context, scheduler)();
};
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return function () {
var args = arguments,
subject = new AsyncSubject();
scheduler.schedule(function () {
var result;
try {
result = func.apply(context, args);
} catch (e) {
subject.onError(e);
return;
}
subject.onNext(result);
subject.onCompleted();
});
return subject.asObservable();
};
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler() {
var len = arguments.length, results = new Array(len);
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var len = arguments.length, results = [];
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
return observer.onError(err);
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
return observer.onError(err);
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
var PausableObservable = (function (__super__) {
inherits(PausableObservable, __super__);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (o) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
o.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
o.onError(ex);
return;
}
o.onNext(res);
}
if (isDone && values[1]) {
o.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
o.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && o.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
function (e) { o.onError(e); },
function () {
isDone = true;
next(true, 1);
})
);
}, source);
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(o) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
o.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
o.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
o.onNext(q.shift());
}
o.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
o.onNext(q.shift());
}
o.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
__super__.call(this, subscribe, source);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
if (numberOfItems == null) { numberOfItems = -1; }
return this.subject.request(numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = (function (__super__) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue) {
enableQueue == null && (enableQueue = true);
__super__.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0)
this.subject.onCompleted();
else
this.queue.push(Rx.Notification.createOnCompleted());
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0)
this.subject.onError(error);
else
this.queue.push(Rx.Notification.createOnError(error));
},
onNext: function (value) {
var hasRequested = false;
if (this.requestedCount === 0) {
this.enableQueue && this.queue.push(Rx.Notification.createOnNext(value));
} else {
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
hasRequested = true;
}
hasRequested && this.subject.onNext(value);
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
var first = this.queue.shift();
first.accept(this.subject);
if (first.kind === 'N') numberOfItems--;
else { this.disposeCurrentRequest(); this.queue = []; }
}
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
}
//TODO I don't think this is ever necessary, since termination of a sequence without a queue occurs in the onCompletion or onError function
//if (this.hasFailed) {
// this.subject.onError(this.error);
//} else if (this.hasCompleted) {
// this.subject.onCompleted();
//}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
this.disposeCurrentRequest();
var self = this, r = this._processRequest(number);
var number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
return this.requestedDisposable;
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
}
});
return ControlledSubject;
}(Observable));
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};
var StopAndWaitObservable = (function (__super__) {
function subscribe (observer) {
this.subscription = this.source.subscribe(new StopAndWaitObserver(observer, this, this.subscription));
var self = this;
timeoutScheduler.schedule(function () { self.source.request(1); });
return this.subscription;
}
inherits(StopAndWaitObservable, __super__);
function StopAndWaitObservable (source) {
__super__.call(this, subscribe, source);
this.source = source;
}
var StopAndWaitObserver = (function (__sub__) {
inherits(StopAndWaitObserver, __sub__);
function StopAndWaitObserver (observer, observable, cancel) {
__sub__.call(this);
this.observer = observer;
this.observable = observable;
this.cancel = cancel;
}
var stopAndWaitObserverProto = StopAndWaitObserver.prototype;
stopAndWaitObserverProto.completed = function () {
this.observer.onCompleted();
this.dispose();
};
stopAndWaitObserverProto.error = function (error) {
this.observer.onError(error);
this.dispose();
}
stopAndWaitObserverProto.next = function (value) {
this.observer.onNext(value);
var self = this;
timeoutScheduler.schedule(function () {
self.observable.source.request(1);
});
};
stopAndWaitObserverProto.dispose = function () {
this.observer = null;
if (this.cancel) {
this.cancel.dispose();
this.cancel = null;
}
__sub__.prototype.dispose.call(this);
};
return StopAndWaitObserver;
}(AbstractObserver));
return StopAndWaitObservable;
}(Observable));
/**
* Attaches a stop and wait observable to the current observable.
* @returns {Observable} A stop and wait observable.
*/
ControlledObservable.prototype.stopAndWait = function () {
return new StopAndWaitObservable(this);
};
var WindowedObservable = (function (__super__) {
function subscribe (observer) {
this.subscription = this.source.subscribe(new WindowedObserver(observer, this, this.subscription));
var self = this;
timeoutScheduler.schedule(function () {
self.source.request(self.windowSize);
});
return this.subscription;
}
inherits(WindowedObservable, __super__);
function WindowedObservable(source, windowSize) {
__super__.call(this, subscribe, source);
this.source = source;
this.windowSize = windowSize;
}
var WindowedObserver = (function (__sub__) {
inherits(WindowedObserver, __sub__);
function WindowedObserver(observer, observable, cancel) {
this.observer = observer;
this.observable = observable;
this.cancel = cancel;
this.received = 0;
}
var windowedObserverPrototype = WindowedObserver.prototype;
windowedObserverPrototype.completed = function () {
this.observer.onCompleted();
this.dispose();
};
windowedObserverPrototype.error = function (error) {
this.observer.onError(error);
this.dispose();
};
windowedObserverPrototype.next = function (value) {
this.observer.onNext(value);
this.received = ++this.received % this.observable.windowSize;
if (this.received === 0) {
var self = this;
timeoutScheduler.schedule(function () {
self.observable.source.request(self.observable.windowSize);
});
}
};
windowedObserverPrototype.dispose = function () {
this.observer = null;
if (this.cancel) {
this.cancel.dispose();
this.cancel = null;
}
__sub__.prototype.dispose.call(this);
};
return WindowedObserver;
}(AbstractObserver));
return WindowedObservable;
}(Observable));
/**
* Creates a sliding windowed observable based upon the window size.
* @param {Number} windowSize The number of items in the window
* @returns {Observable} A windowed observable based upon the window size.
*/
ControlledObservable.prototype.windowed = function (windowSize) {
return new WindowedObservable(this, windowSize);
};
/**
* Pipes the existing Observable sequence into a Node.js Stream.
* @param {Stream} dest The destination Node.js stream.
* @returns {Stream} The destination stream.
*/
observableProto.pipe = function (dest) {
var source = this.pausableBuffered();
function onDrain() {
source.resume();
}
dest.addListener('drain', onDrain);
source.subscribe(
function (x) {
!dest.write(String(x)) && source.pause();
},
function (err) {
dest.emit('error', err);
},
function () {
// Hack check because STDIO is not closable
!dest._isStdio && dest.end();
dest.removeListener('drain', onDrain);
});
source.resume();
return dest;
};
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}, source) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param windowSize [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {
return this.replay(null, bufferSize, windowSize, scheduler).refCount();
};
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.hasError = false;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Gets the current value or throws an exception.
* Value is frozen after onCompleted is called.
* After onError is called always throws the specified exception.
* An exception is always thrown after dispose is called.
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
*/
getValue: function () {
checkDisposed(this);
if (this.hasError) {
throw this.error;
}
return this.value;
},
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed(this);
this._trim(this.scheduler.now());
this.observers.push(so);
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
so.onError(this.error);
} else if (this.isStopped) {
so.onCompleted();
}
so.ensureActive();
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;
this.windowSize = windowSize == null ? maxSafeInteger : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onError(error);
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, function (o) { return subject.subscribe(o); });
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
var Dictionary = (function () {
var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647],
noSuchkey = "no such key",
duplicatekey = "duplicate key";
function isPrime(candidate) {
if ((candidate & 1) === 0) { return candidate === 2; }
var num1 = Math.sqrt(candidate),
num2 = 3;
while (num2 <= num1) {
if (candidate % num2 === 0) { return false; }
num2 += 2;
}
return true;
}
function getPrime(min) {
var index, num, candidate;
for (index = 0; index < primes.length; ++index) {
num = primes[index];
if (num >= min) { return num; }
}
candidate = min | 1;
while (candidate < primes[primes.length - 1]) {
if (isPrime(candidate)) { return candidate; }
candidate += 2;
}
return min;
}
function stringHashFn(str) {
var hash = 757602046;
if (!str.length) { return hash; }
for (var i = 0, len = str.length; i < len; i++) {
var character = str.charCodeAt(i);
hash = ((hash << 5) - hash) + character;
hash = hash & hash;
}
return hash;
}
function numberHashFn(key) {
var c2 = 0x27d4eb2d;
key = (key ^ 61) ^ (key >>> 16);
key = key + (key << 3);
key = key ^ (key >>> 4);
key = key * c2;
key = key ^ (key >>> 15);
return key;
}
var getHashCode = (function () {
var uniqueIdCounter = 0;
return function (obj) {
if (obj == null) { throw new Error(noSuchkey); }
// Check for built-ins before tacking on our own for any object
if (typeof obj === 'string') { return stringHashFn(obj); }
if (typeof obj === 'number') { return numberHashFn(obj); }
if (typeof obj === 'boolean') { return obj === true ? 1 : 0; }
if (obj instanceof Date) { return numberHashFn(obj.valueOf()); }
if (obj instanceof RegExp) { return stringHashFn(obj.toString()); }
if (typeof obj.valueOf === 'function') {
// Hack check for valueOf
var valueOf = obj.valueOf();
if (typeof valueOf === 'number') { return numberHashFn(valueOf); }
if (typeof valueOf === 'string') { return stringHashFn(valueOf); }
}
if (obj.hashCode) { return obj.hashCode(); }
var id = 17 * uniqueIdCounter++;
obj.hashCode = function () { return id; };
return id;
};
}());
function newEntry() {
return { key: null, value: null, next: 0, hashCode: 0 };
}
function Dictionary(capacity, comparer) {
if (capacity < 0) { throw new ArgumentOutOfRangeError(); }
if (capacity > 0) { this._initialize(capacity); }
this.comparer = comparer || defaultComparer;
this.freeCount = 0;
this.size = 0;
this.freeList = -1;
}
var dictionaryProto = Dictionary.prototype;
dictionaryProto._initialize = function (capacity) {
var prime = getPrime(capacity), i;
this.buckets = new Array(prime);
this.entries = new Array(prime);
for (i = 0; i < prime; i++) {
this.buckets[i] = -1;
this.entries[i] = newEntry();
}
this.freeList = -1;
};
dictionaryProto.add = function (key, value) {
this._insert(key, value, true);
};
dictionaryProto._insert = function (key, value, add) {
if (!this.buckets) { this._initialize(0); }
var index3,
num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length;
for (var index2 = this.buckets[index1]; index2 >= 0; index2 = this.entries[index2].next) {
if (this.entries[index2].hashCode === num && this.comparer(this.entries[index2].key, key)) {
if (add) { throw new Error(duplicatekey); }
this.entries[index2].value = value;
return;
}
}
if (this.freeCount > 0) {
index3 = this.freeList;
this.freeList = this.entries[index3].next;
--this.freeCount;
} else {
if (this.size === this.entries.length) {
this._resize();
index1 = num % this.buckets.length;
}
index3 = this.size;
++this.size;
}
this.entries[index3].hashCode = num;
this.entries[index3].next = this.buckets[index1];
this.entries[index3].key = key;
this.entries[index3].value = value;
this.buckets[index1] = index3;
};
dictionaryProto._resize = function () {
var prime = getPrime(this.size * 2),
numArray = new Array(prime);
for (index = 0; index < numArray.length; ++index) { numArray[index] = -1; }
var entryArray = new Array(prime);
for (index = 0; index < this.size; ++index) { entryArray[index] = this.entries[index]; }
for (var index = this.size; index < prime; ++index) { entryArray[index] = newEntry(); }
for (var index1 = 0; index1 < this.size; ++index1) {
var index2 = entryArray[index1].hashCode % prime;
entryArray[index1].next = numArray[index2];
numArray[index2] = index1;
}
this.buckets = numArray;
this.entries = entryArray;
};
dictionaryProto.remove = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length,
index2 = -1;
for (var index3 = this.buckets[index1]; index3 >= 0; index3 = this.entries[index3].next) {
if (this.entries[index3].hashCode === num && this.comparer(this.entries[index3].key, key)) {
if (index2 < 0) {
this.buckets[index1] = this.entries[index3].next;
} else {
this.entries[index2].next = this.entries[index3].next;
}
this.entries[index3].hashCode = -1;
this.entries[index3].next = this.freeList;
this.entries[index3].key = null;
this.entries[index3].value = null;
this.freeList = index3;
++this.freeCount;
return true;
} else {
index2 = index3;
}
}
}
return false;
};
dictionaryProto.clear = function () {
var index, len;
if (this.size <= 0) { return; }
for (index = 0, len = this.buckets.length; index < len; ++index) {
this.buckets[index] = -1;
}
for (index = 0; index < this.size; ++index) {
this.entries[index] = newEntry();
}
this.freeList = -1;
this.size = 0;
};
dictionaryProto._findEntry = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647;
for (var index = this.buckets[num % this.buckets.length]; index >= 0; index = this.entries[index].next) {
if (this.entries[index].hashCode === num && this.comparer(this.entries[index].key, key)) {
return index;
}
}
}
return -1;
};
dictionaryProto.count = function () {
return this.size - this.freeCount;
};
dictionaryProto.tryGetValue = function (key) {
var entry = this._findEntry(key);
return entry >= 0 ?
this.entries[entry].value :
undefined;
};
dictionaryProto.getValues = function () {
var index = 0, results = [];
if (this.entries) {
for (var index1 = 0; index1 < this.size; index1++) {
if (this.entries[index1].hashCode >= 0) {
results[index++] = this.entries[index1].value;
}
}
}
return results;
};
dictionaryProto.get = function (key) {
var entry = this._findEntry(key);
if (entry >= 0) { return this.entries[entry].value; }
throw new Error(noSuchkey);
};
dictionaryProto.set = function (key, value) {
this._insert(key, value, false);
};
dictionaryProto.containskey = function (key) {
return this._findEntry(key) >= 0;
};
return Dictionary;
}());
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var leftDone = false, rightDone = false;
var leftId = 0, rightId = 0;
var leftMap = new Dictionary(), rightMap = new Dictionary();
group.add(left.subscribe(
function (value) {
var id = leftId++;
var md = new SingleAssignmentDisposable();
leftMap.add(id, value);
group.add(md);
var expire = function () {
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
rightMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(value, v);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
leftDone = true;
(rightDone || leftMap.count() === 0) && observer.onCompleted();
})
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
var md = new SingleAssignmentDisposable();
rightMap.add(id, value);
group.add(md);
var expire = function () {
rightMap.remove(id) && rightMap.count() === 0 && rightDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
leftMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(v, value);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
rightDone = true;
(leftDone || rightMap.count() === 0) && observer.onCompleted();
})
);
return group;
}, left);
};
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var r = new RefCountDisposable(group);
var leftMap = new Dictionary(), rightMap = new Dictionary();
var leftId = 0, rightId = 0;
function handleError(e) { return function (v) { v.onError(e); }; };
group.add(left.subscribe(
function (value) {
var s = new Subject();
var id = leftId++;
leftMap.add(id, s);
var result;
try {
result = resultSelector(value, addRef(s, r));
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(result);
rightMap.getValues().forEach(function (v) { s.onNext(v); });
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
leftMap.remove(id) && s.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
observer.onCompleted.bind(observer))
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
rightMap.add(id, value);
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
rightMap.remove(id);
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
leftMap.getValues().forEach(function (v) { v.onNext(value); });
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
})
);
return r;
}, left);
};
/**
* Projects each element of an observable sequence into zero or more buffers.
*
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
return observableWindowWithBoundaries.call(this, windowOpeningsOrClosingSelector);
}
return typeof windowOpeningsOrClosingSelector === 'function' ?
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
};
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {
return win;
});
}
function observableWindowWithBoundaries(windowBoundaries) {
var source = this;
return new AnonymousObservable(function (observer) {
var win = new Subject(),
d = new CompositeDisposable(),
r = new RefCountDisposable(d);
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));
d.add(windowBoundaries.subscribe(function (w) {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
return r;
}, source);
}
function observableWindowWithClosingSelector(windowClosingSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SerialDisposable(),
d = new CompositeDisposable(m),
r = new RefCountDisposable(d),
win = new Subject();
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
function createWindowClose () {
var windowClose;
try {
windowClose = windowClosingSelector();
} catch (e) {
observer.onError(e);
return;
}
isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));
var m1 = new SingleAssignmentDisposable();
m.setDisposable(m1);
m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
createWindowClose();
}));
}
createWindowClose();
return r;
}, source);
}
/**
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
*/
observableProto.pairwise = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var previous, hasPrevious = false;
return source.subscribe(
function (x) {
if (hasPrevious) {
observer.onNext([previous, x]);
} else {
hasPrevious = true;
}
previous = x;
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
}, source);
};
/**
* Returns two observables which partition the observations of the source by the given function.
* The first will trigger observations for those values for which the predicate returns true.
* The second will trigger observations for those values where the predicate returns false.
* The predicate is executed once for each subscribed observer.
* Both also propagate all error observations arising from the source and each completes
* when the source completes.
* @param {Function} predicate
* The function to determine which output Observable will trigger a particular observation.
* @returns {Array}
* An array of observables. The first triggers when the predicate returns true,
* and the second triggers when the predicate returns false.
*/
observableProto.partition = function(predicate, thisArg) {
return [
this.filter(predicate, thisArg),
this.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); })
];
};
function enumerableWhile(condition, source) {
return new Enumerable(function () {
return new Enumerator(function () {
return condition() ?
{ done: false, value: source } :
{ done: true, value: undefined };
});
});
}
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.letBind = observableProto['let'] = function (func) {
return func(this);
};
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {
elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());
isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));
isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));
// Assume a scheduler for empty only
typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));
return condition() ? thenSource : elseSourceOrScheduler;
});
};
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
Observable['for'] = Observable.forIn = function (sources, resultSelector, thisArg) {
return enumerableOf(sources, resultSelector, thisArg).concat();
};
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
isPromise(source) && (source = observableFromPromise(source));
return enumerableWhile(condition, source).concat();
};
/**
* Repeats source as long as condition holds emulating a do while loop.
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
observableProto.doWhile = function (condition) {
return observableConcat([this, observableWhileDo(condition, this)]);
};
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {
isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));
defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());
typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));
var result = sources[selector()];
isPromise(result) && (result = observableFromPromise(result));
return result || defaultSourceOrScheduler;
});
};
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/
observableProto.expand = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [],
m = new SerialDisposable(),
d = new CompositeDisposable(m),
activeCount = 0,
isAcquired = false;
var ensureActive = function () {
var isOwner = false;
if (q.length > 0) {
isOwner = !isAcquired;
isAcquired = true;
}
if (isOwner) {
m.setDisposable(scheduler.scheduleRecursive(function (self) {
var work;
if (q.length > 0) {
work = q.shift();
} else {
isAcquired = false;
return;
}
var m1 = new SingleAssignmentDisposable();
d.add(m1);
m1.setDisposable(work.subscribe(function (x) {
observer.onNext(x);
var result = null;
try {
result = selector(x);
} catch (e) {
observer.onError(e);
}
q.push(result);
activeCount++;
ensureActive();
}, observer.onError.bind(observer), function () {
d.remove(m1);
activeCount--;
if (activeCount === 0) {
observer.onCompleted();
}
}));
self();
}));
}
};
q.push(source);
activeCount++;
ensureActive();
return d;
}, this);
};
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
Observable.forkJoin = function () {
var allSources = [];
if (Array.isArray(arguments[0])) {
allSources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { allSources.push(arguments[i]); }
}
return new AnonymousObservable(function (subscriber) {
var count = allSources.length;
if (count === 0) {
subscriber.onCompleted();
return disposableEmpty;
}
var group = new CompositeDisposable(),
finished = false,
hasResults = new Array(count),
hasCompleted = new Array(count),
results = new Array(count);
for (var idx = 0; idx < count; idx++) {
(function (i) {
var source = allSources[i];
isPromise(source) && (source = observableFromPromise(source));
group.add(
source.subscribe(
function (value) {
if (!finished) {
hasResults[i] = true;
results[i] = value;
}
},
function (e) {
finished = true;
subscriber.onError(e);
group.dispose();
},
function () {
if (!finished) {
if (!hasResults[i]) {
subscriber.onCompleted();
return;
}
hasCompleted[i] = true;
for (var ix = 0; ix < count; ix++) {
if (!hasCompleted[ix]) { return; }
}
finished = true;
subscriber.onNext(results);
subscriber.onCompleted();
}
}));
})(idx);
}
return group;
});
};
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
observableProto.forkJoin = function (second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var leftStopped = false, rightStopped = false,
hasLeft = false, hasRight = false,
lastLeft, lastRight,
leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable();
isPromise(second) && (second = observableFromPromise(second));
leftSubscription.setDisposable(
first.subscribe(function (left) {
hasLeft = true;
lastLeft = left;
}, function (err) {
rightSubscription.dispose();
observer.onError(err);
}, function () {
leftStopped = true;
if (rightStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
rightSubscription.setDisposable(
second.subscribe(function (right) {
hasRight = true;
lastRight = right;
}, function (err) {
leftSubscription.dispose();
observer.onError(err);
}, function () {
rightStopped = true;
if (leftStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
return new CompositeDisposable(leftSubscription, rightSubscription);
}, first);
};
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
observableProto.manySelect = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return observableDefer(function () {
var chain;
return source
.map(function (x) {
var curr = new ChainObservable(x);
chain && chain.onNext(x);
chain = curr;
return curr;
})
.tap(
noop,
function (e) { chain && chain.onError(e); },
function () { chain && chain.onCompleted(); }
)
.observeOn(scheduler)
.map(selector);
}, source);
};
var ChainObservable = (function (__super__) {
function subscribe (observer) {
var self = this, g = new CompositeDisposable();
g.add(currentThreadScheduler.schedule(function () {
observer.onNext(self.head);
g.add(self.tail.mergeAll().subscribe(observer));
}));
return g;
}
inherits(ChainObservable, __super__);
function ChainObservable(head) {
__super__.call(this, subscribe);
this.head = head;
this.tail = new AsyncSubject();
}
addProperties(ChainObservable.prototype, Observer, {
onCompleted: function () {
this.onNext(Observable.empty());
},
onError: function (e) {
this.onNext(Observable.throwError(e));
},
onNext: function (v) {
this.tail.onNext(v);
this.tail.onCompleted();
}
});
return ChainObservable;
}(Observable));
/** @private */
var Map = root.Map || (function () {
function Map() {
this._keys = [];
this._values = [];
}
Map.prototype.get = function (key) {
var i = this._keys.indexOf(key);
return i !== -1 ? this._values[i] : undefined;
};
Map.prototype.set = function (key, value) {
var i = this._keys.indexOf(key);
i !== -1 && (this._values[i] = value);
this._values[this._keys.push(key) - 1] = value;
};
Map.prototype.forEach = function (callback, thisArg) {
for (var i = 0, len = this._keys.length; i < len; i++) {
callback.call(thisArg, this._values[i], this._keys[i]);
}
};
return Map;
}());
/**
* @constructor
* Represents a join pattern over observable sequences.
*/
function Pattern(patterns) {
this.patterns = patterns;
}
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
Pattern.prototype.and = function (other) {
return new Pattern(this.patterns.concat(other));
};
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
Pattern.prototype.thenDo = function (selector) {
return new Plan(this, selector);
};
function Plan(expression, selector) {
this.expression = expression;
this.selector = selector;
}
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
var self = this;
var joinObservers = [];
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
}
var activePlan = new ActivePlan(joinObservers, function () {
var result;
try {
result = self.selector.apply(self, arguments);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, function () {
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
joinObservers[j].removeActivePlan(activePlan);
}
deactivate(activePlan);
});
for (i = 0, len = joinObservers.length; i < len; i++) {
joinObservers[i].addActivePlan(activePlan);
}
return activePlan;
};
function planCreateObserver(externalSubscriptions, observable, onError) {
var entry = externalSubscriptions.get(observable);
if (!entry) {
var observer = new JoinObserver(observable, onError);
externalSubscriptions.set(observable, observer);
return observer;
}
return entry;
}
function ActivePlan(joinObserverArray, onNext, onCompleted) {
this.joinObserverArray = joinObserverArray;
this.onNext = onNext;
this.onCompleted = onCompleted;
this.joinObservers = new Map();
for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {
var joinObserver = this.joinObserverArray[i];
this.joinObservers.set(joinObserver, joinObserver);
}
}
ActivePlan.prototype.dequeue = function () {
this.joinObservers.forEach(function (v) { v.queue.shift(); });
};
ActivePlan.prototype.match = function () {
var i, len, hasValues = true;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
if (this.joinObserverArray[i].queue.length === 0) {
hasValues = false;
break;
}
}
if (hasValues) {
var firstValues = [],
isCompleted = false;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
firstValues.push(this.joinObserverArray[i].queue[0]);
this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);
}
if (isCompleted) {
this.onCompleted();
} else {
this.dequeue();
var values = [];
for (i = 0, len = firstValues.length; i < firstValues.length; i++) {
values.push(firstValues[i].value);
}
this.onNext.apply(this, values);
}
}
};
var JoinObserver = (function (__super__) {
inherits(JoinObserver, __super__);
function JoinObserver(source, onError) {
__super__.call(this);
this.source = source;
this.onError = onError;
this.queue = [];
this.activePlans = [];
this.subscription = new SingleAssignmentDisposable();
this.isDisposed = false;
}
var JoinObserverPrototype = JoinObserver.prototype;
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {
if (notification.kind === 'E') {
return this.onError(notification.exception);
}
this.queue.push(notification);
var activePlans = this.activePlans.slice(0);
for (var i = 0, len = activePlans.length; i < len; i++) {
activePlans[i].match();
}
}
};
JoinObserverPrototype.error = noop;
JoinObserverPrototype.completed = noop;
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserverPrototype.subscribe = function () {
this.subscription.setDisposable(this.source.materialize().subscribe(this));
};
JoinObserverPrototype.removeActivePlan = function (activePlan) {
this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);
this.activePlans.length === 0 && this.dispose();
};
JoinObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
if (!this.isDisposed) {
this.isDisposed = true;
this.subscription.dispose();
}
};
return JoinObserver;
} (AbstractObserver));
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
observableProto.and = function (right) {
return new Pattern([this, right]);
};
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param {Function} selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
observableProto.thenDo = function (selector) {
return new Pattern([this]).thenDo(selector);
};
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
Observable.when = function () {
var len = arguments.length, plans;
if (Array.isArray(arguments[0])) {
plans = arguments[0];
} else {
plans = new Array(len);
for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }
}
return new AnonymousObservable(function (o) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
function (x) { o.onNext(x); },
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
o.onError(err);
},
function (x) { o.onCompleted(); }
);
try {
for (var i = 0, len = plans.length; i < len; i++) {
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
var idx = activePlans.indexOf(activePlan);
activePlans.splice(idx, 1);
activePlans.length === 0 && o.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(o);
}
var group = new CompositeDisposable();
externalSubscriptions.forEach(function (joinObserver) {
joinObserver.subscribe();
group.add(joinObserver);
});
return group;
});
};
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count);
self(count + 1, d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
}, source);
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, this);
};
/**
* @deprecated use #debounce or #throttleWithTimeout instead.
*/
observableProto.throttle = function(dueTime, scheduler) {
//deprecate('throttle', 'debounce or throttleWithTimeout');
return this.debounce(dueTime, scheduler);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
var source = this, timeShift;
timeShiftOrScheduler == null && (timeShift = timeSpan);
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (typeof timeShiftOrScheduler === 'number') {
timeShift = timeShiftOrScheduler;
} else if (isScheduler(timeShiftOrScheduler)) {
timeShift = timeSpan;
scheduler = timeShiftOrScheduler;
}
return new AnonymousObservable(function (observer) {
var groupDisposable,
nextShift = timeShift,
nextSpan = timeSpan,
q = [],
refCountDisposable,
timerD = new SerialDisposable(),
totalTime = 0;
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable);
function createTimer () {
var m = new SingleAssignmentDisposable(),
isSpan = false,
isShift = false;
timerD.setDisposable(m);
if (nextSpan === nextShift) {
isSpan = true;
isShift = true;
} else if (nextSpan < nextShift) {
isSpan = true;
} else {
isShift = true;
}
var newTotalTime = isSpan ? nextSpan : nextShift,
ts = newTotalTime - totalTime;
totalTime = newTotalTime;
if (isSpan) {
nextSpan += timeShift;
}
if (isShift) {
nextShift += timeShift;
}
m.setDisposable(scheduler.scheduleWithRelative(ts, function () {
if (isShift) {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
isSpan && q.shift().onCompleted();
createTimer();
}));
};
q.push(new Subject());
observer.onNext(addRef(q[0], refCountDisposable));
createTimer();
groupDisposable.add(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
},
function (e) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }
observer.onError(e);
},
function () {
for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var timerD = new SerialDisposable(),
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable),
n = 0,
windowId = 0,
s = new Subject();
function createTimer(id) {
var m = new SingleAssignmentDisposable();
timerD.setDisposable(m);
m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () {
if (id !== windowId) { return; }
n = 0;
var newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
createTimer(newId);
}));
}
observer.onNext(addRef(s, refCountDisposable));
createTimer(0);
groupDisposable.add(source.subscribe(
function (x) {
var newId = 0, newWindow = false;
s.onNext(x);
if (++n === count) {
newWindow = true;
n = 0;
newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
}
newWindow && createTimer(newId);
},
function (e) {
s.onError(e);
observer.onError(e);
}, function () {
s.onCompleted();
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {
return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) {
return x.toArray();
});
};
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
observableProto.timeInterval = function (scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return observableDefer(function () {
var last = scheduler.now();
return source.map(function (x) {
var now = scheduler.now(), span = now - last;
last = now;
return { value: x, interval: span };
});
});
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
atEnd && observer.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
}, source);
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
}, source);
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithAbsoluteTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return new Date(); }
* });
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Time shifts the observable sequence by delaying the subscription.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delaySubscription = function (dueTime, scheduler) {
return this.delayWithSelector(observableTimer(dueTime, isScheduler(scheduler) ? scheduler : timeoutScheduler), observableEmpty);
};
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
var source = this, subDelay, selector;
if (typeof subscriptionDelay === 'function') {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, done = function () {
if (atEnd && delays.length === 0) { observer.onCompleted(); }
}, subscription = new SerialDisposable(), start = function () {
subscription.setDisposable(source.subscribe(function (x) {
var delay;
try {
delay = selector(x);
} catch (error) {
observer.onError(error);
return;
}
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(function () {
observer.onNext(x);
delays.remove(d);
done();
}, observer.onError.bind(observer), function () {
observer.onNext(x);
delays.remove(d);
done();
}));
}, observer.onError.bind(observer), function () {
atEnd = true;
subscription.dispose();
done();
}));
};
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(start, observer.onError.bind(observer), start));
}
return new CompositeDisposable(subscription, delays);
}, this);
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
if (arguments.length === 1) {
timeoutdurationSelector = firstTimeout;
firstTimeout = observableNever();
}
other || (other = observableThrow(new Error('Timeout')));
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false;
function setTimer(timeout) {
var myId = id;
function timerWins () {
return id === myId;
}
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
d.dispose();
}, function (e) {
timerWins() && observer.onError(e);
}, function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
}));
};
setTimer(firstTimeout);
function observerWins() {
var res = !switched;
if (res) { id++; }
return res;
}
original.setDisposable(source.subscribe(function (x) {
if (observerWins()) {
observer.onNext(x);
var timeout;
try {
timeout = timeoutdurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);
}
}, function (e) {
observerWins() && observer.onError(e);
}, function () {
observerWins() && observer.onCompleted();
}));
return new CompositeDisposable(subscription, timer);
}, source);
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
* @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounceWithSelector = function (durationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = durationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
isPromise(throttle) && (throttle = observableFromPromise(throttle));
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
hasValue && observer.onNext(value);
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, source);
};
/**
* @deprecated use #debounceWithSelector instead.
*/
observableProto.throttleWithSelector = function (durationSelector) {
//deprecate('throttleWithSelector', 'debounceWithSelector');
return this.debounceWithSelector(durationSelector);
};
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
observableProto.skipLastWithTime = function (duration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
o.onNext(q.shift().value);
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
o.onNext(q.shift().value);
}
o.onCompleted();
});
}, source);
};
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now();
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) { o.onNext(next.value); }
}
o.onCompleted();
});
}, source);
};
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastBufferWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now(), res = [];
while (q.length > 0) {
var next = q.shift();
now - next.interval <= duration && res.push(next.value);
}
o.onNext(res);
o.onCompleted();
});
}, source);
};
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
observableProto.takeWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, function () { o.onCompleted(); }), source.subscribe(o));
}, source);
};
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
observableProto.skipWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler.scheduleWithRelative(duration, function () { open = true; }),
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
}, source);
};
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
observableProto.skipUntilWithTime = function (startTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = startTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
var open = false;
return new CompositeDisposable(
scheduler[schedulerMethod](startTime, function () { open = true; }),
source.subscribe(
function (x) { open && o.onNext(x); },
function (e) { o.onError(e); }, function () { o.onCompleted(); }));
}, source);
};
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
observableProto.takeUntilWithTime = function (endTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = endTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
return new CompositeDisposable(
scheduler[schedulerMethod](endTime, function () { o.onCompleted(); }),
source.subscribe(o));
}, source);
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttleFirst = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (o) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
o.onNext(x);
}
},function (e) { o.onError(e); }, function () { o.onCompleted(); }
);
}, source);
};
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(o) {
return {
'@@transducer/init': function() {
return o;
},
'@@transducer/step': function(obs, input) {
return obs.onNext(input);
},
'@@transducer/result': function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(o) {
var xform = transducer(transformForObserver(o));
return source.subscribe(
function(v) {
try {
xform['@@transducer/step'](o, v);
} catch (e) {
o.onError(e);
}
},
function (e) { o.onError(e); },
function() { xform['@@transducer/result'](o); }
);
}, source);
};
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
}, this);
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this,
selectorFunc = bindCallback(selector, thisArg, 3);
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selectorFunc(x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
function (e) { observer.onError(e); },
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
function (e) { observer.onError(e); },
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
}, this);
};
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (__super__) {
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, __super__);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
VirtualTimeSchedulerPrototype.add = notImplemented;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
VirtualTimeSchedulerPrototype.toRelative = notImplemented;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.start = function () {
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); }
if (dueToClock === 0) { return; }
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time),
dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); }
if (dueToClock === 0) { return; }
this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); }
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
while (this.queue.length > 0) {
var next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this;
function run(scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
}
var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
this.queue.enqueue(si);
return si.disposable;
};
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (__super__) {
inherits(HistoricalScheduler, __super__);
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], subscribe = state[1];
var sub = tryCatch(subscribe)(ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function AnonymousObservable(subscribe, parent) {
this.source = parent;
function s(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var result = tryCatch(this.observer.onNext).call(this.observer, value);
if (result === errorObj) {
this.dispose();
thrower(result.e);
}
};
AutoDetachObserverPrototype.error = function (err) {
var result = tryCatch(this.observer.onError).call(this.observer, err);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.completed = function () {
var result = tryCatch(this.observer.onCompleted).call(this.observer);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
AutoDetachObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
var GroupedObservable = (function (__super__) {
inherits(GroupedObservable, __super__);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
__super__.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, __super__);
/**
* Creates a subject.
*/
function Subject() {
__super__.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
this.hasError = false;
}
addProperties(Subject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (!this.isStopped) {
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else if (this.hasValue) {
observer.onNext(this.value);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.hasValue = false;
this.observers = [];
this.hasError = false;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var i, len;
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
var os = cloneArray(this.observers), len = os.length;
if (this.hasValue) {
for (i = 0; i < len; i++) {
var o = os[i];
o.onNext(this.value);
o.onCompleted();
}
} else {
for (i = 0; i < len; i++) {
os[i].onCompleted();
}
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, subscribe);
}
addProperties(AnonymousSubject.prototype, Observer.prototype, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (error) {
this.observer.onError(error);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Used to pause and resume streams.
*/
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
/**
* Pauses the underlying sequence.
*/
Pauser.prototype.pause = function () { this.onNext(false); };
/**
* Resumes the underlying sequence.
*/
Pauser.prototype.resume = function () { this.onNext(true); };
return Pauser;
}(Subject));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
// All code before this point will be filtered from stack traces.
var rEndingLine = captureLine();
}.call(this));
}).call(this,require("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"FWaASH":146}]},{},[1]) |
src/routes/chart/lineChart/index.js | china2008qyj/DVA-DEMO | import React from 'react'
import PropTypes from 'prop-types'
import { Row, Col, Card, Button } from 'antd'
import Container from '../Container'
import {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
Legend,
} from 'recharts'
const data = [
{
name: 'Page A',
uv: 4000,
pv: 2400,
amt: 2400,
}, {
name: 'Page B',
uv: 3000,
pv: 1398,
amt: 2210,
}, {
name: 'Page C',
uv: 2000,
pv: 9800,
amt: 2290,
}, {
name: 'Page D',
uv: 2780,
pv: 3908,
amt: 2000,
}, {
name: 'Page E',
uv: 1890,
pv: 4800,
amt: 2181,
}, {
name: 'Page F',
uv: 2390,
pv: 3800,
amt: 2500,
}, {
name: 'Page G',
uv: 3490,
pv: 4300,
amt: 2100,
},
]
const colProps = {
lg: 12,
md: 24,
}
const SimpleLineChart = () => (
<Container>
<LineChart data={data} margin={{
top: 5,
right: 30,
left: 20,
bottom: 5,
}}>
<XAxis dataKey="name" />
<YAxis />
<CartesianGrid strokeDasharray="3 3" />
<Tooltip />
<Legend />
<Line type="monotone" dataKey="pv" stroke="#8884d8" activeDot={{
r: 8,
}} />
<Line type="monotone" dataKey="uv" stroke="#82ca9d" />
</LineChart>
</Container>
)
const VerticalLineChart = () => (
<Container>
<LineChart layout="vertical" width={600} height={300} data={data} margin={{
top: 20,
right: 30,
left: 20,
bottom: 5,
}}>
<XAxis type="number" />
<YAxis dataKey="name" type="category" />
<CartesianGrid strokeDasharray="3 3" />
<Tooltip />
<Legend />
<Line dataKey="pv" stroke="#8884d8" />
<Line dataKey="uv" stroke="#82ca9d" />
</LineChart>
</Container>
)
const DashedLineChart = () => (
<Container>
<LineChart width={600} height={300} data={data} margin={{
top: 5,
right: 30,
left: 20,
bottom: 5,
}}>
<XAxis dataKey="name" />
<YAxis />
<CartesianGrid strokeDasharray="3 3" />
<Tooltip />
<Legend />
<Line type="monotone" dataKey="pv" stroke="#8884d8" strokeDasharray="5 5" />
<Line type="monotone" dataKey="uv" stroke="#82ca9d" strokeDasharray="3 4 5 2" />
</LineChart>
</Container>
)
// CustomizedDotLineChart
const CustomizedDot = ({ cx, cy, payload }) => {
if (payload.value > 2500) {
return (
<svg x={cx - 10} y={cy - 10} width={20} height={20} fill="red" viewBox="0 0 1024 1024">
<path d="M512 1009.984c-274.912 0-497.76-222.848-497.76-497.76s222.848-497.76 497.76-497.76c274.912 0 497.76 222.848 497.76 497.76s-222.848 497.76-497.76 497.76zM340.768 295.936c-39.488 0-71.52 32.8-71.52 73.248s32.032 73.248 71.52 73.248c39.488 0 71.52-32.8 71.52-73.248s-32.032-73.248-71.52-73.248zM686.176 296.704c-39.488 0-71.52 32.8-71.52 73.248s32.032 73.248 71.52 73.248c39.488 0 71.52-32.8 71.52-73.248s-32.032-73.248-71.52-73.248zM772.928 555.392c-18.752-8.864-40.928-0.576-49.632 18.528-40.224 88.576-120.256 143.552-208.832 143.552-85.952 0-164.864-52.64-205.952-137.376-9.184-18.912-31.648-26.592-50.08-17.28-18.464 9.408-21.216 21.472-15.936 32.64 52.8 111.424 155.232 186.784 269.76 186.784 117.984 0 217.12-70.944 269.76-186.784 8.672-19.136 9.568-31.2-9.12-40.096z" />
</svg>
)
}
return (
<svg x={cx - 10} y={cy - 10} width={20} height={20} fill="green" viewBox="0 0 1024 1024">
<path d="M517.12 53.248q95.232 0 179.2 36.352t145.92 98.304 98.304 145.92 36.352 179.2-36.352 179.2-98.304 145.92-145.92 98.304-179.2 36.352-179.2-36.352-145.92-98.304-98.304-145.92-36.352-179.2 36.352-179.2 98.304-145.92 145.92-98.304 179.2-36.352zM663.552 261.12q-15.36 0-28.16 6.656t-23.04 18.432-15.872 27.648-5.632 33.28q0 35.84 21.504 61.44t51.2 25.6 51.2-25.6 21.504-61.44q0-17.408-5.632-33.28t-15.872-27.648-23.04-18.432-28.16-6.656zM373.76 261.12q-29.696 0-50.688 25.088t-20.992 60.928 20.992 61.44 50.688 25.6 50.176-25.6 20.48-61.44-20.48-60.928-50.176-25.088zM520.192 602.112q-51.2 0-97.28 9.728t-82.944 27.648-62.464 41.472-35.84 51.2q-1.024 1.024-1.024 2.048-1.024 3.072-1.024 8.704t2.56 11.776 7.168 11.264 12.8 6.144q25.6-27.648 62.464-50.176 31.744-19.456 79.36-35.328t114.176-15.872q67.584 0 116.736 15.872t81.92 35.328q37.888 22.528 63.488 50.176 17.408-5.12 19.968-18.944t0.512-18.944-3.072-7.168-1.024-3.072q-26.624-55.296-100.352-88.576t-176.128-33.28z" />
</svg>
)
}
CustomizedDot.propTypes = {
cx: PropTypes.number,
cy: PropTypes.number,
payload: PropTypes.object,
}
const CustomizedDotLineChart = () => (
<Container>
<LineChart width={600} height={300} data={data} margin={{
top: 5,
right: 30,
left: 20,
bottom: 5,
}}>
<XAxis dataKey="name" />
<YAxis />
<CartesianGrid strokeDasharray="3 3" />
<Tooltip />
<Legend />
<Line type="monotone" dataKey="pv" stroke="#8884d8" dot={< CustomizedDot />} />
<Line type="monotone" dataKey="uv" stroke="#82ca9d" />
</LineChart>
</Container>
)
const EditorPage = () => (
<div className="content-inner">
<Button type="primary" size="large" style={{
position: 'absolute',
right: 0,
top: -48,
}}>
<a href="http://recharts.org/#/en-US/examples/TinyBarChart" target="blank">Show More</a>
</Button>
<Row gutter={32}>
<Col {...colProps}>
<Card title="SimpleLineChart">
<SimpleLineChart />
</Card>
</Col>
<Col {...colProps}>
<Card title="DashedLineChart">
<DashedLineChart />
</Card>
</Col>
<Col {...colProps}>
<Card title="CustomizedDotLineChart">
<CustomizedDotLineChart />
</Card>
</Col>
<Col {...colProps}>
<Card title="VerticalLineChart">
<VerticalLineChart />
</Card>
</Col>
</Row>
</div>
)
export default EditorPage
|
src/decorators/withViewport.js | zhangmhao/circle | /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React, { Component } from 'react'; // eslint-disable-line no-unused-vars
import EventEmitter from 'eventemitter3';
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
let EE;
let viewport = {width: 1366, height: 768}; // Default size for server-side rendering
const RESIZE_EVENT = 'resize';
function handleWindowResize() {
if (viewport.width !== window.innerWidth || viewport.height !== window.innerHeight) {
viewport = {width: window.innerWidth, height: window.innerHeight};
EE.emit(RESIZE_EVENT, viewport);
}
}
function withViewport(ComposedComponent) {
return class WithViewport extends Component {
constructor() {
super();
this.state = {
viewport: canUseDOM ? {width: window.innerWidth, height: window.innerHeight} : viewport,
};
}
componentDidMount() {
if (!EE) {
EE = new EventEmitter();
window.addEventListener('resize', handleWindowResize);
window.addEventListener('orientationchange', handleWindowResize);
}
EE.on(RESIZE_EVENT, this.handleResize, this);
}
componentWillUnmount() {
EE.removeListener(RESIZE_EVENT, this.handleResize, this);
if (!EE.listeners(RESIZE_EVENT, true)) {
window.removeEventListener('resize', handleWindowResize);
window.removeEventListener('orientationchange', handleWindowResize);
EE = null;
}
}
render() {
return <ComposedComponent {...this.props} viewport={this.state.viewport}/>;
}
handleResize(value) {
this.setState({viewport: value}); // eslint-disable-line react/no-set-state
}
};
}
export default withViewport;
|
ajax/libs/yui/3.17.0/event-custom-base/event-custom-base-debug.js | KevinSheedy/cdnjs | /*
YUI 3.17.0 (build ce55cc9)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('event-custom-base', function (Y, NAME) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
* @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object
* replaces the role of this property, but is considered to be private, and
* is only mentioned to provide a migration path.
*
* If you have a use case which warrants migration to the _yuiaop property,
* please file a ticket to let us know what it's used for and we can see if
* we need to expose hooks for that functionality more formally.
*/
objs: null,
/**
* <p>Execute the supplied method before the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
* <dd>Replace the arguments that the original function will be
* called with.</dd>
* <dt></code>Y.Do.Prevent(message)</code></dt>
* <dd>Don't execute the wrapped function. Other before phase
* wrappers will be executed.</dd>
* </dl>
*
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
// Y.log('Do before: ' + sFn, 'info', 'event');
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* <p>Execute the supplied method after the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
* <dd>Return <code>returnValue</code> instead of the wrapped
* method's original return value. This can be further altered by
* other after phase wrappers.</dd>
* </dl>
*
* <p>The static properties <code>Y.Do.originalRetVal</code> and
* <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
*
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {EventHandle} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method before or after the specified function.
* Used by <code>before</code> and <code>after</code>.
*
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {EventHandle} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (!obj._yuiaop) {
// create a map entry for the obj if it doesn't exist, to hold overridden methods
obj._yuiaop = {};
}
o = obj._yuiaop;
if (!o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] = function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription.
*
* @method detach
* @param handle {EventHandle} the subscription handle
* @static
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property originalRetVal
* @static
* @since 3.2.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property currentRetVal
* @static
* @since 3.2.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
// Y.log('Y.Do._delete: ' + sid, 'info', 'Event');
delete this.before[sid];
delete this.after[sid];
};
/**
* <p>Execute the wrapped method. All arguments are passed into the wrapping
* functions. If any of the before wrappers return an instance of
* <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
* function nor any after phase subscribers will be executed.</p>
*
* <p>The return value will be the return value of the wrapped function or one
* provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
* <code>Y.Do.AlterReturn</code>.
*
* @method exec
* @param arg* {any} Arguments are passed to the wrapping and wrapped functions
* @return {any} Return value of wrapped function unless overwritten (see above)
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor === DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor === DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. Useful for Do.before subscribers. An
* example would be a service that scrubs out illegal characters prior to
* executing the core business logic.
* @class Do.AlterArgs
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newArgs {Array} Call parameters to be used for the original method
* instead of the arguments originally passed in.
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller. Useful for Do.after subscribers.
* @class Do.AlterReturn
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newRetVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet. Useful for Do.before subscribers.
* @class Do.Halt
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute. Useful
* for Do.before subscribers.
* @class Do.Prevent
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var YArray = Y.Array,
AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
CONFIGS_HASH = YArray.hash(CONFIGS),
nativeSlice = Array.prototype.slice,
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log',
mixConfigs = function(r, s, ov) {
var p;
for (p in s) {
if (CONFIGS_HASH[p] && (ov || !(p in r))) {
r[p] = s[p];
}
}
return r;
};
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} defaults configuration object.
* @class CustomEvent
* @constructor
*/
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
Y.CustomEvent = function(type, defaults) {
this._kds = Y.CustomEvent.keepDeprecatedSubs;
this.id = Y.guid();
this.type = type;
this.silent = this.logSystem = (type === YUI_LOG);
if (this._kds) {
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
* @deprecated
*/
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
* @deprecated
*/
this.subscribers = {};
this.afters = {};
}
if (defaults) {
mixConfigs(this, defaults, true);
}
};
/**
* Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a>
* and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance.
*
* These properties were changed to private properties (`_subscribers` and `_afters`), and
* converted from objects to arrays for performance reasons.
*
* Setting this property to true will populate the deprecated `subscribers` and `afters`
* properties for people who may be using them (which is expected to be rare). There will
* be a performance hit, compared to the new array based implementation.
*
* If you are using these deprecated properties for a use case which the public API
* does not support, please file an enhancement request, and we can provide an alternate
* public implementation which doesn't have the performance cost required to maintiain the
* properties as objects.
*
* @property keepDeprecatedSubs
* @static
* @for CustomEvent
* @type boolean
* @default false
* @deprecated
*/
Y.CustomEvent.keepDeprecatedSubs = false;
Y.CustomEvent.mixConfigs = mixConfigs;
Y.CustomEvent.prototype = {
constructor: Y.CustomEvent,
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
/**
* Flag for the default function to execute only if the
* firing event is the current target. This happens only
* when using custom event delegation and setting the
* flag to `true` mimics the behavior of event delegation
* in the DOM.
*
* @property defaultTargetOnly
* @type Boolean
* @default false
*/
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
/**
* The subscribers to this event
* @property _subscribers
* @type Subscriber []
* @private
*/
/**
* 'After' subscribers
* @property _afters
* @type Subscriber []
* @private
*/
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
signature : YUI3_SIGNATURE,
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
context : Y,
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
preventable : true,
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
bubbles : true,
/**
* Returns the number of subscribers for this event as the sum of the on()
* subscribers and after() subscribers.
*
* @method hasSubs
* @return Number
*/
hasSubs: function(when) {
var s = 0,
a = 0,
subs = this._subscribers,
afters = this._afters,
sib = this.sibling;
if (subs) {
s = subs.length;
}
if (afters) {
a = afters.length;
}
if (sib) {
subs = sib._subscribers;
afters = sib._afters;
if (subs) {
s += subs.length;
}
if (afters) {
a += afters.length;
}
}
if (when) {
return (when === 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = nativeSlice.call(arguments, 0);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var sibling = this.sibling,
subs = this._subscribers,
afters = this._afters,
siblingSubs,
siblingAfters;
if (sibling) {
siblingSubs = sibling._subscribers;
siblingAfters = sibling._afters;
}
if (siblingSubs) {
if (subs) {
subs = subs.concat(siblingSubs);
} else {
subs = siblingSubs.concat();
}
} else {
if (subs) {
subs = subs.concat();
} else {
subs = [];
}
}
if (siblingAfters) {
if (afters) {
afters = afters.concat(siblingAfters);
} else {
afters = siblingAfters.concat();
}
} else {
if (afters) {
afters = afters.concat();
} else {
afters = [];
}
}
return [subs, afters];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
mixConfigs(this, o, force);
},
/**
* Create the Subscription for subscribing function, context, and bound
* arguments. If this is a fireOnce event, the subscriber is immediately
* notified.
*
* @method _on
* @param fn {Function} Subscription callback
* @param [context] {Object} Override `this` in the callback
* @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()
* @param [when] {String} "after" to slot into after subscribers
* @return {EventHandle}
* @protected
*/
_on: function(fn, context, args, when) {
if (!fn) { this.log('Invalid callback for CE: ' + this.type); }
var s = new Y.Subscriber(fn, context, args, when),
firedWith;
if (this.fireOnce && this.fired) {
firedWith = this.firedWith;
// It's a little ugly for this to know about facades,
// but given the current breakup, not much choice without
// moving a whole lot of stuff around.
if (this.emitFacade && this._addFacadeToArgs) {
this._addFacadeToArgs(firedWith);
}
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, firedWith), 0);
} else {
this._notify(s, firedWith);
}
}
if (when === AFTER) {
if (!this._afters) {
this._afters = [];
}
this._afters.push(s);
} else {
if (!this._subscribers) {
this._subscribers = [];
}
this._subscribers.push(s);
}
if (this._kds) {
if (when === AFTER) {
this.afters[s.id] = s;
} else {
this.subscribers[s.id] = s;
}
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated');
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
if (this.monitored && this.host) {
this.host._monitor('attach', this, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {Number} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = this._subscribers,
afters = this._afters;
if (subs) {
for (i = subs.length; i >= 0; i--) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, subs, i);
found++;
}
}
}
if (afters) {
for (i = afters.length; i >= 0; i--) {
s = afters[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, afters, i);
found++;
}
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @protected
*/
_notify: function(s, args, ef) {
this.log(this.type + '->' + 'sub: ' + s.id);
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
this.log(this.type + ' cancelled by subscriber');
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
if (!this.silent) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); }
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
// push is the fastest way to go from arguments to arrays
// for most browsers currently
// http://jsperf.com/push-vs-concat-vs-slice/2
var args = [];
args.push.apply(args, arguments);
return this._fire(args);
},
/**
* Private internal implementation for `fire`, which is can be used directly by
* `EventTarget` and other event module classes which have already converted from
* an `arguments` list to an array, to avoid the repeated overhead.
*
* @method _fire
* @private
* @param {Array} args The array of arguments passed to be passed to handlers.
* @return {boolean} false if one of the subscribers returned false, true otherwise.
*/
_fire: function(args) {
if (this.fireOnce && this.fired) {
this.log('fireOnce event: ' + this.type + ' already fired');
return true;
} else {
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
if (this.fireOnce) {
this.firedWith = args;
}
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
/**
* Set up for notifying subscribers of non-emitFacade events.
*
* @method fireSimple
* @param args {Array} Arguments passed to fire()
* @return Boolean false if a subscriber returned false
* @protected
*/
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
if (this.broadcast) {
this._broadcast(args);
}
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
this.log('Missing event-custom-complex needed to emit a facade for: ' + this.type);
args[0] = args[0] || {};
return this.fireSimple(args);
},
/**
* Notifies a list of subscribers.
*
* @method _procSubs
* @param subs {Array} List of subscribers
* @param args {Array} Arguments passed to fire()
* @param ef {}
* @return Boolean false if a subscriber returns false or stops the event
* propagation via e.stopPropagation(),
* e.stopImmediatePropagation(), or e.halt()
* @private
*/
_procSubs: function(subs, args, ef) {
var s, i, l;
for (i = 0, l = subs.length; i < l; i++) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped === 2) {
return false;
}
}
}
return true;
},
/**
* Notifies the YUI instance if the event is configured with broadcast = 1,
* and both the YUI instance and Y.Global if configured with broadcast = 2.
*
* @method _broadcast
* @param args {Array} Arguments sent to fire()
* @private
*/
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = args.concat();
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast === 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {Number} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {Number} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* Deletes the subscriber from the internal store of on() and after()
* subscribers.
*
* @method _delete
* @param s subscriber object.
* @param subs (optional) on or after subscriber array
* @param index (optional) The index found.
* @private
*/
_delete: function(s, subs, i) {
var when = s._when;
if (!subs) {
subs = (when === AFTER) ? this._afters : this._subscribers;
}
if (subs) {
i = YArray.indexOf(subs, s, 0);
if (s && subs[i] === s) {
subs.splice(i, 1);
}
}
if (this._kds) {
if (when === AFTER) {
delete this.afters[s.id];
} else {
delete this.subscribers[s.id];
}
}
if (this.monitored && this.host) {
this.host._monitor('detach', this, {
ce: this,
sub: s
});
}
if (s) {
s.deleted = true;
}
}
};
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args, when) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.guid();
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
this._when = when;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
constructor: Y.Subscriber,
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config && Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn === fn) && this.context === context);
} else {
return (this.fn === fn);
}
},
valueOf : function() {
return this.id;
}
};
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
*
* @property evt
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
*
* @property sub
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {Number} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
// Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event');
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {String} the prefix to apply to non-prefixed event names
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
WILD_TYPE_RE = /(.*?)(:)(.*?)/,
_wildType = Y.cached(function(type) {
return type.replace(WILD_TYPE_RE, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = function(type, pre) {
if (!pre || !type || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
},
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t === '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
var etState = this._yuievt,
etConfig;
if (!etState) {
etState = this._yuievt = {
events: {}, // PERF: Not much point instantiating lazily. We're bound to have events
targets: null, // PERF: Instantiate lazily, if user actually adds target,
config: {
host: this,
context: this
},
chain: Y.config.chain
};
}
etConfig = etState.config;
if (opts) {
mixConfigs(etConfig, opts, true);
if (opts.chain !== undefined) {
etState.chain = opts.chain;
}
if (opts.prefix) {
etConfig.prefix = opts.prefix;
}
}
};
ET.prototype = {
constructor: ET,
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>after</code> except the
* listener is immediatelly detached when it is executed.
* @method onceAfter
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
onceAfter: function() {
var handle = this.after.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {String} type the type
* @param {String} [pre] The prefix. Defaults to this._yuievt.config.prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe a callback function to a custom event fired by this object or
* from an object that bubbles its events to this object.
*
* Callback functions for events published with `emitFacade = true` will
* receive an `EventFacade` as the first argument (typically named "e").
* These callbacks can then call `e.preventDefault()` to disable the
* behavior published to that event's `defaultFn`. See the `EventFacade`
* API for all available properties and methods. Subscribers to
* non-`emitFacade` events will receive the arguments passed to `fire()`
* after the event name.
*
* To subscribe to multiple events at once, pass an object as the first
* argument, where the key:value pairs correspond to the eventName:callback,
* or pass an array of event names as the first argument to subscribe to
* all listed events with the same callback.
*
* Returning `false` from a callback is supported as an alternative to
* calling `e.preventDefault(); e.stopPropagation();`. However, it is
* recommended to use the event methods whenever possible.
*
* @method on
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
on: function(type, fn, context) {
var yuievt = this._yuievt,
parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = nativeSlice.call(arguments, 0);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = nativeSlice.call(arguments, 0);
args.splice(2, 0, Node.getDOMNode(this));
// Y.log("Node detected, redirecting with these args: " + args);
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = nativeSlice.call(arguments, 0);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event');
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);
// TODO: More robust regex, accounting for category
if (type.indexOf("*:") !== -1) {
this._hasSiblings = true;
}
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated');
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events,
i,
Node = Y.Node,
isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = nativeSlice.call(arguments, 0);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = nativeSlice.call(arguments, 0);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated');
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {String} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {String} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated');
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {String} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* </li>
* <li>
* 'bubbles': whether or not this event bubbles (true)
* Events can only bubble if emitFacade is true.
* </li>
* <li>
* 'context': the default execution context for the listeners (this)
* </li>
* <li>
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
* </li>
* <li>
* 'emitFacade': whether or not this event emits a facade (false)
* </li>
* <li>
* 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'
* </li>
* <li>
* 'fireOnce': if an event is configured to fire once, new subscribers after
* the fire will be notified immediately.
* </li>
* <li>
* 'async': fireOnce event listeners will fire synchronously if the event has already
* fired unless async is true.
* </li>
* <li>
* 'preventable': whether or not preventDefault() has an effect (true)
* </li>
* <li>
* 'preventedFn': a function that is executed when preventDefault is called
* </li>
* <li>
* 'queuable': whether or not this event can be queued during bubbling (false)
* </li>
* <li>
* 'silent': if silent is true, debug messages are not provided for this event.
* </li>
* <li>
* 'stoppedFn': a function that is executed when stopPropagation is called
* </li>
*
* <li>
* 'monitored': specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* </li>
* <li>
* 'type': the event type (valid option if not provided as the first parameter to publish)
* </li>
* </ul>
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var ret,
etState = this._yuievt,
etConfig = etState.config,
pre = etConfig.prefix;
if (typeof type === "string") {
if (pre) {
type = _getType(type, pre);
}
ret = this._publish(type, etConfig, opts);
} else {
ret = {};
Y.each(type, function(v, k) {
if (pre) {
k = _getType(k, pre);
}
ret[k] = this._publish(k, etConfig, v || opts);
}, this);
}
return ret;
},
/**
* Returns the fully qualified type, given a short type string.
* That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix.
*
* NOTE: This method, unlike _getType, does no checking of the value passed in, and
* is designed to be used with the low level _publish() method, for critical path
* implementations which need to fast-track publish for performance reasons.
*
* @method _getFullType
* @private
* @param {String} type The short type to prefix
* @return {String} The prefixed type, if a prefix is set, otherwise the type passed in
*/
_getFullType : function(type) {
var pre = this._yuievt.config.prefix;
if (pre) {
return pre + PREFIX_DELIMITER + type;
} else {
return type;
}
},
/**
* The low level event publish implementation. It expects all the massaging to have been done
* outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast
* path publish, which can be used by critical code paths to improve performance.
*
* @method _publish
* @private
* @param {String} fullType The prefixed type of the event to publish.
* @param {Object} etOpts The EventTarget specific configuration to mix into the published event.
* @param {Object} ceOpts The publish specific configuration to mix into the published event.
* @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will
* be the default `CustomEvent` instance, and can be configured independently.
*/
_publish : function(fullType, etOpts, ceOpts) {
var ce,
etState = this._yuievt,
etConfig = etState.config,
host = etConfig.host,
context = etConfig.context,
events = etState.events;
ce = events[fullType];
// PERF: Hate to pull the check out of monitor, but trying to keep critical path tight.
if ((etConfig.monitored && !ce) || (ce && ce.monitored)) {
this._monitor('publish', fullType, {
args: arguments
});
}
if (!ce) {
// Publish event
ce = events[fullType] = new Y.CustomEvent(fullType, etOpts);
if (!etOpts) {
ce.host = host;
ce.context = context;
}
}
if (ceOpts) {
mixConfigs(ce, ceOpts, true);
}
return ce;
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @method _monitor
* @param what {String} 'attach', 'detach', 'fire', or 'publish'
* @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object.
* @param o {Object} Information about the event interaction, such as
* fire() args, subscription category, publish config
* @private
*/
_monitor: function(what, eventType, o) {
var monitorevt, ce, type;
if (eventType) {
if (typeof eventType === "string") {
type = eventType;
ce = this.getEvent(eventType, true);
} else {
ce = eventType;
type = eventType.type;
}
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {Boolean} True if the whole lifecycle of the event went through,
* false if at any point the event propagation was halted.
*/
fire: function(type) {
var typeIncluded = (typeof type === "string"),
argCount = arguments.length,
t = type,
yuievt = this._yuievt,
etConfig = yuievt.config,
pre = etConfig.prefix,
ret,
ce,
ce2,
args;
if (typeIncluded && argCount <= 3) {
// PERF: Try to avoid slice/iteration for the common signatures
// Most common
if (argCount === 2) {
args = [arguments[1]]; // fire("foo", {})
} else if (argCount === 3) {
args = [arguments[1], arguments[2]]; // fire("foo", {}, opts)
} else {
args = []; // fire("foo")
}
} else {
args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0));
}
if (!typeIncluded) {
t = (type && type.type);
}
if (pre) {
t = _getType(t, pre);
}
ce = yuievt.events[t];
if (this._hasSiblings) {
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
}
// PERF: trying to avoid function call, since this is a critical path
if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
this._monitor('fire', (ce || t), {
args: args
});
}
// this event has not been published or subscribed to
if (!ce) {
if (yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
if (ce2) {
ce.sibling = ce2;
}
ret = ce._fire(args);
}
return (yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
ce2 = this.getEvent(type, true);
if (ce2) {
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {String} the type, or name of the event
* @param prefixed {String} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
*
* @method after
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
after: function(type, fn) {
var a = nativeSlice.call(arguments, 0);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype);
ET.call(Y, { bubbles: false });
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
`Y.on()` can do many things:
<ul>
<li>Subscribe to custom events `publish`ed and `fire`d from Y</li>
<li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and
`fire`d from any object in the YUI instance sandbox</li>
<li>Subscribe to DOM events</li>
<li>Subscribe to the execution of a method on any object, effectively
treating that method as an event</li>
</ul>
For custom event subscriptions, pass the custom event name as the first argument
and callback as the second. The `this` object in the callback will be `Y` unless
an override is passed as the third argument.
Y.on('io:complete', function () {
Y.MyApp.updateStatus('Transaction complete');
});
To subscribe to DOM events, pass the name of a DOM event as the first argument
and a CSS selector string as the third argument after the callback function.
Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,
array, or simply omitted (the default is the `window` object).
Y.on('click', function (e) {
e.preventDefault();
// proceed with ajax form submission
var url = this.get('action');
...
}, '#my-form');
The `this` object in DOM event callbacks will be the `Node` targeted by the CSS
selector or other identifier.
`on()` subscribers for DOM events or custom events `publish`ed with a
`defaultFn` can prevent the default behavior with `e.preventDefault()` from the
event object passed as the first parameter to the subscription callback.
To subscribe to the execution of an object method, pass arguments corresponding to the call signature for
<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>.
NOTE: The formal parameter list below is for events, not for function
injection. See `Y.Do.before` for that signature.
@method on
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@see Do.before
@for YUI
**/
/**
Listen for an event one time. Equivalent to `on()`, except that
the listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see on
@method once
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Listen for an event one time. Equivalent to `once()`, except, like `after()`,
the subscription callback executes after all `on()` subscribers and the event's
`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase
subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`
subscribers will execute.
The listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see once
@method onceAfter
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Like `on()`, this method creates a subscription to a custom event or to the
execution of a method on an object.
For events, `after()` subscribers are executed after the event's
`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
NOTE: The subscription signature shown is for events, not for function
injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a>
for that signature.
@see on
@see Do.after
@method after
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [args*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
}, '3.17.0', {"requires": ["oop"]});
|
frontend/src/Settings/CustomFormats/CustomFormats/EditCustomFormatModalContent.js | geogolem/Radarr | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Card from 'Components/Card';
import FieldSet from 'Components/FieldSet';
import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import Icon from 'Components/Icon';
import Button from 'Components/Link/Button';
import SpinnerErrorButton from 'Components/Link/SpinnerErrorButton';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import { icons, inputTypes, kinds } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
import ImportCustomFormatModal from './ImportCustomFormatModal';
import AddSpecificationModal from './Specifications/AddSpecificationModal';
import EditSpecificationModalConnector from './Specifications/EditSpecificationModalConnector';
import Specification from './Specifications/Specification';
import styles from './EditCustomFormatModalContent.css';
class EditCustomFormatModalContent extends Component {
//
// Lifecycle
constructor(props, context) {
super(props, context);
this.state = {
isAddSpecificationModalOpen: false,
isEditSpecificationModalOpen: false,
isImportCustomFormatModalOpen: false
};
}
//
// Listeners
onAddSpecificationPress = () => {
this.setState({ isAddSpecificationModalOpen: true });
}
onAddSpecificationModalClose = ({ specificationSelected = false } = {}) => {
this.setState({
isAddSpecificationModalOpen: false,
isEditSpecificationModalOpen: specificationSelected
});
}
onEditSpecificationModalClose = () => {
this.setState({ isEditSpecificationModalOpen: false });
}
onImportPress = () => {
this.setState({ isImportCustomFormatModalOpen: true });
}
onImportCustomFormatModalClose = () => {
this.setState({ isImportCustomFormatModalOpen: false });
}
//
// Render
render() {
const {
isFetching,
error,
isSaving,
saveError,
item,
specificationsPopulated,
specifications,
onInputChange,
onSavePress,
onModalClose,
onDeleteCustomFormatPress,
onCloneSpecificationPress,
onConfirmDeleteSpecification,
...otherProps
} = this.props;
const {
isAddSpecificationModalOpen,
isEditSpecificationModalOpen,
isImportCustomFormatModalOpen
} = this.state;
const {
id,
name,
includeCustomFormatWhenRenaming
} = item;
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
{id ? translate('EditCustomFormat') : translate('AddCustomFormat')}
</ModalHeader>
<ModalBody>
<div>
{
isFetching &&
<LoadingIndicator />
}
{
!isFetching && !!error &&
<div>
{translate('UnableToAddANewCustomFormatPleaseTryAgain')}
</div>
}
{
!isFetching && !error && specificationsPopulated &&
<div>
<Form
{...otherProps}
>
<FormGroup>
<FormLabel>
{translate('Name')}
</FormLabel>
<FormInputGroup
type={inputTypes.TEXT}
name="name"
{...name}
onChange={onInputChange}
/>
</FormGroup>
<FormGroup>
<FormLabel>{translate('IncludeCustomFormatWhenRenaming')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="includeCustomFormatWhenRenaming"
helpText={translate('IncludeCustomFormatWhenRenamingHelpText')}
{...includeCustomFormatWhenRenaming}
onChange={onInputChange}
/>
</FormGroup>
</Form>
<FieldSet legend={translate('Conditions')}>
<div className={styles.customFormats}>
{
specifications.map((tag) => {
return (
<Specification
key={tag.id}
{...tag}
onCloneSpecificationPress={onCloneSpecificationPress}
onConfirmDeleteSpecification={onConfirmDeleteSpecification}
/>
);
})
}
<Card
className={styles.addSpecification}
onPress={this.onAddSpecificationPress}
>
<div className={styles.center}>
<Icon
name={icons.ADD}
size={45}
/>
</div>
</Card>
</div>
</FieldSet>
<AddSpecificationModal
isOpen={isAddSpecificationModalOpen}
onModalClose={this.onAddSpecificationModalClose}
/>
<EditSpecificationModalConnector
isOpen={isEditSpecificationModalOpen}
onModalClose={this.onEditSpecificationModalClose}
/>
<ImportCustomFormatModal
isOpen={isImportCustomFormatModalOpen}
onModalClose={this.onImportCustomFormatModalClose}
/>
</div>
}
</div>
</ModalBody>
<ModalFooter>
<div className={styles.rightButtons}>
{
id &&
<Button
className={styles.deleteButton}
kind={kinds.DANGER}
onPress={onDeleteCustomFormatPress}
>
{translate('Delete')}
</Button>
}
<Button
className={styles.deleteButton}
onPress={this.onImportPress}
>
{translate('Import')}
</Button>
</div>
<Button
onPress={onModalClose}
>
{translate('Cancel')}
</Button>
<SpinnerErrorButton
isSpinning={isSaving}
error={saveError}
onPress={onSavePress}
>
{translate('Save')}
</SpinnerErrorButton>
</ModalFooter>
</ModalContent>
);
}
}
EditCustomFormatModalContent.propTypes = {
isFetching: PropTypes.bool.isRequired,
error: PropTypes.object,
isSaving: PropTypes.bool.isRequired,
saveError: PropTypes.object,
item: PropTypes.object.isRequired,
specificationsPopulated: PropTypes.bool.isRequired,
specifications: PropTypes.arrayOf(PropTypes.object),
onInputChange: PropTypes.func.isRequired,
onSavePress: PropTypes.func.isRequired,
onContentHeightChange: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired,
onDeleteCustomFormatPress: PropTypes.func,
onCloneSpecificationPress: PropTypes.func.isRequired,
onConfirmDeleteSpecification: PropTypes.func.isRequired
};
export default EditCustomFormatModalContent;
|
node_modules/react-icons/md/local-bar.js | bairrada97/festival |
import React from 'react'
import Icon from 'react-icon-base'
const MdLocalBar = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m12.4 11.6h15.2l2.9-3.2h-21z m22.6-3.2l-13.4 15v8.2h8.4v3.4h-20v-3.4h8.4v-8.2l-13.4-15v-3.4h30v3.4z"/></g>
</Icon>
)
export default MdLocalBar
|
ajax/libs/react-router/0.11.1/react-router.min.js | r3x/cdnjs | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ReactRouter=e()}}(function(){var define;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module){var LocationActions={PUSH:"push",REPLACE:"replace",POP:"pop"};module.exports=LocationActions},{}],2:[function(_dereq_,module){var LocationActions=_dereq_("../actions/LocationActions"),ImitateBrowserBehavior={updateScrollPosition:function(position,actionType){switch(actionType){case LocationActions.PUSH:case LocationActions.REPLACE:window.scrollTo(0,0);break;case LocationActions.POP:position?window.scrollTo(position.x,position.y):window.scrollTo(0,0)}}};module.exports=ImitateBrowserBehavior},{"../actions/LocationActions":1}],3:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,FakeNode=_dereq_("../mixins/FakeNode"),PropTypes=_dereq_("../utils/PropTypes"),DefaultRoute=React.createClass({displayName:"DefaultRoute",mixins:[FakeNode],propTypes:{name:React.PropTypes.string,path:PropTypes.falsy,handler:React.PropTypes.func.isRequired}});module.exports=DefaultRoute},{"../mixins/FakeNode":13,"../utils/PropTypes":21}],4:[function(_dereq_,module){function isLeftClickEvent(event){return 0===event.button}function isModifiedEvent(event){return!!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,classSet=_dereq_("react/lib/cx"),assign=_dereq_("react/lib/Object.assign"),Navigation=_dereq_("../mixins/Navigation"),State=_dereq_("../mixins/State"),Link=React.createClass({displayName:"Link",mixins:[Navigation,State],propTypes:{activeClassName:React.PropTypes.string.isRequired,to:React.PropTypes.string.isRequired,params:React.PropTypes.object,query:React.PropTypes.object,onClick:React.PropTypes.func},getDefaultProps:function(){return{activeClassName:"active"}},handleClick:function(event){var clickResult,allowTransition=!0;this.props.onClick&&(clickResult=this.props.onClick(event)),!isModifiedEvent(event)&&isLeftClickEvent(event)&&((clickResult===!1||event.defaultPrevented===!0)&&(allowTransition=!1),event.preventDefault(),allowTransition&&this.transitionTo(this.props.to,this.props.params,this.props.query))},getHref:function(){return this.makeHref(this.props.to,this.props.params,this.props.query)},getClassName:function(){var classNames={};return this.props.className&&(classNames[this.props.className]=!0),this.isActive(this.props.to,this.props.params,this.props.query)&&(classNames[this.props.activeClassName]=!0),classSet(classNames)},render:function(){var props=assign({},this.props,{href:this.getHref(),className:this.getClassName(),onClick:this.handleClick});return React.DOM.a(props,this.props.children)}});module.exports=Link},{"../mixins/Navigation":14,"../mixins/State":17,"react/lib/Object.assign":36,"react/lib/cx":37}],5:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,FakeNode=_dereq_("../mixins/FakeNode"),PropTypes=_dereq_("../utils/PropTypes"),NotFoundRoute=React.createClass({displayName:"NotFoundRoute",mixins:[FakeNode],propTypes:{name:React.PropTypes.string,path:PropTypes.falsy,handler:React.PropTypes.func.isRequired}});module.exports=NotFoundRoute},{"../mixins/FakeNode":13,"../utils/PropTypes":21}],6:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,FakeNode=_dereq_("../mixins/FakeNode"),PropTypes=_dereq_("../utils/PropTypes"),Redirect=React.createClass({displayName:"Redirect",mixins:[FakeNode],propTypes:{path:React.PropTypes.string,from:React.PropTypes.string,to:React.PropTypes.string,handler:PropTypes.falsy}});module.exports=Redirect},{"../mixins/FakeNode":13,"../utils/PropTypes":21}],7:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,FakeNode=_dereq_("../mixins/FakeNode"),Route=React.createClass({displayName:"Route",mixins:[FakeNode],propTypes:{name:React.PropTypes.string,path:React.PropTypes.string,handler:React.PropTypes.func.isRequired,ignoreScrollBehavior:React.PropTypes.bool}});module.exports=Route},{"../mixins/FakeNode":13}],8:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,RouteHandler=React.createClass({displayName:"RouteHandler",getDefaultProps:function(){return{ref:"__routeHandler__"}},contextTypes:{getRouteAtDepth:React.PropTypes.func.isRequired,getRouteComponents:React.PropTypes.func.isRequired,routeHandlers:React.PropTypes.array.isRequired},childContextTypes:{routeHandlers:React.PropTypes.array.isRequired},getChildContext:function(){return{routeHandlers:this.context.routeHandlers.concat([this])}},getRouteDepth:function(){return this.context.routeHandlers.length-1},componentDidMount:function(){this._updateRouteComponent()},componentDidUpdate:function(){this._updateRouteComponent()},_updateRouteComponent:function(){var depth=this.getRouteDepth(),components=this.context.getRouteComponents();components[depth]=this.refs[this.props.ref]},render:function(){var route=this.context.getRouteAtDepth(this.getRouteDepth());return route?React.createElement(route.handler,this.props):null}});module.exports=RouteHandler},{}],9:[function(_dereq_,module,exports){exports.DefaultRoute=_dereq_("./components/DefaultRoute"),exports.Link=_dereq_("./components/Link"),exports.NotFoundRoute=_dereq_("./components/NotFoundRoute"),exports.Redirect=_dereq_("./components/Redirect"),exports.Route=_dereq_("./components/Route"),exports.RouteHandler=_dereq_("./components/RouteHandler"),exports.HashLocation=_dereq_("./locations/HashLocation"),exports.HistoryLocation=_dereq_("./locations/HistoryLocation"),exports.RefreshLocation=_dereq_("./locations/RefreshLocation"),exports.Navigation=_dereq_("./mixins/Navigation"),exports.State=_dereq_("./mixins/State"),exports.create=_dereq_("./utils/createRouter"),exports.run=_dereq_("./utils/runRouter")},{"./components/DefaultRoute":3,"./components/Link":4,"./components/NotFoundRoute":5,"./components/Redirect":6,"./components/Route":7,"./components/RouteHandler":8,"./locations/HashLocation":10,"./locations/HistoryLocation":11,"./locations/RefreshLocation":12,"./mixins/Navigation":14,"./mixins/State":17,"./utils/createRouter":24,"./utils/runRouter":28}],10:[function(_dereq_,module){function getHashPath(){return invariant(canUseDOM,"getHashPath needs a DOM"),Path.decode(window.location.hash.substr(1))}function ensureSlash(){var path=getHashPath();return"/"===path.charAt(0)?!0:(HashLocation.replace("/"+path),!1)}function notifyChange(type){var change={path:getHashPath(),type:type};_changeListeners.forEach(function(listener){listener(change)})}function onHashChange(){ensureSlash()&&(notifyChange(_actionType||LocationActions.POP),_actionType=null)}var _actionType,invariant=_dereq_("react/lib/invariant"),canUseDOM=_dereq_("react/lib/ExecutionEnvironment").canUseDOM,LocationActions=_dereq_("../actions/LocationActions"),Path=_dereq_("../utils/Path"),_changeListeners=[],_isListening=!1,HashLocation={addChangeListener:function(listener){_changeListeners.push(listener),ensureSlash(),_isListening||(window.addEventListener?window.addEventListener("hashchange",onHashChange,!1):window.attachEvent("onhashchange",onHashChange),_isListening=!0)},push:function(path){_actionType=LocationActions.PUSH,window.location.hash=Path.encode(path)},replace:function(path){_actionType=LocationActions.REPLACE,window.location.replace(window.location.pathname+"#"+Path.encode(path))},pop:function(){_actionType=LocationActions.POP,window.history.back()},getCurrentPath:getHashPath,toString:function(){return"<HashLocation>"}};module.exports=HashLocation},{"../actions/LocationActions":1,"../utils/Path":19,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],11:[function(_dereq_,module){function getWindowPath(){return invariant(canUseDOM,"getWindowPath needs a DOM"),Path.decode(window.location.pathname+window.location.search)}function notifyChange(type){var change={path:getWindowPath(),type:type};_changeListeners.forEach(function(listener){listener(change)})}function onPopState(){notifyChange(LocationActions.POP)}var invariant=_dereq_("react/lib/invariant"),canUseDOM=_dereq_("react/lib/ExecutionEnvironment").canUseDOM,LocationActions=_dereq_("../actions/LocationActions"),Path=_dereq_("../utils/Path"),_changeListeners=[],_isListening=!1,HistoryLocation={addChangeListener:function(listener){_changeListeners.push(listener),_isListening||(window.addEventListener?window.addEventListener("popstate",onPopState,!1):window.attachEvent("popstate",onPopState),_isListening=!0)},push:function(path){window.history.pushState({path:path},"",Path.encode(path)),notifyChange(LocationActions.PUSH)},replace:function(path){window.history.replaceState({path:path},"",Path.encode(path)),notifyChange(LocationActions.REPLACE)},pop:function(){window.history.back()},getCurrentPath:getWindowPath,toString:function(){return"<HistoryLocation>"}};module.exports=HistoryLocation},{"../actions/LocationActions":1,"../utils/Path":19,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],12:[function(_dereq_,module){var HistoryLocation=_dereq_("./HistoryLocation"),Path=_dereq_("../utils/Path"),RefreshLocation={push:function(path){window.location=Path.encode(path)},replace:function(path){window.location.replace(Path.encode(path))},pop:function(){window.history.back()},getCurrentPath:HistoryLocation.getCurrentPath,toString:function(){return"<RefreshLocation>"}};module.exports=RefreshLocation},{"../utils/Path":19,"./HistoryLocation":11}],13:[function(_dereq_,module){var invariant=_dereq_("react/lib/invariant"),FakeNode={render:function(){invariant(!1,"%s elements should not be rendered",this.constructor.displayName)}};module.exports=FakeNode},{"react/lib/invariant":39}],14:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,Navigation={contextTypes:{makePath:React.PropTypes.func.isRequired,makeHref:React.PropTypes.func.isRequired,transitionTo:React.PropTypes.func.isRequired,replaceWith:React.PropTypes.func.isRequired,goBack:React.PropTypes.func.isRequired},makePath:function(to,params,query){return this.context.makePath(to,params,query)},makeHref:function(to,params,query){return this.context.makeHref(to,params,query)},transitionTo:function(to,params,query){this.context.transitionTo(to,params,query)},replaceWith:function(to,params,query){this.context.replaceWith(to,params,query)},goBack:function(){this.context.goBack()}};module.exports=Navigation},{}],15:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,NavigationContext={childContextTypes:{makePath:React.PropTypes.func.isRequired,makeHref:React.PropTypes.func.isRequired,transitionTo:React.PropTypes.func.isRequired,replaceWith:React.PropTypes.func.isRequired,goBack:React.PropTypes.func.isRequired},getChildContext:function(){return{makePath:this.constructor.makePath,makeHref:this.constructor.makeHref,transitionTo:this.constructor.transitionTo,replaceWith:this.constructor.replaceWith,goBack:this.constructor.goBack}}};module.exports=NavigationContext},{}],16:[function(_dereq_,module){var invariant=_dereq_("react/lib/invariant"),canUseDOM=_dereq_("react/lib/ExecutionEnvironment").canUseDOM,getWindowScrollPosition=_dereq_("../utils/getWindowScrollPosition"),Scrolling={componentWillMount:function(){invariant(null==this.getScrollBehavior()||canUseDOM,"Cannot use scroll behavior without a DOM"),this._scrollHistory={}},componentDidMount:function(){this._updateScroll()},componentWillUpdate:function(){this._scrollHistory[this.state.path]=getWindowScrollPosition()},componentDidUpdate:function(){this._updateScroll()},componentWillUnmount:function(){delete this._scrollHistory},getScrollPosition:function(path){return this._scrollHistory[path]||null},_updateScroll:function(){var scrollBehavior=this.getScrollBehavior();scrollBehavior&&scrollBehavior.updateScrollPosition(this.getScrollPosition(this.state.path),this.state.action)}};module.exports=Scrolling},{"../utils/getWindowScrollPosition":26,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],17:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,State={contextTypes:{getCurrentPath:React.PropTypes.func.isRequired,getCurrentRoutes:React.PropTypes.func.isRequired,getCurrentParams:React.PropTypes.func.isRequired,getCurrentQuery:React.PropTypes.func.isRequired,isActive:React.PropTypes.func.isRequired},getPath:function(){return this.context.getCurrentPath()},getRoutes:function(){return this.context.getCurrentRoutes()},getParams:function(){return this.context.getCurrentParams()},getQuery:function(){return this.context.getCurrentQuery()},isActive:function(to,params,query){return this.context.isActive(to,params,query)}};module.exports=State},{}],18:[function(_dereq_,module){function routeIsActive(activeRoutes,routeName){return activeRoutes.some(function(route){return route.name===routeName})}function paramsAreActive(activeParams,params){for(var property in params)if(String(activeParams[property])!==String(params[property]))return!1;return!0}function queryIsActive(activeQuery,query){for(var property in query)if(String(activeQuery[property])!==String(query[property]))return!1;return!0}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,assign=_dereq_("react/lib/Object.assign"),Path=_dereq_("../utils/Path"),StateContext={getCurrentPath:function(){return this.state.path},getCurrentRoutes:function(){return this.state.routes.slice(0)},getCurrentParams:function(){return assign({},this.state.params)},getCurrentQuery:function(){return assign({},this.state.query)},isActive:function(to,params,query){return Path.isAbsolute(to)?to===this.state.path:routeIsActive(this.state.routes,to)&¶msAreActive(this.state.params,params)&&(null==query||queryIsActive(this.state.query,query))},childContextTypes:{getCurrentPath:React.PropTypes.func.isRequired,getCurrentRoutes:React.PropTypes.func.isRequired,getCurrentParams:React.PropTypes.func.isRequired,getCurrentQuery:React.PropTypes.func.isRequired,isActive:React.PropTypes.func.isRequired},getChildContext:function(){return{getCurrentPath:this.getCurrentPath,getCurrentRoutes:this.getCurrentRoutes,getCurrentParams:this.getCurrentParams,getCurrentQuery:this.getCurrentQuery,isActive:this.isActive}}};module.exports=StateContext},{"../utils/Path":19,"react/lib/Object.assign":36}],19:[function(_dereq_,module){function decodePathSegment(string){return decodeURIComponent(string.replace(/\+/g," "))}function encodePathSegment(string){return encodeURIComponent(string).replace(/%20/g,"+")}function compilePattern(pattern){if(!(pattern in _compiledPatterns)){var paramNames=[],source=pattern.replace(paramCompileMatcher,function(match,paramName){return paramName?(paramNames.push(paramName),"([^/?#]+)"):"*"===match?(paramNames.push("splat"),"(.*?)"):"\\"+match});_compiledPatterns[pattern]={matcher:new RegExp("^"+source+"$","i"),paramNames:paramNames}}return _compiledPatterns[pattern]}var invariant=_dereq_("react/lib/invariant"),merge=_dereq_("qs/lib/utils").merge,qs=_dereq_("qs"),paramCompileMatcher=/:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g,paramInjectMatcher=/:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g,paramInjectTrailingSlashMatcher=/\/\/\?|\/\?/g,queryMatcher=/\?(.+)/,_compiledPatterns={},Path={decode:function(path){return String(path).split("/").map(decodePathSegment).join("/")},encode:function(path){return String(path).split("/").map(encodePathSegment).join("/")},extractParamNames:function(pattern){return compilePattern(pattern).paramNames},extractParams:function(pattern,path){var object=compilePattern(pattern),match=path.match(object.matcher);if(!match)return null;var params={};return object.paramNames.forEach(function(paramName,index){params[paramName]=match[index+1]}),params},injectParams:function(pattern,params){params=params||{};var splatIndex=0;return pattern.replace(paramInjectMatcher,function(match,paramName){if(paramName=paramName||"splat","?"!==paramName.slice(-1))invariant(null!=params[paramName],'Missing "'+paramName+'" parameter for path "'+pattern+'"');else if(paramName=paramName.slice(0,-1),null==params[paramName])return"";var segment;return"splat"===paramName&&Array.isArray(params[paramName])?(segment=params[paramName][splatIndex++],invariant(null!=segment,"Missing splat # "+splatIndex+' for path "'+pattern+'"')):segment=params[paramName],segment}).replace(paramInjectTrailingSlashMatcher,"/")},extractQuery:function(path){var match=path.match(queryMatcher);return match&&qs.parse(match[1])},withoutQuery:function(path){return path.replace(queryMatcher,"")},withQuery:function(path,query){var existingQuery=Path.extractQuery(path);existingQuery&&(query=query?merge(existingQuery,query):existingQuery);var queryString=query&&qs.stringify(query);return queryString?Path.withoutQuery(path)+"?"+queryString:path},isAbsolute:function(path){return"/"===path.charAt(0)},normalize:function(path){return path.replace(/^\/*/,"/")},join:function(a,b){return a.replace(/\/*$/,"/")+b}};module.exports=Path},{qs:30,"qs/lib/utils":34,"react/lib/invariant":39}],20:[function(_dereq_,module){var Promise=_dereq_("when/lib/Promise");module.exports=Promise},{"when/lib/Promise":41}],21:[function(_dereq_,module){var PropTypes={falsy:function(props,propName,elementName){return props[propName]?new Error("<"+elementName+'> may not have a "'+propName+'" prop'):void 0}};module.exports=PropTypes},{}],22:[function(_dereq_,module){function Redirect(to,params,query){this.to=to,this.params=params,this.query=query}module.exports=Redirect},{}],23:[function(_dereq_,module){function runHooks(hooks,callback){try{var promise=hooks.reduce(function(promise,hook){return promise?promise.then(hook):hook()},null)}catch(error){return callback(error)}promise?promise.then(function(){setTimeout(callback)},function(error){setTimeout(function(){callback(error)})}):callback()}function runTransitionFromHooks(transition,routes,components,callback){components=reversedArray(components);var hooks=reversedArray(routes).map(function(route,index){return function(){var handler=route.handler;if(!transition.isAborted&&handler.willTransitionFrom)return handler.willTransitionFrom(transition,components[index]);var promise=transition._promise;return transition._promise=null,promise}});runHooks(hooks,callback)}function runTransitionToHooks(transition,routes,params,query,callback){var hooks=routes.map(function(route){return function(){var handler=route.handler;!transition.isAborted&&handler.willTransitionTo&&handler.willTransitionTo(transition,params,query);var promise=transition._promise;return transition._promise=null,promise}});runHooks(hooks,callback)}function Transition(path,retry){this.path=path,this.abortReason=null,this.isAborted=!1,this.retry=retry.bind(this),this._promise=null}var assign=_dereq_("react/lib/Object.assign"),reversedArray=_dereq_("./reversedArray"),Redirect=_dereq_("./Redirect"),Promise=_dereq_("./Promise");assign(Transition.prototype,{abort:function(reason){this.abortReason=reason,this.isAborted=!0},redirect:function(to,params,query){this.abort(new Redirect(to,params,query))},wait:function(value){this._promise=Promise.resolve(value)},from:function(routes,components,callback){return runTransitionFromHooks(this,routes,components,callback)},to:function(routes,params,query,callback){return runTransitionToHooks(this,routes,params,query,callback)}}),module.exports=Transition},{"./Promise":20,"./Redirect":22,"./reversedArray":27,"react/lib/Object.assign":36}],24:[function(_dereq_,module){function defaultErrorHandler(error){throw error}function defaultAbortHandler(abortReason,location){if("string"==typeof location)throw new Error("Unhandled aborted transition! Reason: "+abortReason);abortReason instanceof Redirect?location.replace(this.makePath(abortReason.to,abortReason.params,abortReason.query)):location.pop()}function findMatch(pathname,routes,defaultRoute,notFoundRoute){for(var match,route,params,i=0,len=routes.length;len>i;++i){if(route=routes[i],match=findMatch(pathname,route.childRoutes,route.defaultRoute,route.notFoundRoute),null!=match)return match.routes.unshift(route),match;if(params=Path.extractParams(route.path,pathname))return createMatch(route,params)}return defaultRoute&&(params=Path.extractParams(defaultRoute.path,pathname))?createMatch(defaultRoute,params):notFoundRoute&&(params=Path.extractParams(notFoundRoute.path,pathname))?createMatch(notFoundRoute,params):match}function createMatch(route,params){return{routes:[route],params:params}}function hasMatch(routes,route,prevParams,nextParams){return routes.some(function(r){if(r!==route)return!1;for(var paramName,paramNames=route.paramNames,i=0,len=paramNames.length;len>i;++i)if(paramName=paramNames[i],nextParams[paramName]!==prevParams[paramName])return!1;return!0})}function createRouter(options){function updateState(){state=nextState,nextState={}}options=options||{},"function"==typeof options?options={routes:options}:Array.isArray(options)&&(options={routes:options});var routes=[],namedRoutes={},components=[],location=options.location||DEFAULT_LOCATION,scrollBehavior=options.scrollBehavior||DEFAULT_SCROLL_BEHAVIOR,onError=options.onError||defaultErrorHandler,onAbort=options.onAbort||defaultAbortHandler,state={},nextState={};location!==HistoryLocation||supportsHistory()||(location=RefreshLocation);var router=React.createClass({displayName:"Router",mixins:[NavigationContext,StateContext,Scrolling],statics:{defaultRoute:null,notFoundRoute:null,addRoutes:function(children){routes.push.apply(routes,createRoutesFromChildren(children,this,namedRoutes))},makePath:function(to,params,query){var path;if(Path.isAbsolute(to))path=Path.normalize(to);else{var route=namedRoutes[to];invariant(route,'Unable to find <Route name="%s">',to),path=route.path}return Path.withQuery(Path.injectParams(path,params),query)},makeHref:function(to,params,query){var path=this.makePath(to,params,query);return location===HashLocation?"#"+path:path},transitionTo:function(to,params,query){invariant("string"!=typeof location,"You cannot use transitionTo with a static location"),location.push(this.makePath(to,params,query))},replaceWith:function(to,params,query){invariant("string"!=typeof location,"You cannot use replaceWith with a static location"),location.replace(this.makePath(to,params,query))},goBack:function(){invariant("string"!=typeof location,"You cannot use goBack with a static location"),location.pop()},match:function(path){return findMatch(Path.withoutQuery(path),routes,this.defaultRoute,this.notFoundRoute)||null},dispatch:function(path,action,callback){if(state.path!==path){var match=this.match(path);warning(null!=match,'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes',path,path),null==match&&(match={});var fromRoutes,toRoutes,prevRoutes=state.routes||[],prevParams=state.params||{},nextRoutes=match.routes||[],nextParams=match.params||{},nextQuery=Path.extractQuery(path)||{};prevRoutes.length?(fromRoutes=prevRoutes.filter(function(route){return!hasMatch(nextRoutes,route,prevParams,nextParams)}),toRoutes=nextRoutes.filter(function(route){return!hasMatch(prevRoutes,route,prevParams,nextParams)})):(fromRoutes=[],toRoutes=nextRoutes);var transition=new Transition(path,this.replaceWith.bind(this,path));transition.from(fromRoutes,components,function(error){return error||transition.isAborted?callback.call(router,error,transition):void transition.to(toRoutes,nextParams,nextQuery,function(error){return error||transition.isAborted?callback.call(router,error,transition):(nextState.path=path,nextState.action=action,nextState.routes=nextRoutes,nextState.params=nextParams,nextState.query=nextQuery,void callback.call(router,null,transition))})})}},run:function(callback){function dispatchHandler(error,transition){error?onError.call(router,error):transition.isAborted?onAbort.call(router,transition.abortReason,location):callback.call(router,router,nextState)}function changeListener(change){router.dispatch(change.path,change.type,dispatchHandler)}"string"==typeof location?(warning(!canUseDOM||!1,"You should not use a static location in a DOM environment because the router will not be kept in sync with the current URL"),router.dispatch(location,null,dispatchHandler)):(invariant(canUseDOM,"You cannot use %s in a non-DOM environment",location),location.addChangeListener&&location.addChangeListener(changeListener),router.dispatch(location.getCurrentPath(),null,dispatchHandler))}},propTypes:{children:PropTypes.falsy},getLocation:function(){return location},getScrollBehavior:function(){return scrollBehavior},getRouteAtDepth:function(depth){var routes=this.state.routes;return routes&&routes[depth]},getRouteComponents:function(){return components},getInitialState:function(){return updateState(),state},componentWillReceiveProps:function(){updateState(),this.setState(state)},render:function(){return this.getRouteAtDepth(0)?React.createElement(RouteHandler,this.props):null},childContextTypes:{getRouteAtDepth:React.PropTypes.func.isRequired,getRouteComponents:React.PropTypes.func.isRequired,routeHandlers:React.PropTypes.array.isRequired},getChildContext:function(){return{getRouteComponents:this.getRouteComponents,getRouteAtDepth:this.getRouteAtDepth,routeHandlers:[this]}}});return options.routes&&router.addRoutes(options.routes),router}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,warning=_dereq_("react/lib/warning"),invariant=_dereq_("react/lib/invariant"),canUseDOM=_dereq_("react/lib/ExecutionEnvironment").canUseDOM,ImitateBrowserBehavior=_dereq_("../behaviors/ImitateBrowserBehavior"),RouteHandler=_dereq_("../components/RouteHandler"),HashLocation=_dereq_("../locations/HashLocation"),HistoryLocation=_dereq_("../locations/HistoryLocation"),NavigationContext=_dereq_("../mixins/NavigationContext"),StateContext=_dereq_("../mixins/StateContext"),Scrolling=_dereq_("../mixins/Scrolling"),createRoutesFromChildren=_dereq_("./createRoutesFromChildren"),supportsHistory=_dereq_("./supportsHistory"),Transition=_dereq_("./Transition"),PropTypes=_dereq_("./PropTypes"),Redirect=_dereq_("./Redirect"),Path=_dereq_("./Path"),DEFAULT_LOCATION=canUseDOM?HashLocation:"/",DEFAULT_SCROLL_BEHAVIOR=canUseDOM?ImitateBrowserBehavior:null;module.exports=createRouter},{"../behaviors/ImitateBrowserBehavior":2,"../components/RouteHandler":8,"../locations/HashLocation":10,"../locations/HistoryLocation":11,"../mixins/NavigationContext":15,"../mixins/Scrolling":16,"../mixins/StateContext":18,"./Path":19,"./PropTypes":21,"./Redirect":22,"./Transition":23,"./createRoutesFromChildren":25,"./supportsHistory":29,"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39,"react/lib/warning":40}],25:[function(_dereq_,module){function createRedirectHandler(to,_params,_query){return React.createClass({statics:{willTransitionTo:function(transition,params,query){transition.redirect(to,_params||params,_query||query)}},render:function(){return null}})}function checkPropTypes(componentName,propTypes,props){for(var propName in propTypes)if(propTypes.hasOwnProperty(propName)){var error=propTypes[propName](props,propName,componentName);error instanceof Error&&warning(!1,error.message)}}function createRoute(element,parentRoute,namedRoutes){var type=element.type,props=element.props,componentName=type&&type.displayName||"UnknownComponent";invariant(-1!==CONFIG_ELEMENT_TYPES.indexOf(type),'Unrecognized route configuration element "<%s>"',componentName),type.propTypes&&checkPropTypes(componentName,type.propTypes,props);var route={name:props.name};type===Redirect.type?(route.handler=createRedirectHandler(props.to,props.params,props.query),props.path=props.path||props.from):route.handler=props.handler;var parentPath=parentRoute&&parentRoute.path||"/";if((props.path||props.name)&&type!==DefaultRoute.type&&type!==NotFoundRoute.type){var path=props.path||props.name;Path.isAbsolute(path)||(path=Path.join(parentPath,path)),route.path=Path.normalize(path)}else route.path=parentPath,type===NotFoundRoute.type&&(route.path+="*");return route.paramNames=Path.extractParamNames(route.path),parentRoute&&Array.isArray(parentRoute.paramNames)&&parentRoute.paramNames.forEach(function(paramName){invariant(-1!==route.paramNames.indexOf(paramName),'The nested route path "%s" is missing the "%s" parameter of its parent path "%s"',route.path,paramName,parentRoute.path)}),props.name&&(invariant(null==namedRoutes[props.name],'You cannot use the name "%s" for more than one route',props.name),namedRoutes[props.name]=route),type===NotFoundRoute.type?(invariant(parentRoute,"<NotFoundRoute> must have a parent <Route>"),invariant(null==parentRoute.notFoundRoute,"You may not have more than one <NotFoundRoute> per <Route>"),parentRoute.notFoundRoute=route,null):type===DefaultRoute.type?(invariant(parentRoute,"<DefaultRoute> must have a parent <Route>"),invariant(null==parentRoute.defaultRoute,"You may not have more than one <DefaultRoute> per <Route>"),parentRoute.defaultRoute=route,null):(route.childRoutes=createRoutesFromChildren(props.children,route,namedRoutes),route)}function createRoutesFromChildren(children,parentRoute,namedRoutes){var routes=[];return React.Children.forEach(children,function(child){(child=createRoute(child,parentRoute,namedRoutes))&&routes.push(child)}),routes}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,warning=_dereq_("react/lib/warning"),invariant=_dereq_("react/lib/invariant"),DefaultRoute=_dereq_("../components/DefaultRoute"),NotFoundRoute=_dereq_("../components/NotFoundRoute"),Redirect=_dereq_("../components/Redirect"),Route=_dereq_("../components/Route"),Path=_dereq_("./Path"),CONFIG_ELEMENT_TYPES=[DefaultRoute.type,NotFoundRoute.type,Redirect.type,Route.type];module.exports=createRoutesFromChildren},{"../components/DefaultRoute":3,"../components/NotFoundRoute":5,"../components/Redirect":6,"../components/Route":7,"./Path":19,"react/lib/invariant":39,"react/lib/warning":40}],26:[function(_dereq_,module){function getWindowScrollPosition(){return invariant(canUseDOM,"Cannot get current scroll position without a DOM"),{x:window.scrollX,y:window.scrollY}}var invariant=_dereq_("react/lib/invariant"),canUseDOM=_dereq_("react/lib/ExecutionEnvironment").canUseDOM;module.exports=getWindowScrollPosition},{"react/lib/ExecutionEnvironment":35,"react/lib/invariant":39}],27:[function(_dereq_,module){function reversedArray(array){return array.slice(0).reverse()}module.exports=reversedArray},{}],28:[function(_dereq_,module){function runRouter(routes,location,callback){"function"==typeof location&&(callback=location,location=null);var router=createRouter({routes:routes,location:location});return router.run(callback),router}var createRouter=_dereq_("./createRouter");module.exports=runRouter},{"./createRouter":24}],29:[function(_dereq_,module){function supportsHistory(){var ua=navigator.userAgent;return-1===ua.indexOf("Android 2.")&&-1===ua.indexOf("Android 4.0")||-1===ua.indexOf("Mobile Safari")||-1!==ua.indexOf("Chrome")?window.history&&"pushState"in window.history:!1}module.exports=supportsHistory
},{}],30:[function(_dereq_,module){module.exports=_dereq_("./lib")},{"./lib":31}],31:[function(_dereq_,module){var Stringify=_dereq_("./stringify"),Parse=_dereq_("./parse");module.exports={stringify:Stringify,parse:Parse}},{"./parse":32,"./stringify":33}],32:[function(_dereq_,module){var Utils=_dereq_("./utils"),internals={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3};internals.parseValues=function(str,options){for(var obj={},parts=str.split(options.delimiter,1/0===options.parameterLimit?void 0:options.parameterLimit),i=0,il=parts.length;il>i;++i){var part=parts[i],pos=-1===part.indexOf("]=")?part.indexOf("="):part.indexOf("]=")+1;if(-1===pos)obj[Utils.decode(part)]="";else{var key=Utils.decode(part.slice(0,pos)),val=Utils.decode(part.slice(pos+1));obj[key]=obj[key]?[].concat(obj[key]).concat(val):val}}return obj},internals.parseObject=function(chain,val,options){if(!chain.length)return val;var root=chain.shift(),obj={};if("[]"===root)obj=[],obj=obj.concat(internals.parseObject(chain,val,options));else{var cleanRoot="["===root[0]&&"]"===root[root.length-1]?root.slice(1,root.length-1):root,index=parseInt(cleanRoot,10);!isNaN(index)&&root!==cleanRoot&&index<=options.arrayLimit?(obj=[],obj[index]=internals.parseObject(chain,val,options)):obj[cleanRoot]=internals.parseObject(chain,val,options)}return obj},internals.parseKeys=function(key,val,options){if(key){var parent=/^([^\[\]]*)/,child=/(\[[^\[\]]*\])/g,segment=parent.exec(key);if(!Object.prototype.hasOwnProperty(segment[1])){var keys=[];segment[1]&&keys.push(segment[1]);for(var i=0;null!==(segment=child.exec(key))&&i<options.depth;)++i,Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g,""))||keys.push(segment[1]);return segment&&keys.push("["+key.slice(segment.index)+"]"),internals.parseObject(keys,val,options)}}},module.exports=function(str,options){if(""===str||null===str||"undefined"==typeof str)return{};options=options||{},options.delimiter="string"==typeof options.delimiter||Utils.isRegExp(options.delimiter)?options.delimiter:internals.delimiter,options.depth="number"==typeof options.depth?options.depth:internals.depth,options.arrayLimit="number"==typeof options.arrayLimit?options.arrayLimit:internals.arrayLimit,options.parameterLimit="number"==typeof options.parameterLimit?options.parameterLimit:internals.parameterLimit;for(var tempObj="string"==typeof str?internals.parseValues(str,options):str,obj={},keys=Object.keys(tempObj),i=0,il=keys.length;il>i;++i){var key=keys[i],newObj=internals.parseKeys(key,tempObj[key],options);obj=Utils.merge(obj,newObj)}return Utils.compact(obj)}},{"./utils":34}],33:[function(_dereq_,module){var Utils=_dereq_("./utils"),internals={delimiter:"&"};internals.stringify=function(obj,prefix){if(Utils.isBuffer(obj)?obj=obj.toString():obj instanceof Date?obj=obj.toISOString():null===obj&&(obj=""),"string"==typeof obj||"number"==typeof obj||"boolean"==typeof obj)return[encodeURIComponent(prefix)+"="+encodeURIComponent(obj)];var values=[];for(var key in obj)obj.hasOwnProperty(key)&&(values=values.concat(internals.stringify(obj[key],prefix+"["+key+"]")));return values},module.exports=function(obj,options){options=options||{};var delimiter="undefined"==typeof options.delimiter?internals.delimiter:options.delimiter,keys=[];for(var key in obj)obj.hasOwnProperty(key)&&(keys=keys.concat(internals.stringify(obj[key],key)));return keys.join(delimiter)}},{"./utils":34}],34:[function(_dereq_,module,exports){exports.arrayToObject=function(source){for(var obj={},i=0,il=source.length;il>i;++i)"undefined"!=typeof source[i]&&(obj[i]=source[i]);return obj},exports.merge=function(target,source){if(!source)return target;if(Array.isArray(source)){for(var i=0,il=source.length;il>i;++i)"undefined"!=typeof source[i]&&(target[i]="object"==typeof target[i]?exports.merge(target[i],source[i]):source[i]);return target}if(Array.isArray(target)){if("object"!=typeof source)return target.push(source),target;target=exports.arrayToObject(target)}for(var keys=Object.keys(source),k=0,kl=keys.length;kl>k;++k){var key=keys[k],value=source[key];target[key]=value&&"object"==typeof value&&target[key]?exports.merge(target[key],value):value}return target},exports.decode=function(str){try{return decodeURIComponent(str.replace(/\+/g," "))}catch(e){return str}},exports.compact=function(obj,refs){if("object"!=typeof obj||null===obj)return obj;refs=refs||[];var lookup=refs.indexOf(obj);if(-1!==lookup)return refs[lookup];if(refs.push(obj),Array.isArray(obj)){for(var compacted=[],i=0,l=obj.length;l>i;++i)"undefined"!=typeof obj[i]&&compacted.push(obj[i]);return compacted}for(var keys=Object.keys(obj),i=0,il=keys.length;il>i;++i){var key=keys[i];obj[key]=exports.compact(obj[key],refs)}return obj},exports.isRegExp=function(obj){return"[object RegExp]"===Object.prototype.toString.call(obj)},exports.isBuffer=function(obj){return"undefined"!=typeof Buffer?Buffer.isBuffer(obj):!1}},{}],35:[function(_dereq_,module){"use strict";var canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),ExecutionEnvironment={canUseDOM:canUseDOM,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:canUseDOM&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:canUseDOM&&!!window.screen,isInWorker:!canUseDOM};module.exports=ExecutionEnvironment},{}],36:[function(_dereq_,module){function assign(target){if(null==target)throw new TypeError("Object.assign target cannot be null or undefined");for(var to=Object(target),hasOwnProperty=Object.prototype.hasOwnProperty,nextIndex=1;nextIndex<arguments.length;nextIndex++){var nextSource=arguments[nextIndex];if(null!=nextSource){var from=Object(nextSource);for(var key in from)hasOwnProperty.call(from,key)&&(to[key]=from[key])}}return to}module.exports=assign},{}],37:[function(_dereq_,module){function cx(classNames){return"object"==typeof classNames?Object.keys(classNames).filter(function(className){return classNames[className]}).join(" "):Array.prototype.join.call(arguments," ")}module.exports=cx},{}],38:[function(_dereq_,module){function makeEmptyFunction(arg){return function(){return arg}}function emptyFunction(){}emptyFunction.thatReturns=makeEmptyFunction,emptyFunction.thatReturnsFalse=makeEmptyFunction(!1),emptyFunction.thatReturnsTrue=makeEmptyFunction(!0),emptyFunction.thatReturnsNull=makeEmptyFunction(null),emptyFunction.thatReturnsThis=function(){return this},emptyFunction.thatReturnsArgument=function(arg){return arg},module.exports=emptyFunction},{}],39:[function(_dereq_,module){"use strict";var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(void 0===format)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],argIndex=0;error=new Error("Invariant Violation: "+format.replace(/%s/g,function(){return args[argIndex++]}))}throw error.framesToPop=1,error}};module.exports=invariant},{}],40:[function(_dereq_,module){"use strict";var emptyFunction=_dereq_("./emptyFunction"),warning=emptyFunction;module.exports=warning},{"./emptyFunction":38}],41:[function(_dereq_,module){!function(define){"use strict";define(function(_dereq_){var makePromise=_dereq_("./makePromise"),Scheduler=_dereq_("./Scheduler"),async=_dereq_("./async");return makePromise({scheduler:new Scheduler(async)})})}("function"==typeof define&&define.amd?define:function(factory){module.exports=factory(_dereq_)})},{"./Scheduler":43,"./async":44,"./makePromise":45}],42:[function(_dereq_,module){!function(define){"use strict";define(function(){function Queue(capacityPow2){this.head=this.tail=this.length=0,this.buffer=new Array(1<<capacityPow2)}return Queue.prototype.push=function(x){return this.length===this.buffer.length&&this._ensureCapacity(2*this.length),this.buffer[this.tail]=x,this.tail=this.tail+1&this.buffer.length-1,++this.length,this.length},Queue.prototype.shift=function(){var x=this.buffer[this.head];return this.buffer[this.head]=void 0,this.head=this.head+1&this.buffer.length-1,--this.length,x},Queue.prototype._ensureCapacity=function(capacity){var len,head=this.head,buffer=this.buffer,newBuffer=new Array(capacity),i=0;if(0===head)for(len=this.length;len>i;++i)newBuffer[i]=buffer[i];else{for(capacity=buffer.length,len=this.tail;capacity>head;++i,++head)newBuffer[i]=buffer[head];for(head=0;len>head;++i,++head)newBuffer[i]=buffer[head]}this.buffer=newBuffer,this.head=0,this.tail=this.length},Queue})}("function"==typeof define&&define.amd?define:function(factory){module.exports=factory()})},{}],43:[function(_dereq_,module){!function(define){"use strict";define(function(_dereq_){function Scheduler(async){this._async=async,this._queue=new Queue(15),this._afterQueue=new Queue(5),this._running=!1;var self=this;this.drain=function(){self._drain()}}function runQueue(queue){for(;queue.length>0;)queue.shift().run()}var Queue=_dereq_("./Queue");return Scheduler.prototype.enqueue=function(task){this._add(this._queue,task)},Scheduler.prototype.afterQueue=function(task){this._add(this._afterQueue,task)},Scheduler.prototype._drain=function(){runQueue(this._queue),this._running=!1,runQueue(this._afterQueue)},Scheduler.prototype._add=function(queue,task){queue.push(task),this._running||(this._running=!0,this._async(this.drain))},Scheduler})}("function"==typeof define&&define.amd?define:function(factory){module.exports=factory(_dereq_)})},{"./Queue":42}],44:[function(_dereq_,module){!function(define){"use strict";define(function(_dereq_){var nextTick,MutationObs;return nextTick="undefined"!=typeof process&&null!==process&&"function"==typeof process.nextTick?function(f){process.nextTick(f)}:(MutationObs="function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver)?function(document,MutationObserver){function run(){var f=scheduled;scheduled=void 0,f()}var scheduled,el=document.createElement("div"),o=new MutationObserver(run);return o.observe(el,{attributes:!0}),function(f){scheduled=f,el.setAttribute("class","x")}}(document,MutationObs):function(cjsRequire){var vertx;try{vertx=cjsRequire("vertx")}catch(ignore){}if(vertx){if("function"==typeof vertx.runOnLoop)return vertx.runOnLoop;if("function"==typeof vertx.runOnContext)return vertx.runOnContext}var capturedSetTimeout=setTimeout;return function(t){capturedSetTimeout(t,0)}}(_dereq_)})}("function"==typeof define&&define.amd?define:function(factory){module.exports=factory(_dereq_)})},{}],45:[function(_dereq_,module){!function(define){"use strict";define(function(){return function(environment){function Promise(resolver,handler){this._handler=resolver===Handler?handler:init(resolver)}function init(resolver){function promiseResolve(x){handler.resolve(x)}function promiseReject(reason){handler.reject(reason)}function promiseNotify(x){handler.notify(x)}var handler=new Pending;try{resolver(promiseResolve,promiseReject,promiseNotify)}catch(e){promiseReject(e)}return handler}function resolve(x){return isPromise(x)?x:new Promise(Handler,new Async(getHandler(x)))}function reject(x){return new Promise(Handler,new Async(new Rejected(x)))}function never(){return foreverPendingPromise}function defer(){return new Promise(Handler,new Pending)}function all(promises){function settleAt(i,x,resolver){this[i]=x,0===--pending&&resolver.become(new Fulfilled(this))}var i,h,x,s,resolver=new Pending,pending=promises.length>>>0,results=new Array(pending);for(i=0;i<promises.length;++i)if(x=promises[i],void 0!==x||i in promises)if(maybeThenable(x))if(h=getHandlerMaybeThenable(x),s=h.state(),0===s)h.fold(settleAt,i,results,resolver);else{if(!(s>0)){unreportRemaining(promises,i+1,h),resolver.become(h);break}results[i]=h.value,--pending}else results[i]=x,--pending;else--pending;return 0===pending&&resolver.become(new Fulfilled(results)),new Promise(Handler,resolver)}function unreportRemaining(promises,start,rejectedHandler){var i,h,x;for(i=start;i<promises.length;++i)x=promises[i],maybeThenable(x)&&(h=getHandlerMaybeThenable(x),h!==rejectedHandler&&h.visit(h,void 0,h._unreport))}function race(promises){if(Object(promises)===promises&&0===promises.length)return never();var i,x,h=new Pending;for(i=0;i<promises.length;++i)x=promises[i],void 0!==x&&i in promises&&getHandler(x).visit(h,h.resolve,h.reject);return new Promise(Handler,h)}function getHandler(x){return isPromise(x)?x._handler.join():maybeThenable(x)?getHandlerUntrusted(x):new Fulfilled(x)}function getHandlerMaybeThenable(x){return isPromise(x)?x._handler.join():getHandlerUntrusted(x)}function getHandlerUntrusted(x){try{var untrustedThen=x.then;return"function"==typeof untrustedThen?new Thenable(untrustedThen,x):new Fulfilled(x)}catch(e){return new Rejected(e)}}function Handler(){}function FailIfRejected(){}function Pending(receiver,inheritedContext){Promise.createContext(this,inheritedContext),this.consumers=void 0,this.receiver=receiver,this.handler=void 0,this.resolved=!1}function Async(handler){this.handler=handler}function Thenable(then,thenable){Pending.call(this),tasks.enqueue(new AssimilateTask(then,thenable,this))}function Fulfilled(x){Promise.createContext(this),this.value=x}function Rejected(x){Promise.createContext(this),this.id=++errorId,this.value=x,this.handled=!1,this.reported=!1,this._report()}function ReportTask(rejection,context){this.rejection=rejection,this.context=context}function UnreportTask(rejection){this.rejection=rejection}function cycle(){return new Rejected(new TypeError("Promise cycle"))}function ContinuationTask(continuation,handler){this.continuation=continuation,this.handler=handler}function ProgressTask(value,handler){this.handler=handler,this.value=value}function AssimilateTask(then,thenable,resolver){this._then=then,this.thenable=thenable,this.resolver=resolver}function tryAssimilate(then,thenable,resolve,reject,notify){try{then.call(thenable,resolve,reject,notify)}catch(e){reject(e)}}function isPromise(x){return x instanceof Promise}function maybeThenable(x){return("object"==typeof x||"function"==typeof x)&&null!==x}function runContinuation1(f,h,receiver,next){return"function"!=typeof f?next.become(h):(Promise.enterContext(h),tryCatchReject(f,h.value,receiver,next),void Promise.exitContext())}function runContinuation3(f,x,h,receiver,next){return"function"!=typeof f?next.become(h):(Promise.enterContext(h),tryCatchReject3(f,x,h.value,receiver,next),void Promise.exitContext())}function runNotify(f,x,h,receiver,next){return"function"!=typeof f?next.notify(x):(Promise.enterContext(h),tryCatchReturn(f,x,receiver,next),void Promise.exitContext())}function tryCatchReject(f,x,thisArg,next){try{next.become(getHandler(f.call(thisArg,x)))}catch(e){next.become(new Rejected(e))}}function tryCatchReject3(f,x,y,thisArg,next){try{f.call(thisArg,x,y,next)}catch(e){next.become(new Rejected(e))}}function tryCatchReturn(f,x,thisArg,next){try{next.notify(f.call(thisArg,x))}catch(e){next.notify(e)}}function inherit(Parent,Child){Child.prototype=objectCreate(Parent.prototype),Child.prototype.constructor=Child}function noop(){}var tasks=environment.scheduler,objectCreate=Object.create||function(proto){function Child(){}return Child.prototype=proto,new Child};Promise.resolve=resolve,Promise.reject=reject,Promise.never=never,Promise._defer=defer,Promise._handler=getHandler,Promise.prototype.then=function(onFulfilled,onRejected){var parent=this._handler,state=parent.join().state();if("function"!=typeof onFulfilled&&state>0||"function"!=typeof onRejected&&0>state)return new this.constructor(Handler,parent);var p=this._beget(),child=p._handler;return parent.chain(child,parent.receiver,onFulfilled,onRejected,arguments.length>2?arguments[2]:void 0),p},Promise.prototype["catch"]=function(onRejected){return this.then(void 0,onRejected)},Promise.prototype._beget=function(){var parent=this._handler,child=new Pending(parent.receiver,parent.join().context);return new this.constructor(Handler,child)},Promise.all=all,Promise.race=race,Handler.prototype.when=Handler.prototype.become=Handler.prototype.notify=Handler.prototype.fail=Handler.prototype._unreport=Handler.prototype._report=noop,Handler.prototype._state=0,Handler.prototype.state=function(){return this._state},Handler.prototype.join=function(){for(var h=this;void 0!==h.handler;)h=h.handler;return h},Handler.prototype.chain=function(to,receiver,fulfilled,rejected,progress){this.when({resolver:to,receiver:receiver,fulfilled:fulfilled,rejected:rejected,progress:progress})},Handler.prototype.visit=function(receiver,fulfilled,rejected,progress){this.chain(failIfRejected,receiver,fulfilled,rejected,progress)},Handler.prototype.fold=function(f,z,c,to){this.visit(to,function(x){f.call(c,z,x,this)},to.reject,to.notify)},inherit(Handler,FailIfRejected),FailIfRejected.prototype.become=function(h){h.fail()};var failIfRejected=new FailIfRejected;inherit(Handler,Pending),Pending.prototype._state=0,Pending.prototype.resolve=function(x){this.become(getHandler(x))},Pending.prototype.reject=function(x){this.resolved||this.become(new Rejected(x))},Pending.prototype.join=function(){if(!this.resolved)return this;for(var h=this;void 0!==h.handler;)if(h=h.handler,h===this)return this.handler=cycle();return h},Pending.prototype.run=function(){var q=this.consumers,handler=this.join();this.consumers=void 0;for(var i=0;i<q.length;++i)handler.when(q[i])},Pending.prototype.become=function(handler){this.resolved||(this.resolved=!0,this.handler=handler,void 0!==this.consumers&&tasks.enqueue(this),void 0!==this.context&&handler._report(this.context))},Pending.prototype.when=function(continuation){this.resolved?tasks.enqueue(new ContinuationTask(continuation,this.handler)):void 0===this.consumers?this.consumers=[continuation]:this.consumers.push(continuation)},Pending.prototype.notify=function(x){this.resolved||tasks.enqueue(new ProgressTask(x,this))},Pending.prototype.fail=function(context){var c="undefined"==typeof context?this.context:context;this.resolved&&this.handler.join().fail(c)},Pending.prototype._report=function(context){this.resolved&&this.handler.join()._report(context)},Pending.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},inherit(Handler,Async),Async.prototype.when=function(continuation){tasks.enqueue(new ContinuationTask(continuation,this))},Async.prototype._report=function(context){this.join()._report(context)},Async.prototype._unreport=function(){this.join()._unreport()},inherit(Pending,Thenable),inherit(Handler,Fulfilled),Fulfilled.prototype._state=1,Fulfilled.prototype.fold=function(f,z,c,to){runContinuation3(f,z,this,c,to)},Fulfilled.prototype.when=function(cont){runContinuation1(cont.fulfilled,this,cont.receiver,cont.resolver)};var errorId=0;inherit(Handler,Rejected),Rejected.prototype._state=-1,Rejected.prototype.fold=function(f,z,c,to){to.become(this)},Rejected.prototype.when=function(cont){"function"==typeof cont.rejected&&this._unreport(),runContinuation1(cont.rejected,this,cont.receiver,cont.resolver)},Rejected.prototype._report=function(context){tasks.afterQueue(new ReportTask(this,context))},Rejected.prototype._unreport=function(){this.handled=!0,tasks.afterQueue(new UnreportTask(this))},Rejected.prototype.fail=function(context){Promise.onFatalRejection(this,void 0===context?this.context:context)},ReportTask.prototype.run=function(){this.rejection.handled||(this.rejection.reported=!0,Promise.onPotentiallyUnhandledRejection(this.rejection,this.context))},UnreportTask.prototype.run=function(){this.rejection.reported&&Promise.onPotentiallyUnhandledRejectionHandled(this.rejection)},Promise.createContext=Promise.enterContext=Promise.exitContext=Promise.onPotentiallyUnhandledRejection=Promise.onPotentiallyUnhandledRejectionHandled=Promise.onFatalRejection=noop;var foreverPendingHandler=new Handler,foreverPendingPromise=new Promise(Handler,foreverPendingHandler);return ContinuationTask.prototype.run=function(){this.handler.join().when(this.continuation)},ProgressTask.prototype.run=function(){var q=this.handler.consumers;if(void 0!==q)for(var c,i=0;i<q.length;++i)c=q[i],runNotify(c.progress,this.value,this.handler,c.receiver,c.resolver)},AssimilateTask.prototype.run=function(){function _resolve(x){h.resolve(x)}function _reject(x){h.reject(x)}function _notify(x){h.notify(x)}var h=this.resolver;tryAssimilate(this._then,this.thenable,_resolve,_reject,_notify)},Promise}})}("function"==typeof define&&define.amd?define:function(factory){module.exports=factory()})},{}]},{},[9])(9)}); |
frontend/src/components/Filters.js | OwenRay/Remote-MediaServer | import React, { Component } from 'react';
/* global $ */
import { Button, Col, Input, Row, SideNav, Autocomplete } from 'react-materialize';
import { Handle, Range } from 'rc-slider';
import 'rc-slider/assets/index.css';
let genres = [];
class ButtonMenu extends Component {
constructor() {
super();
if (!genres.length) { $.getJSON('/api/tmdb/genres', this.genresLoaded.bind(this)); }
this.onChange = this.onChange.bind(this);
this.onValueChange = this.onValueChange.bind(this);
this.hideSideNav = this.hideSideNav.bind(this);
this.resetFilters = this.resetFilters.bind(this);
this.state = { filters: {}, genres };
}
genresLoaded(o) {
genres = o;
this.setState({ genres });
}
componentWillReceiveProps(props) {
const f = {};
Object.keys(props.filters).forEach((key) => {
if (['false', 'true'].includes(props.filters[key])) {
f[key] = props.filters[key] === 'true';
} else {
f[key] = props.filters[key];
}
});
this.setState({ filters: f});
}
onValueChange(name, value) {
const o = this.state;
if (name === 'fileduration') {
value = value.map(v => v * 60);
}
o.filters[name] = Array.isArray(value) ? value.join('><') : value;
this.setState(o);
if (this.props.onChange) {
this.props.onChange(o.filters);
}
}
onChange(e) {
const o = this.state;
o.filters[e.target.name] = e.target.value;
if (o.filters[e.target.name] === '') {
delete o.filters[e.target.name];
}
this.setState(o);
if (this.props.onChange) {
this.props.onChange(o.filters);
}
}
hideSideNav() {
$(this.sideNav).sideNav('hide');
}
handle(props) {
props.dragging += '';
return (
<Handle key={`handle${props.className}`} {...props} >
{props.dragging !== 'false' ? <span>{props.value}</span> : ''}
</Handle>
);
}
resetFilters() {
this.setState({ filters: {} });
this.props.onChange(null);
this.hideSideNav();
}
content() {
const f = this.state.filters;
const fv = this.props.filterValues;
if (!f || !fv) {
return null;
}
const rangeValue = f['vote-average'] ?
f['vote-average'].split('><').map(v => parseFloat(v)) :
[1, 10];
const timeValue = f.fileduration ?
f.fileduration.split('><').map(v => parseInt(v, 10) / 60) :
[0, 300];
const yearValue = f.year ?
f.year.split('><').map(v => parseInt(v, 10)) :
[1900, new Date().getFullYear()];
const actorsData = {};
fv.actors.forEach((actor) => { actorsData[actor] = null; });
return (
<div>
<div className="top">
<Row>
<Input
value={`${f['play-position.watched']}`}
type="select"
label="Watched"
name="play-position.watched"
onChange={this.onChange}
>
<option value="">Watched & unwatched</option>
<option value="true">Watched only</option>
<option value="false">Unwatched only</option>
</Input>
</Row>
<Row>
<Input
value={f['genre-ids']}
name="genre-ids"
type="select"
label="Genre"
onChange={this.onChange}
>
<option value="">All</option>
{this.state.genres.map(genre => <option key={genre.id} value={genre.id}>{genre.name}</option>)}
</Input>
</Row>
<Row>
<Input
value={f.mpaa}
name="mpaa"
type="select"
label="Age rating"
onChange={this.onChange}
>
<option value="">All</option>
{fv.mpaa.map(rating => <option key={rating} value={rating}>{rating}</option>)}
</Input>
</Row>
<Row>
<Autocomplete
value={f.actors}
name="actors"
type="select"
title="Actors"
onAutocomplete={val => this.onValueChange('actors', val)}
data={actorsData}
/>
</Row>
<Row>
<label>Rating</label>
<Range
handle={this.handle}
step={0.1}
onChange={v => this.onValueChange('vote-average', v)}
value={rangeValue}
min={1}
max={10}
/>
</Row>
<Row>
<label>Runtime</label>
<Range
handle={this.handle}
step={1}
onChange={v => this.onValueChange('fileduration', v)}
value={timeValue}
min={0}
max={300}
/>
</Row>
<Row>
<label>Year</label>
<Range
handle={this.handle}
step={1}
onChange={v => this.onValueChange('year', v)}
value={yearValue}
min={1900}
max={new Date().getFullYear()}
/>
</Row>
</div>
<Row>
<Col s={6}>
<Button onClick={this.hideSideNav}>Close</Button>
</Col>
<Col s={6}>
<Button onClick={this.resetFilters}>Reset</Button>
</Col>
</Row>
</div>
);
}
render() {
return (
<SideNav
ref={(ref) => { this.sideNav = ref; }}
trigger={<Button className="bottom-right-fab" floating icon="tune" />}
options={{
edge: 'right',
draggable: true,
}}
>
{this.content()}
</SideNav>
);
}
}
export default ButtonMenu;
|
utils/typography.js | machikoyasuda/la-gos | import ReactDOM from 'react-dom/server'
import React from 'react'
import Typography from 'typography'
import { GoogleFont } from 'react-typography'
import CodePlugin from 'typography-plugin-code'
const options = {
googleFonts: [
{
name: 'Work Sans',
styles: [
'600',
],
},
{
name: 'Quattrocento Sans',
styles: [
'400',
'400i',
'700',
],
},
],
headerFontFamily: ['Work Sans', 'sans-serif'],
bodyFontFamily: ['Quattrocento Sans', 'sans-serif'],
baseFontSize: '18px',
baseLineHeight: 1.65,
scale: 2.25,
plugins: [
new CodePlugin(),
],
}
const typography = new Typography(options)
// Hot reload typography in development.
if (process.env.NODE_ENV !== 'production') {
typography.injectStyles()
if (typeof document !== 'undefined') {
const googleFonts = ReactDOM.renderToStaticMarkup(
React.createFactory(GoogleFont)({ typography })
)
const head = document.getElementsByTagName('head')[0]
head.insertAdjacentHTML('beforeend', googleFonts)
}
}
export default typography
|
src/main.js | OwlAford/react-blade-mobile | import React from 'react'
import ReactDOM from 'react-dom'
// createStore创建状态管理树
import createStore from 'STORE/createStore'
// 应用容器模块
import AppContainer from 'CONTAINER/AppContainer'
// 创建初始化状态容器,指向一个window全局变量
const initialState = window.___INITIAL_STATE__
// 创建一个全局的store状态管理器
const store = createStore(initialState)
// 获取渲染的根节点
const MOUNT_NODE = document.getElementById('root')
// 定义一个渲染方法
let render = () => {
// 将store方法注入路由器,用于管理state状态树,并获取该路由
const routes = require('ROUTE').default(store)
// 在根节点渲染页面
ReactDOM.render(
<AppContainer store={store} routes={routes} />,
MOUNT_NODE
)
}
// 在开发模式下
if (__DEV__) {
// 判断是否模块热加载
if (module.hot) {
// 定义开发环境下渲染方法
const renderApp = render
// 定义错误日志框渲染方法
const renderError = (error) => {
const RedBox = require('redbox-react').default
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE)
}
// 用 try/catch 包裹render方法,以切换渲染内容,发生错误时,渲染错误日志页面
render = () => {
try {
renderApp()
} catch (error) {
renderError(error)
}
}
// 设置模块热替换方法
module.hot.accept('ROUTE', () =>
setImmediate(() => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE)
render()
})
)
}
}
// ie兼容 startWith bug
if (typeof String.prototype.startsWith != 'function') {
String.prototype.startsWith = function (prefix){
return this.slice(0, prefix.length) === prefix
}
}
// 获取并保存屏幕宽度方便做尺寸换算
window.clientWidth = document.documentElement.clientWidth
// 开始正式渲染
render()
|
ajax/libs/react/0.13.0-beta.2/react-with-addons.js | nareshs435/cdnjs | /**
* React (with addons) v0.13.0-beta.2
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactWithAddons
*/
/**
* This module exists purely in the open source project, and is meant as a way
* to create a separate standalone build of React. This build has "addons", or
* functionality we've built and think might be useful but doesn't have a good
* place to live inside React core.
*/
'use strict';
var LinkedStateMixin = _dereq_(25);
var React = _dereq_(31);
var ReactComponentWithPureRenderMixin =
_dereq_(42);
var ReactCSSTransitionGroup = _dereq_(34);
var ReactFragment = _dereq_(69);
var ReactTransitionGroup = _dereq_(98);
var ReactUpdates = _dereq_(100);
var cx = _dereq_(127);
var cloneWithProps = _dereq_(122);
var update = _dereq_(170);
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
LinkedStateMixin: LinkedStateMixin,
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
batchedUpdates: ReactUpdates.batchedUpdates,
classSet: cx,
cloneWithProps: cloneWithProps,
createFragment: ReactFragment.create,
update: update
};
if ("production" !== "development") {
React.addons.Perf = _dereq_(61);
React.addons.TestUtils = _dereq_(95);
}
module.exports = React;
},{}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule AutoFocusMixin
* @typechecks static-only
*/
'use strict';
var focusNode = _dereq_(134);
var AutoFocusMixin = {
componentDidMount: function() {
if (this.props.autoFocus) {
focusNode(this.getDOMNode());
}
}
};
module.exports = AutoFocusMixin;
},{}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule BeforeInputEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPropagators = _dereq_(21);
var ExecutionEnvironment = _dereq_(22);
var FallbackCompositionState = _dereq_(23);
var SyntheticCompositionEvent = _dereq_(106);
var SyntheticInputEvent = _dereq_(110);
var keyOf = _dereq_(157);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var canUseCompositionEvent = (
ExecutionEnvironment.canUseDOM &&
'CompositionEvent' in window
);
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
var canUseTextInputEvent = (
ExecutionEnvironment.canUseDOM &&
'TextEvent' in window &&
!documentMode &&
!isPresto()
);
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
var useFallbackCompositionData = (
ExecutionEnvironment.canUseDOM &&
(
(!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
)
);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
* text input events. Rely on keypress instead.
*/
function isPresto() {
var opera = window.opera;
return (
typeof opera === 'object' &&
typeof opera.version === 'function' &&
parseInt(opera.version(), 10) <= 12
);
}
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
var topLevelTypes = EventConstants.topLevelTypes;
// Events and their corresponding property names.
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
bubbled: keyOf({onBeforeInput: null}),
captured: keyOf({onBeforeInputCapture: null})
},
dependencies: [
topLevelTypes.topCompositionEnd,
topLevelTypes.topKeyPress,
topLevelTypes.topTextInput,
topLevelTypes.topPaste
]
},
compositionEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionEnd: null}),
captured: keyOf({onCompositionEndCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topCompositionEnd,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyPress,
topLevelTypes.topKeyUp,
topLevelTypes.topMouseDown
]
},
compositionStart: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionStart: null}),
captured: keyOf({onCompositionStartCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topCompositionStart,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyPress,
topLevelTypes.topKeyUp,
topLevelTypes.topMouseDown
]
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionUpdate: null}),
captured: keyOf({onCompositionUpdateCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topCompositionUpdate,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyPress,
topLevelTypes.topKeyUp,
topLevelTypes.topMouseDown
]
}
};
// Track whether we've ever handled a keypress on the space key.
var hasSpaceKeypress = false;
/**
* Return whether a native keypress event is assumed to be a command.
* This is required because Firefox fires `keypress` events for key commands
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
return (
(nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
!(nativeEvent.ctrlKey && nativeEvent.altKey)
);
}
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case topLevelTypes.topCompositionStart:
return eventTypes.compositionStart;
case topLevelTypes.topCompositionEnd:
return eventTypes.compositionEnd;
case topLevelTypes.topCompositionUpdate:
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
return (
topLevelType === topLevelTypes.topKeyDown &&
nativeEvent.keyCode === START_KEYCODE
);
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return (nativeEvent.keyCode !== START_KEYCODE);
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Google Input Tools provides composition data via a CustomEvent,
* with the `data` property populated in the `detail` object. If this
* is available on the event object, use it. If not, this is a plain
* composition event and we have nothing special to extract.
*
* @param {object} nativeEvent
* @return {?string}
*/
function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if (typeof detail === 'object' && 'data' in detail) {
return detail.data;
}
return null;
}
// Track the current IME composition fallback object, if any.
var currentComposition = null;
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
function extractCompositionEvent(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
) {
var eventType;
var fallbackData;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionStart;
}
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
}
if (!eventType) {
return null;
}
if (useFallbackCompositionData) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
fallbackData = currentComposition.getData();
}
}
}
var event = SyntheticCompositionEvent.getPooled(
eventType,
topLevelTargetID,
nativeEvent
);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = fallbackData;
} else {
var customData = getDataFromCustomEvent(nativeEvent);
if (customData !== null) {
event.data = customData;
}
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The string corresponding to this `beforeInput` event.
*/
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topCompositionEnd:
return getDataFromCustomEvent(nativeEvent);
case topLevelTypes.topKeyPress:
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
* In Webkit, preventing default on a spacebar `textInput` event
* cancels character insertion, but it *also* causes the browser
* to fall back to its default spacebar behavior of scrolling the
* page.
*
* Tracking at:
* https://code.google.com/p/chromium/issues/detail?id=355103
*
* To avoid this issue, use the keypress event as if no `textInput`
* event is available.
*/
var which = nativeEvent.which;
if (which !== SPACEBAR_CODE) {
return null;
}
hasSpaceKeypress = true;
return SPACEBAR_CHAR;
case topLevelTypes.topTextInput:
// Record the characters to be added to the DOM.
var chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately. Android Chrome
// doesn't give us keycodes, so we need to blacklist it.
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
return null;
}
return chars;
default:
// For other native event types, do nothing.
return null;
}
}
/**
* For browsers that do not provide the `textInput` event, extract the
* appropriate string to use for SyntheticInputEvent.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The fallback string for this `beforeInput` event.
*/
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
if (
topLevelType === topLevelTypes.topCompositionEnd ||
isFallbackCompositionEnd(topLevelType, nativeEvent)
) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
return chars;
}
return null;
}
switch (topLevelType) {
case topLevelTypes.topPaste:
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
return null;
case topLevelTypes.topKeyPress:
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
*
* - `which` is `0`. Arrow keys, Esc key, etc.
*
* - `which` is the pressed key code, but no char is available.
* Ex: 'AltGr + d` in Polish. There is no modified character for
* this key combination and no character is inserted into the
* document, but FF fires the keypress for char code `100` anyway.
* No `input` event will occur.
*
* - `which` is the pressed key code, but a command combination is
* being used. Ex: `Cmd+C`. No character is inserted, and no
* `input` event will occur.
*/
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
return String.fromCharCode(nativeEvent.which);
}
return null;
case topLevelTypes.topCompositionEnd:
return useFallbackCompositionData ? null : nativeEvent.data;
default:
return null;
}
}
/**
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
* `textInput` or fallback behavior.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
function extractBeforeInputEvent(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being inserted, no BeforeInput event should
// be fired.
if (!chars) {
return null;
}
var event = SyntheticInputEvent.getPooled(
eventTypes.beforeInput,
topLevelTargetID,
nativeEvent
);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* Create an `onBeforeInput` event to match
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
*
* This event plugin is based on the native `textInput` event
* available in Chrome, Safari, Opera, and IE. This event fires after
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
*
* `beforeInput` is spec'd but not implemented in any browsers, and
* the `input` event does not provide any useful information about what has
* actually been added, contrary to the spec. Thus, `textInput` is the best
* available event to identify the characters that have actually been inserted
* into the target node.
*
* This plugin is also responsible for emitting `composition` events, thus
* allowing us to share composition fallback code for both `beforeInput` and
* `composition` event types.
*/
var BeforeInputEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
) {
return [
extractCompositionEvent(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
),
extractBeforeInputEvent(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
)
];
}
};
module.exports = BeforeInputEventPlugin;
},{}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule CSSCore
* @typechecks
*/
var invariant = _dereq_(150);
/**
* The CSSCore module specifies the API (and implements most of the methods)
* that should be used when dealing with the display of elements (via their
* CSS classes and visibility on screen. It is an API focused on mutating the
* display and not reading it as no logical state should be encoded in the
* display of elements.
*/
var CSSCore = {
/**
* Adds the class passed in to the element if it doesn't already have it.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
addClass: function(element, className) {
("production" !== "development" ? invariant(
!/\s/.test(className),
'CSSCore.addClass takes only a single class name. "%s" contains ' +
'multiple classes.', className
) : invariant(!/\s/.test(className)));
if (className) {
if (element.classList) {
element.classList.add(className);
} else if (!CSSCore.hasClass(element, className)) {
element.className = element.className + ' ' + className;
}
}
return element;
},
/**
* Removes the class passed in from the element
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
removeClass: function(element, className) {
("production" !== "development" ? invariant(
!/\s/.test(className),
'CSSCore.removeClass takes only a single class name. "%s" contains ' +
'multiple classes.', className
) : invariant(!/\s/.test(className)));
if (className) {
if (element.classList) {
element.classList.remove(className);
} else if (CSSCore.hasClass(element, className)) {
element.className = element.className
.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
.replace(/\s+/g, ' ') // multiple spaces to one
.replace(/^\s*|\s*$/g, ''); // trim the ends
}
}
return element;
},
/**
* Helper to add or remove a class from an element based on a condition.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @param {*} bool condition to whether to add or remove the class
* @return {DOMElement} the element passed in
*/
conditionClass: function(element, className, bool) {
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
},
/**
* Tests whether the element has the class specified.
*
* @param {DOMNode|DOMWindow} element the element to set the class on
* @param {string} className the CSS className
* @return {boolean} true if the element has the class, false if not
*/
hasClass: function(element, className) {
("production" !== "development" ? invariant(
!/\s/.test(className),
'CSS.hasClass takes only a single class name.'
) : invariant(!/\s/.test(className)));
if (element.classList) {
return !!className && element.classList.contains(className);
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
}
};
module.exports = CSSCore;
},{}],5:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule CSSProperty
*/
'use strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
columnCount: true,
flex: true,
flexGrow: true,
flexShrink: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
strokeOpacity: 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: {
backgroundImage: true,
backgroundPosition: true,
backgroundRepeat: true,
backgroundColor: 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
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
},{}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule CSSPropertyOperations
* @typechecks static-only
*/
'use strict';
var CSSProperty = _dereq_(5);
var ExecutionEnvironment = _dereq_(22);
var camelizeStyleName = _dereq_(121);
var dangerousStyleValue = _dereq_(128);
var hyphenateStyleName = _dereq_(148);
var memoizeStringOnly = _dereq_(159);
var warning = _dereq_(171);
var processStyleName = memoizeStringOnly(function(styleName) {
return hyphenateStyleName(styleName);
});
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if ("production" !== "development") {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnHyphenatedStyleName = function(name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
("production" !== "development" ? warning(
false,
'Unsupported style property %s. Did you mean %s?',
name,
camelizeStyleName(name)
) : null);
};
var warnBadVendoredStyleName = function(name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
("production" !== "development" ? warning(
false,
'Unsupported vendor-prefixed style property %s. Did you mean %s?',
name,
name.charAt(0).toUpperCase() + name.slice(1)
) : null);
};
var warnStyleValueWithSemicolon = function(name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
("production" !== "development" ? warning(
false,
'Style property values shouldn\'t contain a semicolon. ' +
'Try "%s: %s" instead.',
name,
value.replace(badStyleValueWithSemicolonPattern, '')
) : null);
};
/**
* @param {string} name
* @param {*} value
*/
var warnValidStyle = function(name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @return {?string}
*/
createMarkupForStyles: function(styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if ("production" !== "development") {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
*/
setValueForStyles: function(node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if ("production" !== "development") {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
if (styleName === 'float') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
module.exports = CSSPropertyOperations;
},{}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule CallbackQueue
*/
'use strict';
var PooledClass = _dereq_(30);
var assign = _dereq_(29);
var invariant = _dereq_(150);
/**
* 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
*/
function CallbackQueue() {
this._callbacks = null;
this._contexts = null;
}
assign(CallbackQueue.prototype, {
/**
* 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
*/
enqueue: function(callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
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
*/
notifyAll: function() {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
("production" !== "development" ? invariant(
callbacks.length === contexts.length,
'Mismatched list of contexts in callback queue'
) : invariant(callbacks.length === contexts.length));
this._callbacks = null;
this._contexts = null;
for (var i = 0, l = callbacks.length; i < l; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
contexts.length = 0;
}
},
/**
* Resets the internal queue.
*
* @internal
*/
reset: function() {
this._callbacks = null;
this._contexts = null;
},
/**
* `PooledClass` looks for this.
*/
destructor: function() {
this.reset();
}
});
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
},{}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ChangeEventPlugin
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPluginHub = _dereq_(18);
var EventPropagators = _dereq_(21);
var ExecutionEnvironment = _dereq_(22);
var ReactUpdates = _dereq_(100);
var SyntheticEvent = _dereq_(108);
var isEventSupported = _dereq_(151);
var isTextInputElement = _dereq_(153);
var keyOf = _dereq_(157);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: keyOf({onChange: null}),
captured: keyOf({onChangeCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topChange,
topLevelTypes.topClick,
topLevelTypes.topFocus,
topLevelTypes.topInput,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyUp,
topLevelTypes.topSelectionChange
]
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementID = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
return (
elem.nodeName === 'SELECT' ||
(elem.nodeName === 'INPUT' && elem.type === 'file')
);
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (
(!('documentMode' in document) || document.documentMode > 8)
);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
activeElementID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
// other events and have it go through ReactBrowserEventEmitter. Since it
// doesn't, we manually listen for the events and so we have to enqueue and
// process the abstract event manually.
//
// Batching is necessary here in order to ensure that all event handlers run
// before the next rerender (including event handlers attached to ancestor
// elements instead of directly on the input). Without this, controlled
// components don't work properly in conjunction with event bubbling because
// the component is rerendered and the value reverted before all the event
// handlers can run. See https://github.com/facebook/react/issues/708.
ReactUpdates.batchedUpdates(runEventInBatch, event);
}
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue();
}
function startWatchingForChangeEventIE8(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementID = null;
}
function getTargetIDForChangeEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
function handleEventsForChangeEventIE8(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
isInputEventSupported = isEventSupported('input') && (
(!('documentMode' in document) || document.documentMode > 9)
);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function() {
return activeElementValueProp.get.call(this);
},
set: function(val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For old IE.) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(
target.constructor.prototype,
'value'
);
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
/**
* (For old IE.) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementID = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For old IE.) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetIDForInputEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return topLevelTargetID;
}
}
// For IE8 and IE9.
function handleEventsForInputEventIE(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetIDForInputEventIE(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topSelectionChange ||
topLevelType === topLevelTypes.topKeyUp ||
topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementID;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return (
elem.nodeName === 'INPUT' &&
(elem.type === 'checkbox' || elem.type === 'radio')
);
}
function getTargetIDForClickEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
if (doesChangeEventBubble) {
getTargetIDFunc = getTargetIDForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(topLevelTarget)) {
if (isInputEventSupported) {
getTargetIDFunc = getTargetIDForInputEvent;
} else {
getTargetIDFunc = getTargetIDForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(topLevelTarget)) {
getTargetIDFunc = getTargetIDForClickEvent;
}
if (getTargetIDFunc) {
var targetID = getTargetIDFunc(
topLevelType,
topLevelTarget,
topLevelTargetID
);
if (targetID) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
targetID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(
topLevelType,
topLevelTarget,
topLevelTargetID
);
}
}
};
module.exports = ChangeEventPlugin;
},{}],9:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ClientReactRootIndex
* @typechecks
*/
'use strict';
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
createReactRootIndex: function() {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
},{}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule DOMChildrenOperations
* @typechecks static-only
*/
'use strict';
var Danger = _dereq_(13);
var ReactMultiChildUpdateTypes = _dereq_(79);
var setTextContent = _dereq_(165);
var invariant = _dereq_(150);
/**
* 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
*/
function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
parentNode.insertBefore(
childNode,
parentNode.childNodes[index] || null
);
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
updateTextContent: setTextContent,
/**
* 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.
* @param {array<string>} markupList List of markup strings.
* @internal
*/
processUpdates: function(updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
// List of children that will be moved or removed.
var updatedChildren = null;
for (var i = 0; i < updates.length; i++) {
update = updates[i];
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
("production" !== "development" ? invariant(
updatedChild,
'processUpdates(): Unable to find child %s of element. This ' +
'probably means the DOM was unexpectedly mutated (e.g., by the ' +
'browser), usually due to forgetting a <tbody> when using tables, ' +
'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
'in an <svg> parent. Try inspecting the child nodes of the element ' +
'with React ID `%s`.',
updatedIndex,
parentID
) : invariant(updatedChild));
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;
updatedChildren = updatedChildren || [];
updatedChildren.push(updatedChild);
}
}
var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
for (var j = 0; j < updatedChildren.length; j++) {
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
}
}
for (var k = 0; k < updates.length; k++) {
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
insertChildAt(
update.parentNode,
renderedMarkup[update.markupIndex],
update.toIndex
);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
insertChildAt(
update.parentNode,
initialChildren[update.parentID][update.fromIndex],
update.toIndex
);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
setTextContent(
update.parentNode,
update.textContent
);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
break;
}
}
}
};
module.exports = DOMChildrenOperations;
},{}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
/*jslint bitwise: true */
'use strict';
var invariant = _dereq_(150);
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_ATTRIBUTE: 0x1,
MUST_USE_PROPERTY: 0x2,
HAS_SIDE_EFFECTS: 0x4,
HAS_BOOLEAN_VALUE: 0x8,
HAS_NUMERIC_VALUE: 0x10,
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
/**
* 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.
*
* 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(domPropertyConfig) {
var Properties = domPropertyConfig.Properties || {};
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) {
("production" !== "development" ? invariant(
!DOMProperty.isStandardName.hasOwnProperty(propName),
'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
'\'%s\' which has already been injected. You may be accidentally ' +
'injecting the same DOM property config twice, or you may be ' +
'injecting two configs that have conflicting property names.',
propName
) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
DOMProperty.isStandardName[propName] = true;
var lowerCased = propName.toLowerCase();
DOMProperty.getPossibleStandardName[lowerCased] = propName;
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
DOMProperty.getPossibleStandardName[attributeName] = propName;
DOMProperty.getAttributeName[propName] = attributeName;
} else {
DOMProperty.getAttributeName[propName] = lowerCased;
}
DOMProperty.getPropertyName[propName] =
DOMPropertyNames.hasOwnProperty(propName) ?
DOMPropertyNames[propName] :
propName;
if (DOMMutationMethods.hasOwnProperty(propName)) {
DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
} else {
DOMProperty.getMutationMethod[propName] = null;
}
var propConfig = Properties[propName];
DOMProperty.mustUseAttribute[propName] =
checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
DOMProperty.mustUseProperty[propName] =
checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
DOMProperty.hasSideEffects[propName] =
checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
DOMProperty.hasBooleanValue[propName] =
checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
DOMProperty.hasNumericValue[propName] =
checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
DOMProperty.hasPositiveNumericValue[propName] =
checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
DOMProperty.hasOverloadedBooleanValue[propName] =
checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
("production" !== "development" ? invariant(
!DOMProperty.mustUseAttribute[propName] ||
!DOMProperty.mustUseProperty[propName],
'DOMProperty: Cannot require using both attribute and property: %s',
propName
) : invariant(!DOMProperty.mustUseAttribute[propName] ||
!DOMProperty.mustUseProperty[propName]));
("production" !== "development" ? invariant(
DOMProperty.mustUseProperty[propName] ||
!DOMProperty.hasSideEffects[propName],
'DOMProperty: Properties that have side effects must use property: %s',
propName
) : invariant(DOMProperty.mustUseProperty[propName] ||
!DOMProperty.hasSideEffects[propName]));
("production" !== "development" ? invariant(
!!DOMProperty.hasBooleanValue[propName] +
!!DOMProperty.hasNumericValue[propName] +
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
'numeric value, but not a combination: %s',
propName
) : invariant(!!DOMProperty.hasBooleanValue[propName] +
!!DOMProperty.hasNumericValue[propName] +
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
}
}
};
var defaultValueCache = {};
/**
* 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',
/**
* Checks whether a property name is a standard property.
* @type {Object}
*/
isStandardName: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties.
* @type {Object}
*/
getPossibleStandardName: {},
/**
* Mapping from normalized names to attribute names that differ. Attribute
* names are used when rendering markup or with `*Attribute()`.
* @type {Object}
*/
getAttributeName: {},
/**
* Mapping from normalized names to properties on DOM node instances.
* (This includes properties that mutate due to external factors.)
* @type {Object}
*/
getPropertyName: {},
/**
* Mapping from normalized names to mutation methods. This will only exist if
* mutation cannot be set simply by the property or `setAttribute()`.
* @type {Object}
*/
getMutationMethod: {},
/**
* Whether the property must be accessed and mutated as an object property.
* @type {Object}
*/
mustUseAttribute: {},
/**
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* @type {Object}
*/
mustUseProperty: {},
/**
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. We must ensure that
* the value is only set if it has changed.
* @type {Object}
*/
hasSideEffects: {},
/**
* Whether the property should be removed when set to a falsey value.
* @type {Object}
*/
hasBooleanValue: {},
/**
* Whether the property must be numeric or parse as a
* numeric and should be removed when set to a falsey value.
* @type {Object}
*/
hasNumericValue: {},
/**
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
* @type {Object}
*/
hasPositiveNumericValue: {},
/**
* 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.
* @type {Object}
*/
hasOverloadedBooleanValue: {},
/**
* All of the isCustomAttribute() functions that have been injected.
*/
_isCustomAttributeFunctions: [],
/**
* Checks whether a property name is a custom attribute.
* @method
*/
isCustomAttribute: function(attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
return true;
}
}
return false;
},
/**
* Returns the default property value for a DOM property (i.e., not an
* attribute). Most default values are '' or false, but not all. Worse yet,
* some (in particular, `type`) vary depending on the type of element.
*
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
getDefaultValueForProperty: function(nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
defaultValueCache[nodeName] = nodeDefaults = {};
}
if (!(prop in nodeDefaults)) {
testElement = document.createElement(nodeName);
nodeDefaults[prop] = testElement[prop];
}
return nodeDefaults[prop];
},
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
},{}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule DOMPropertyOperations
* @typechecks static-only
*/
'use strict';
var DOMProperty = _dereq_(11);
var quoteAttributeValueForBrowser = _dereq_(163);
var warning = _dereq_(171);
function shouldIgnoreValue(name, value) {
return value == null ||
(DOMProperty.hasBooleanValue[name] && !value) ||
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
(DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
(DOMProperty.hasOverloadedBooleanValue[name] && value === false);
}
if ("production" !== "development") {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true
};
var warnedProperties = {};
var warnUnknownProperty = function(name) {
if (reactProps.hasOwnProperty(name) && reactProps[name] ||
warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = (
DOMProperty.isCustomAttribute(lowerCasedName) ?
lowerCasedName :
DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
DOMProperty.getPossibleStandardName[lowerCasedName] :
null
);
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
("production" !== "development" ? warning(
standardName == null,
'Unknown DOM property %s. Did you mean %s?',
name,
standardName
) : null);
};
}
/**
* 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(id) {
return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
quoteAttributeValueForBrowser(id);
},
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function(name, value) {
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
DOMProperty.isStandardName[name]) {
if (shouldIgnoreValue(name, value)) {
return '';
}
var attributeName = DOMProperty.getAttributeName[name];
if (DOMProperty.hasBooleanValue[name] ||
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
return attributeName;
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
} else if ("production" !== "development") {
warnUnknownProperty(name);
}
return null;
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function(node, name, value) {
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
DOMProperty.isStandardName[name]) {
var mutationMethod = DOMProperty.getMutationMethod[name];
if (mutationMethod) {
mutationMethod(node, value);
} else if (shouldIgnoreValue(name, value)) {
this.deleteValueForProperty(node, name);
} else if (DOMProperty.mustUseAttribute[name]) {
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
} else {
var propName = DOMProperty.getPropertyName[name];
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!DOMProperty.hasSideEffects[name] ||
('' + node[propName]) !== ('' + value)) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
} else if ("production" !== "development") {
warnUnknownProperty(name);
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function(node, name) {
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
DOMProperty.isStandardName[name]) {
var mutationMethod = DOMProperty.getMutationMethod[name];
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (DOMProperty.mustUseAttribute[name]) {
node.removeAttribute(DOMProperty.getAttributeName[name]);
} else {
var propName = DOMProperty.getPropertyName[name];
var defaultValue = DOMProperty.getDefaultValueForProperty(
node.nodeName,
propName
);
if (!DOMProperty.hasSideEffects[name] ||
('' + node[propName]) !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
} else if ("production" !== "development") {
warnUnknownProperty(name);
}
}
};
module.exports = DOMPropertyOperations;
},{}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule Danger
* @typechecks static-only
*/
/*jslint evil: true, sub: true */
'use strict';
var ExecutionEnvironment = _dereq_(22);
var createNodesFromMarkup = _dereq_(126);
var emptyFunction = _dereq_(129);
var getMarkupWrap = _dereq_(142);
var invariant = _dereq_(150);
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function(markupList) {
("production" !== "development" ? invariant(
ExecutionEnvironment.canUseDOM,
'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
'thread. Make sure `window` and `document` are available globally ' +
'before requiring React when unit testing or use ' +
'React.renderToString for server rendering.'
) : invariant(ExecutionEnvironment.canUseDOM));
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
("production" !== "development" ? invariant(
markupList[i],
'dangerouslyRenderMarkup(...): Missing markup.'
) : invariant(markupList[i]));
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
var resultIndex;
for (resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(
OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
);
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(
markupListByNodeName.join(''),
emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
if (renderNode.hasAttribute &&
renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
("production" !== "development" ? invariant(
!resultList.hasOwnProperty(resultIndex),
'Danger: Assigning to an already-occupied result index.'
) : invariant(!resultList.hasOwnProperty(resultIndex)));
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if ("production" !== "development") {
console.error(
'Danger: Discarding unexpected node:',
renderNode
);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
("production" !== "development" ? invariant(
resultListAssignmentCount === resultList.length,
'Danger: Did not assign to every index of resultList.'
) : invariant(resultListAssignmentCount === resultList.length));
("production" !== "development" ? invariant(
resultList.length === markupList.length,
'Danger: Expected markup to render %s nodes, but rendered %s.',
markupList.length,
resultList.length
) : invariant(resultList.length === markupList.length));
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
("production" !== "development" ? invariant(
ExecutionEnvironment.canUseDOM,
'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
'worker thread. Make sure `window` and `document` are available ' +
'globally before requiring React when unit testing or use ' +
'React.renderToString for server rendering.'
) : invariant(ExecutionEnvironment.canUseDOM));
("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
("production" !== "development" ? invariant(
oldChild.tagName.toLowerCase() !== 'html',
'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
'<html> node. This is because browser quirks make this unreliable ' +
'and/or slow. If you want to render to the root you must use ' +
'server rendering. See React.renderToString().'
) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
},{}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule DefaultEventPluginOrder
*/
'use strict';
var keyOf = _dereq_(157);
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = [
keyOf({ResponderEventPlugin: null}),
keyOf({SimpleEventPlugin: null}),
keyOf({TapEventPlugin: null}),
keyOf({EnterLeaveEventPlugin: null}),
keyOf({ChangeEventPlugin: null}),
keyOf({SelectEventPlugin: null}),
keyOf({BeforeInputEventPlugin: null}),
keyOf({AnalyticsEventPlugin: null}),
keyOf({MobileSafariClickEventPlugin: null})
];
module.exports = DefaultEventPluginOrder;
},{}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule EnterLeaveEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPropagators = _dereq_(21);
var SyntheticMouseEvent = _dereq_(112);
var ReactMount = _dereq_(77);
var keyOf = _dereq_(157);
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
registrationName: keyOf({onMouseEnter: null}),
dependencies: [
topLevelTypes.topMouseOut,
topLevelTypes.topMouseOver
]
},
mouseLeave: {
registrationName: keyOf({onMouseLeave: null}),
dependencies: [
topLevelTypes.topMouseOut,
topLevelTypes.topMouseOver
]
}
};
var extractedEvents = [null, null];
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
if (topLevelType === topLevelTypes.topMouseOver &&
(nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== topLevelTypes.topMouseOut &&
topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var win;
if (topLevelTarget.window === topLevelTarget) {
// `topLevelTarget` is probably a window object.
win = topLevelTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = topLevelTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
var from, to;
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
to =
getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
win;
} else {
from = win;
to = topLevelTarget;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var fromID = from ? ReactMount.getID(from) : '';
var toID = to ? ReactMount.getID(to) : '';
var leave = SyntheticMouseEvent.getPooled(
eventTypes.mouseLeave,
fromID,
nativeEvent
);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
var enter = SyntheticMouseEvent.getPooled(
eventTypes.mouseEnter,
toID,
nativeEvent
);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
extractedEvents[0] = leave;
extractedEvents[1] = enter;
return extractedEvents;
}
};
module.exports = EnterLeaveEventPlugin;
},{}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule EventConstants
*/
'use strict';
var keyMirror = _dereq_(156);
var PropagationPhases = keyMirror({bubbled: null, captured: null});
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
topBlur: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
topCompositionStart: null,
topCompositionUpdate: null,
topContextMenu: null,
topCopy: null,
topCut: null,
topDoubleClick: null,
topDrag: null,
topDragEnd: null,
topDragEnter: null,
topDragExit: null,
topDragLeave: null,
topDragOver: null,
topDragStart: null,
topDrop: null,
topError: null,
topFocus: null,
topInput: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
topLoad: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
topReset: null,
topScroll: null,
topSelectionChange: null,
topSubmit: null,
topTextInput: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
topWheel: null
});
var EventConstants = {
topLevelTypes: topLevelTypes,
PropagationPhases: PropagationPhases
};
module.exports = EventConstants;
},{}],17:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventListener
* @typechecks
*/
var emptyFunction = _dereq_(129);
/**
* 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(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function() {
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(target, eventType, callback) {
if (!target.addEventListener) {
if ("production" !== "development") {
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
};
} else {
target.addEventListener(eventType, callback, true);
return {
remove: function() {
target.removeEventListener(eventType, callback, true);
}
};
}
},
registerDefault: function() {}
};
module.exports = EventListener;
},{}],18:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule EventPluginHub
*/
'use strict';
var EventPluginRegistry = _dereq_(19);
var EventPluginUtils = _dereq_(20);
var accumulateInto = _dereq_(118);
var forEachAccumulated = _dereq_(135);
var invariant = _dereq_(150);
/**
* 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.
* @private
*/
var executeDispatchesAndRelease = function(event) {
if (event) {
var executeDispatch = EventPluginUtils.executeDispatch;
// Plugins can provide custom behavior when dispatching events.
var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
if (PluginModule && PluginModule.executeDispatch) {
executeDispatch = PluginModule.executeDispatch;
}
EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
* hierarchy given ids of the logical DOM elements involved.
*/
var InstanceHandle = null;
function validateInstanceHandle() {
var valid =
InstanceHandle &&
InstanceHandle.traverseTwoPhase &&
InstanceHandle.traverseEnterLeave;
("production" !== "development" ? invariant(
valid,
'InstanceHandle not injected before use!'
) : invariant(valid));
}
/**
* 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 {object} InjectedMount
* @public
*/
injectMount: EventPluginUtils.injection.injectMount,
/**
* @param {object} InjectedInstanceHandle
* @public
*/
injectInstanceHandle: function(InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
if ("production" !== "development") {
validateInstanceHandle();
}
},
getInstanceHandle: function() {
if ("production" !== "development") {
validateInstanceHandle();
}
return InstanceHandle;
},
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
registrationNameModules: EventPluginRegistry.registrationNameModules,
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
putListener: function(id, registrationName, listener) {
("production" !== "development" ? invariant(
!listener || typeof listener === 'function',
'Expected %s listener to be a function, instead got type %s',
registrationName, typeof listener
) : invariant(!listener || typeof listener === 'function'));
var bankForRegistrationName =
listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
},
/**
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function(id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
/**
* Deletes a listener from the registration bank.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function(id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {string} id ID of the DOM element.
*/
deleteAllListeners: function(id) {
for (var registrationName in listenerBank) {
delete listenerBank[registrationName][id];
}
},
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0, l = plugins.length; i < l; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
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(events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function() {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
("production" !== "development" ? invariant(
!eventQueue,
'processEventQueue(): Additional events were enqueued while processing ' +
'an event queue. Support for this has not yet been implemented.'
) : invariant(!eventQueue));
},
/**
* These are needed for tests only. Do not use!
*/
__purge: function() {
listenerBank = {};
},
__getListenerBank: function() {
return listenerBank;
}
};
module.exports = EventPluginHub;
},{}],19:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule EventPluginRegistry
* @typechecks static-only
*/
'use strict';
var invariant = _dereq_(150);
/**
* 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);
("production" !== "development" ? invariant(
pluginIndex > -1,
'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
'the plugin ordering, `%s`.',
pluginName
) : invariant(pluginIndex > -1));
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
("production" !== "development" ? invariant(
PluginModule.extractEvents,
'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
'method, but `%s` does not.',
pluginName
) : invariant(PluginModule.extractEvents));
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
("production" !== "development" ? invariant(
publishEventForPlugin(
publishedEvents[eventName],
PluginModule,
eventName
),
'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
eventName,
pluginName
) : invariant(publishEventForPlugin(
publishedEvents[eventName],
PluginModule,
eventName
)));
}
}
}
/**
* 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) {
("production" !== "development" ? invariant(
!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
'EventPluginHub: More than one plugin attempted to publish the same ' +
'event name, `%s`.',
eventName
) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
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) {
("production" !== "development" ? invariant(
!EventPluginRegistry.registrationNameModules[registrationName],
'EventPluginHub: More than one plugin attempted to publish the same ' +
'registration name, `%s`.',
registrationName
) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] =
PluginModule.eventTypes[eventName].dependencies;
}
/**
* 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: {},
/**
* 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(InjectedEventPluginOrder) {
("production" !== "development" ? invariant(
!EventPluginOrder,
'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
'once. You are likely trying to load more than one copy of React.'
) : invariant(!EventPluginOrder));
// 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(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) {
("production" !== "development" ? invariant(
!namesToPlugins[pluginName],
'EventPluginRegistry: Cannot inject two different event plugins ' +
'using the same name, `%s`.',
pluginName
) : invariant(!namesToPlugins[pluginName]));
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(event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNameModules[
dispatchConfig.registrationName
] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[
dispatchConfig.phasedRegistrationNames[phase]
];
if (PluginModule) {
return PluginModule;
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function() {
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];
}
}
}
};
module.exports = EventPluginRegistry;
},{}],20:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule EventPluginUtils
*/
'use strict';
var EventConstants = _dereq_(16);
var invariant = _dereq_(150);
/**
* Injected dependencies:
*/
/**
* - `Mount`: [required] Module that can convert between React dom IDs and
* actual node references.
*/
var injection = {
Mount: null,
injectMount: function(InjectedMount) {
injection.Mount = InjectedMount;
if ("production" !== "development") {
("production" !== "development" ? invariant(
InjectedMount && InjectedMount.getNode,
'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
'is missing getNode.'
) : invariant(InjectedMount && InjectedMount.getNode));
}
}
};
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
return topLevelType === topLevelTypes.topMouseUp ||
topLevelType === topLevelTypes.topTouchEnd ||
topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
return topLevelType === topLevelTypes.topMouseMove ||
topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
return topLevelType === topLevelTypes.topMouseDown ||
topLevelType === topLevelTypes.topTouchStart;
}
var validateEventDispatches;
if ("production" !== "development") {
validateEventDispatches = function(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ?
dispatchListeners.length :
dispatchListeners ? 1 : 0;
("production" !== "development" ? invariant(
idsIsArr === listenersIsArr && IDsLen === listenersLen,
'EventPluginUtils: Invalid `event`.'
) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
};
}
/**
* Invokes `cb(event, listener, id)`. Avoids using call if no scope is
* provided. The `(listener,id)` pair effectively forms the "dispatch" but are
* kept separate to conserve memory.
*/
function forEachEventDispatch(event, cb) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if ("production" !== "development") {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
cb(event, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
cb(event, dispatchListeners, dispatchIDs);
}
}
/**
* Default implementation of PluginModule.executeDispatch().
* @param {SyntheticEvent} SyntheticEvent to handle
* @param {function} Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, listener, domID) {
event.currentTarget = injection.Mount.getNode(domID);
var returnValue = listener(event, domID);
event.currentTarget = null;
return returnValue;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, cb) {
forEachEventDispatch(event, cb);
event._dispatchListeners = null;
event._dispatchIDs = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return 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 dispatchIDs = event._dispatchIDs;
if ("production" !== "development") {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchIDs[i])) {
return dispatchIDs[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchIDs)) {
return dispatchIDs;
}
}
return null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
event._dispatchIDs = 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 ("production" !== "development") {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
("production" !== "development" ? invariant(
!Array.isArray(dispatchListener),
'executeDirectDispatch(...): Invalid `event`.'
) : invariant(!Array.isArray(dispatchListener)));
var res = dispatchListener ?
dispatchListener(event, dispatchID) :
null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {bool} 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,
executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
injection: injection,
useTouchEvents: false
};
module.exports = EventPluginUtils;
},{}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule EventPropagators
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPluginHub = _dereq_(18);
var accumulateInto = _dereq_(118);
var forEachAccumulated = _dereq_(135);
var PropagationPhases = EventConstants.PropagationPhases;
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(id, event, propagationPhase) {
var registrationName =
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, 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(domID, upwards, event) {
if ("production" !== "development") {
if (!domID) {
throw new Error('Dispatching id must not be null');
}
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
event._dispatchListeners =
accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
/**
* 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 can not 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) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
event.dispatchMarker,
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(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners =
accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event.dispatchMarker, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
fromID,
toID,
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,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
},{}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ExecutionEnvironment
*/
/*jslint evil: true */
"use strict";
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;
},{}],23:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule FallbackCompositionState
* @typechecks static-only
*/
'use strict';
var PooledClass = _dereq_(30);
var assign = _dereq_(29);
var getTextContentAccessor = _dereq_(145);
/**
* This helper class stores information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Identify the node where selection currently begins, then observe
* both its text content and its current position in the DOM. Since the
* browser may natively replace the target node during composition, we can
* use its position to find its replacement.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this._root = root;
this._startText = this.getText();
this._fallbackText = null;
}
assign(FallbackCompositionState.prototype, {
/**
* Get current text of input.
*
* @return {string}
*/
getText: function() {
if ('value' in this._root) {
return this._root.value;
}
return this._root[getTextContentAccessor()];
},
/**
* Determine the differing substring between the initially stored
* text content and the current content.
*
* @return {string}
*/
getData: function() {
if (this._fallbackText) {
return this._fallbackText;
}
var start;
var startValue = this._startText;
var startLength = startValue.length;
var end;
var endValue = this.getText();
var endLength = endValue.length;
for (start = 0; start < startLength; start++) {
if (startValue[start] !== endValue[start]) {
break;
}
}
var minEnd = startLength - start;
for (end = 1; end <= minEnd; end++) {
if (startValue[startLength - end] !== endValue[endLength - end]) {
break;
}
}
var sliceTail = end > 1 ? 1 - end : undefined;
this._fallbackText = endValue.slice(start, sliceTail);
return this._fallbackText;
}
});
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
},{}],24:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule HTMLDOMPropertyConfig
*/
/*jslint bitwise: true*/
'use strict';
var DOMProperty = _dereq_(11);
var ExecutionEnvironment = _dereq_(22);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE =
DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE =
DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
hasSVG = (
implementation &&
implementation.hasFeature &&
implementation.hasFeature(
'http://www.w3.org/TR/SVG11/feature#BasicStructure',
'1.1'
)
);
}
var HTMLDOMPropertyConfig = {
isCustomAttribute: RegExp.prototype.test.bind(
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
),
Properties: {
/**
* Standard Properties
*/
accept: null,
acceptCharset: null,
accessKey: null,
action: null,
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
allowTransparency: MUST_USE_ATTRIBUTE,
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
// autoFocus is polyfilled/normalized by AutoFocusMixin
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
// this works on HTML elements too in all browsers except IE8. Conveniently,
// IE8 doesn't support SVG and so we can simply use the attribute in
// browsers that support SVG and the property in browsers that don't,
// regardless of whether the element is HTML or SVG.
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
colSpan: null,
content: null,
contentEditable: null,
contextMenu: MUST_USE_ATTRIBUTE,
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
coords: null,
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
download: HAS_OVERLOADED_BOOLEAN_VALUE,
draggable: null,
encType: null,
form: MUST_USE_ATTRIBUTE,
formAction: MUST_USE_ATTRIBUTE,
formEncType: MUST_USE_ATTRIBUTE,
formMethod: MUST_USE_ATTRIBUTE,
formNoValidate: HAS_BOOLEAN_VALUE,
formTarget: MUST_USE_ATTRIBUTE,
frameBorder: MUST_USE_ATTRIBUTE,
headers: null,
height: MUST_USE_ATTRIBUTE,
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
href: null,
hrefLang: null,
htmlFor: null,
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
manifest: MUST_USE_ATTRIBUTE,
marginHeight: null,
marginWidth: null,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
media: MUST_USE_ATTRIBUTE,
mediaGroup: null,
method: null,
min: null,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
pattern: null,
placeholder: null,
poster: null,
preload: null,
radioGroup: null,
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
sandbox: null,
scope: null,
scrolling: null,
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
shape: null,
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
sizes: MUST_USE_ATTRIBUTE,
span: HAS_POSITIVE_NUMERIC_VALUE,
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
tabIndex: null,
target: null,
title: null,
type: null,
useMap: null,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
autoCapitalize: null,
autoCorrect: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
itemType: MUST_USE_ATTRIBUTE,
// itemID and itemRef are for Microdata support as well but
// only specified in the the WHATWG spec document. See
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
// property is supported for OpenGraph in meta tags.
property: null
},
DOMAttributeNames: {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
hrefLang: 'hreflang',
radioGroup: 'radiogroup',
spellCheck: 'spellcheck',
srcDoc: 'srcdoc',
srcSet: 'srcset'
}
};
module.exports = HTMLDOMPropertyConfig;
},{}],25:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule LinkedStateMixin
* @typechecks static-only
*/
'use strict';
var ReactLink = _dereq_(75);
var ReactStateSetters = _dereq_(94);
/**
* A simple mixin around ReactLink.forState().
*/
var LinkedStateMixin = {
/**
* Create a ReactLink that's linked to part of this component's state. The
* ReactLink will have the current value of this.state[key] and will call
* setState() when a change is requested.
*
* @param {string} key state key to update. Note: you may want to use keyOf()
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
linkState: function(key) {
return new ReactLink(
this.state[key],
ReactStateSetters.createStateKeySetter(this, key)
);
}
};
module.exports = LinkedStateMixin;
},{}],26:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule LinkedValueUtils
* @typechecks static-only
*/
'use strict';
var ReactPropTypes = _dereq_(86);
var invariant = _dereq_(150);
var hasReadOnlyValue = {
'button': true,
'checkbox': true,
'image': true,
'hidden': true,
'radio': true,
'reset': true,
'submit': true
};
function _assertSingleLink(input) {
("production" !== "development" ? invariant(
input.props.checkedLink == null || input.props.valueLink == null,
'Cannot provide a checkedLink and a valueLink. If you want to use ' +
'checkedLink, you probably don\'t want to use valueLink and vice versa.'
) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
}
function _assertValueLink(input) {
_assertSingleLink(input);
("production" !== "development" ? invariant(
input.props.value == null && input.props.onChange == null,
'Cannot provide a valueLink and a value or onChange event. If you want ' +
'to use value or onChange, you probably don\'t want to use valueLink.'
) : invariant(input.props.value == null && input.props.onChange == null));
}
function _assertCheckedLink(input) {
_assertSingleLink(input);
("production" !== "development" ? invariant(
input.props.checked == null && input.props.onChange == null,
'Cannot provide a checkedLink and a checked property or onChange event. ' +
'If you want to use checked or onChange, you probably don\'t want to ' +
'use checkedLink'
) : invariant(input.props.checked == null && input.props.onChange == null));
}
/**
* @param {SyntheticEvent} e change event to handle
*/
function _handleLinkedValueChange(e) {
/*jshint validthis:true */
this.props.valueLink.requestChange(e.target.value);
}
/**
* @param {SyntheticEvent} e change event to handle
*/
function _handleLinkedCheckChange(e) {
/*jshint validthis:true */
this.props.checkedLink.requestChange(e.target.checked);
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
Mixin: {
propTypes: {
value: function(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(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: ReactPropTypes.func
}
},
/**
* @param {ReactComponent} input Form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function(input) {
if (input.props.valueLink) {
_assertValueLink(input);
return input.props.valueLink.value;
}
return input.props.value;
},
/**
* @param {ReactComponent} input Form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function(input) {
if (input.props.checkedLink) {
_assertCheckedLink(input);
return input.props.checkedLink.value;
}
return input.props.checked;
},
/**
* @param {ReactComponent} input Form component
* @return {function} change callback either from onChange prop or link.
*/
getOnChange: function(input) {
if (input.props.valueLink) {
_assertValueLink(input);
return _handleLinkedValueChange;
} else if (input.props.checkedLink) {
_assertCheckedLink(input);
return _handleLinkedCheckChange;
}
return input.props.onChange;
}
};
module.exports = LinkedValueUtils;
},{}],27:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule LocalEventTrapMixin
*/
'use strict';
var ReactBrowserEventEmitter = _dereq_(33);
var accumulateInto = _dereq_(118);
var forEachAccumulated = _dereq_(135);
var invariant = _dereq_(150);
function remove(event) {
event.remove();
}
var LocalEventTrapMixin = {
trapBubbledEvent:function(topLevelType, handlerBaseName) {
("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
// If a component renders to null or if another component fatals and causes
// the state of the tree to be corrupted, `node` here can be null.
var node = this.getDOMNode();
("production" !== "development" ? invariant(
node,
'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
) : invariant(node));
var listener = ReactBrowserEventEmitter.trapBubbledEvent(
topLevelType,
handlerBaseName,
node
);
this._localEventListeners =
accumulateInto(this._localEventListeners, listener);
},
// trapCapturedEvent would look nearly identical. We don't implement that
// method because it isn't currently needed.
componentWillUnmount:function() {
if (this._localEventListeners) {
forEachAccumulated(this._localEventListeners, remove);
}
}
};
module.exports = LocalEventTrapMixin;
},{}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule MobileSafariClickEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(16);
var emptyFunction = _dereq_(129);
var topLevelTypes = EventConstants.topLevelTypes;
/**
* Mobile Safari does not fire properly bubble click events on non-interactive
* elements, which means delegated click listeners do not fire. The workaround
* for this bug involves attaching an empty click listener on the target node.
*
* This particular plugin works around the bug by attaching an empty click
* listener on `touchstart` (which does fire on every element).
*/
var MobileSafariClickEventPlugin = {
eventTypes: null,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
if (topLevelType === topLevelTypes.topTouchStart) {
var target = nativeEvent.target;
if (target && !target.onclick) {
target.onclick = emptyFunction;
}
}
}
};
module.exports = MobileSafariClickEventPlugin;
},{}],29:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule Object.assign
*/
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
'use strict';
function assign(target, sources) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
var to = Object(target);
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
var nextSource = arguments[nextIndex];
if (nextSource == null) {
continue;
}
var from = Object(nextSource);
// We don't currently support accessors nor proxies. Therefore this
// copy cannot throw. If we ever supported this then we must handle
// exceptions and side-effects. We don't support symbols so they won't
// be transferred.
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
}
return to;
}
module.exports = assign;
},{}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule PooledClass
*/
'use strict';
var invariant = _dereq_(150);
/**
* 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(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(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(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 fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function(instance) {
var Klass = this;
("production" !== "development" ? invariant(
instance instanceof Klass,
'Trying to release an instance into a pool of a different type.'
) : invariant(instance instanceof Klass));
if (instance.destructor) {
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 (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function(CopyConstructor, pooler) {
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,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
},{}],31:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule React
*/
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
'use strict';
var EventPluginUtils = _dereq_(20);
var ReactChildren = _dereq_(37);
var ReactComponent = _dereq_(39);
var ReactClass = _dereq_(38);
var ReactContext = _dereq_(44);
var ReactCurrentOwner = _dereq_(45);
var ReactElement = _dereq_(63);
var ReactElementValidator = _dereq_(64);
var ReactDOM = _dereq_(46);
var ReactDOMTextComponent = _dereq_(57);
var ReactDefaultInjection = _dereq_(60);
var ReactInstanceHandles = _dereq_(72);
var ReactMount = _dereq_(77);
var ReactPerf = _dereq_(82);
var ReactPropTypes = _dereq_(86);
var ReactReconciler = _dereq_(89);
var ReactServerRendering = _dereq_(92);
var assign = _dereq_(29);
var findDOMNode = _dereq_(132);
var onlyChild = _dereq_(160);
ReactDefaultInjection.inject();
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
if ("production" !== "development") {
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
}
var render = ReactPerf.measure('React', 'render', ReactMount.render);
var React = {
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
only: onlyChild
},
Component: ReactComponent,
DOM: ReactDOM,
PropTypes: ReactPropTypes,
initializeTouchEvents: function(shouldUseTouch) {
EventPluginUtils.useTouchEvents = shouldUseTouch;
},
createClass: ReactClass.createClass,
createElement: createElement,
createFactory: createFactory,
createMixin: function(mixin) {
// Currently a noop. Will be used to validate and trace mixins.
return mixin;
},
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
findDOMNode: findDOMNode,
render: render,
renderToString: ReactServerRendering.renderToString,
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
isValidElement: ReactElement.isValidElement,
withContext: ReactContext.withContext,
// Hook for JSX spread, don't use this for anything else.
__spread: assign
};
// Inject the runtime into a devtools global hook regardless of browser.
// Allows for debugging when the hook is injected on the page.
if (
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
CurrentOwner: ReactCurrentOwner,
InstanceHandles: ReactInstanceHandles,
Mount: ReactMount,
Reconciler: ReactReconciler,
TextComponent: ReactDOMTextComponent
});
}
if ("production" !== "development") {
var ExecutionEnvironment = _dereq_(22);
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
// If we're in Chrome, look for the devtools marker and provide a download
// link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1) {
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
console.debug(
'Download the React DevTools for a better development experience: ' +
'http://fb.me/react-devtools'
);
}
}
var expectedFeatures = [
// shims
Array.isArray,
Array.prototype.every,
Array.prototype.forEach,
Array.prototype.indexOf,
Array.prototype.map,
Date.now,
Function.prototype.bind,
Object.keys,
String.prototype.split,
String.prototype.trim,
// shams
Object.create,
Object.freeze
];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
console.error(
'One or more ES5 shim/shams expected by React are not available: ' +
'http://fb.me/react-warning-polyfills'
);
break;
}
}
}
}
React.version = '0.13.0-beta.2';
module.exports = React;
},{}],32:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactBrowserComponentMixin
*/
'use strict';
var findDOMNode = _dereq_(132);
var ReactBrowserComponentMixin = {
/**
* Returns the DOM node rendered by this component.
*
* @return {DOMElement} The root node of this component.
* @final
* @protected
*/
getDOMNode: function() {
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
},{}],33:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactBrowserEventEmitter
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPluginHub = _dereq_(18);
var EventPluginRegistry = _dereq_(19);
var ReactEventEmitterMixin = _dereq_(67);
var ViewportMetrics = _dereq_(117);
var assign = _dereq_(29);
var isEventSupported = _dereq_(151);
/**
* 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 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 = {
topBlur: 'blur',
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',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
topScroll: 'scroll',
topSelectionChange: 'selectionchange',
topTextInput: 'textInput',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
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:
*
* ReactBrowserEventEmitter.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(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(enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function() {
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(registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
var dependencies = EventPluginRegistry.
registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
for (var i = 0, l = dependencies.length; i < l; i++) {
var dependency = dependencies[i];
if (!(
(isListening.hasOwnProperty(dependency) && isListening[dependency])
)) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topWheel,
'wheel',
mountAt
);
} else if (isEventSupported('mousewheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.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(
topLevelTypes.topWheel,
'DOMMouseScroll',
mountAt
);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.topScroll,
'scroll',
mountAt
);
} else {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topScroll,
'scroll',
ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
);
}
} else if (dependency === topLevelTypes.topFocus ||
dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.topFocus,
'focus',
mountAt
);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.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(
topLevelTypes.topFocus,
'focusin',
mountAt
);
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topBlur,
'focusout',
mountAt
);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
dependency,
topEventMapping[dependency],
mountAt
);
}
isListening[dependency] = true;
}
}
},
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelType,
handlerBaseName,
handle
);
},
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelType,
handlerBaseName,
handle
);
},
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function() {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
},
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
registrationNameModules: EventPluginHub.registrationNameModules,
putListener: EventPluginHub.putListener,
getListener: EventPluginHub.getListener,
deleteListener: EventPluginHub.deleteListener,
deleteAllListeners: EventPluginHub.deleteAllListeners
});
module.exports = ReactBrowserEventEmitter;
},{}],34:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @typechecks
* @providesModule ReactCSSTransitionGroup
*/
'use strict';
var React = _dereq_(31);
var assign = _dereq_(29);
var ReactTransitionGroup = React.createFactory(
_dereq_(98)
);
var ReactCSSTransitionGroupChild = React.createFactory(
_dereq_(35)
);
var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
transitionName: React.PropTypes.string.isRequired,
transitionAppear: React.PropTypes.bool,
transitionEnter: React.PropTypes.bool,
transitionLeave: React.PropTypes.bool
},
getDefaultProps: function() {
return {
transitionAppear: false,
transitionEnter: true,
transitionLeave: true
};
},
_wrapChild: function(child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// leave while it is leaving.
return ReactCSSTransitionGroupChild(
{
name: this.props.transitionName,
appear: this.props.transitionAppear,
enter: this.props.transitionEnter,
leave: this.props.transitionLeave
},
child
);
},
render: function() {
return (
ReactTransitionGroup(
assign({}, this.props, {childFactory: this._wrapChild})
)
);
}
});
module.exports = ReactCSSTransitionGroup;
},{}],35:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @typechecks
* @providesModule ReactCSSTransitionGroupChild
*/
'use strict';
var React = _dereq_(31);
var CSSCore = _dereq_(4);
var ReactTransitionEvents = _dereq_(97);
var onlyChild = _dereq_(160);
var warning = _dereq_(171);
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
var NO_EVENT_TIMEOUT = 5000;
var noEventListener = null;
if ("production" !== "development") {
noEventListener = function() {
("production" !== "development" ? warning(
false,
'transition(): tried to perform an animation without ' +
'an animationend or transitionend event after timeout (' +
'%sms). You should either disable this ' +
'transition in JS or add a CSS animation/transition.',
NO_EVENT_TIMEOUT
) : null);
};
}
var ReactCSSTransitionGroupChild = React.createClass({
displayName: 'ReactCSSTransitionGroupChild',
transition: function(animationType, finishCallback) {
var node = this.getDOMNode();
var className = this.props.name + '-' + animationType;
var activeClassName = className + '-active';
var noEventTimeout = null;
var endListener = function(e) {
if (e && e.target !== node) {
return;
}
if ("production" !== "development") {
clearTimeout(noEventTimeout);
}
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
ReactTransitionEvents.removeEndEventListener(node, endListener);
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
if (finishCallback) {
finishCallback();
}
};
ReactTransitionEvents.addEndEventListener(node, endListener);
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
if ("production" !== "development") {
noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
}
},
queueClass: function(className) {
this.classNameQueue.push(className);
if (!this.timeout) {
this.timeout = setTimeout(this.flushClassNameQueue, TICK);
}
},
flushClassNameQueue: function() {
if (this.isMounted()) {
this.classNameQueue.forEach(
CSSCore.addClass.bind(CSSCore, this.getDOMNode())
);
}
this.classNameQueue.length = 0;
this.timeout = null;
},
componentWillMount: function() {
this.classNameQueue = [];
},
componentWillUnmount: function() {
if (this.timeout) {
clearTimeout(this.timeout);
}
},
componentWillAppear: function(done) {
if (this.props.appear) {
this.transition('appear', done);
} else {
done();
}
},
componentWillEnter: function(done) {
if (this.props.enter) {
this.transition('enter', done);
} else {
done();
}
},
componentWillLeave: function(done) {
if (this.props.leave) {
this.transition('leave', done);
} else {
done();
}
},
render: function() {
return onlyChild(this.props.children);
}
});
module.exports = ReactCSSTransitionGroupChild;
},{}],36:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactChildReconciler
* @typechecks static-only
*/
'use strict';
var ReactReconciler = _dereq_(89);
var flattenChildren = _dereq_(133);
var instantiateReactComponent = _dereq_(149);
var shouldUpdateReactComponent = _dereq_(167);
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
* children. Its output is suitable for passing it onto ReactMultiChild which
* does diffed reordering and insertion.
*/
var ReactChildReconciler = {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildNodes Nested child maps.
* @return {?object} A set of child instances.
* @internal
*/
instantiateChildren: function(nestedChildNodes, transaction, context) {
var children = flattenChildren(nestedChildNodes);
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
// The rendered children must be turned into instances as they're
// mounted.
var childInstance = instantiateReactComponent(child, null);
children[name] = childInstance;
}
}
return children;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextNestedChildNodes Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
updateChildren: function(
prevChildren,
nextNestedChildNodes,
transaction,
context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
var nextChildren = flattenChildren(nextNestedChildNodes);
if (!nextChildren && !prevChildren) {
return null;
}
var name;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
if (shouldUpdateReactComponent(prevElement, nextElement)) {
ReactReconciler.receiveComponent(
prevChild, nextElement, transaction, context
);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(
nextElement,
null
);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
!(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
return nextChildren;
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
unmountChildren: function(renderedChildren) {
for (var name in renderedChildren) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
};
module.exports = ReactChildReconciler;
},{}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactChildren
*/
'use strict';
var PooledClass = _dereq_(30);
var ReactFragment = _dereq_(69);
var traverseAllChildren = _dereq_(169);
var warning = _dereq_(171);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var threeArgumentPooler = PooledClass.threeArgumentPooler;
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.forEachFunction = forEachFunction;
this.forEachContext = forEachContext;
}
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(traverseContext, child, name, i) {
var forEachBookKeeping = traverseContext;
forEachBookKeeping.forEachFunction.call(
forEachBookKeeping.forEachContext, child, i);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc.
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext =
ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, mapFunction, mapContext) {
this.mapResult = mapResult;
this.mapFunction = mapFunction;
this.mapContext = mapContext;
}
PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
function mapSingleChildIntoContext(traverseContext, child, name, i) {
var mapBookKeeping = traverseContext;
var mapResult = mapBookKeeping.mapResult;
var keyUnique = !mapResult.hasOwnProperty(name);
if ("production" !== "development") {
("production" !== "development" ? warning(
keyUnique,
'ReactChildren.map(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
) : null);
}
if (keyUnique) {
var mappedChild =
mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
mapResult[name] = mappedChild;
}
}
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* TODO: This may likely break any calls to `ReactChildren.map` that were
* previously relying on the fact that we guarded against null children.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} mapFunction.
* @param {*} mapContext Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var mapResult = {};
var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
return ReactFragment.create(mapResult);
}
function forEachSingleChildDummy(traverseContext, child, name, i) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
count: countChildren
};
module.exports = ReactChildren;
},{}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactClass
*/
'use strict';
var ReactComponent = _dereq_(39);
var ReactElement = _dereq_(63);
var ReactErrorUtils = _dereq_(66);
var ReactInstanceMap = _dereq_(73);
var ReactLifeCycle = _dereq_(74);
var ReactPropTypeLocations = _dereq_(85);
var ReactPropTypeLocationNames = _dereq_(84);
var ReactUpdateQueue = _dereq_(99);
var assign = _dereq_(29);
var invariant = _dereq_(150);
var keyMirror = _dereq_(156);
var keyOf = _dereq_(157);
var warning = _dereq_(171);
var MIXINS_KEY = keyOf({mixins: null});
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var SpecPolicy = keyMirror({
/**
* These methods may be defined only once by the class specification or mixin.
*/
DEFINE_ONCE: null,
/**
* These methods may be defined by both the class specification and mixins.
* Subsequent definitions will be chained. These methods must return void.
*/
DEFINE_MANY: null,
/**
* These methods are overriding the base class.
*/
OVERRIDE_BASE: null,
/**
* These methods are similar to DEFINE_MANY, except we assume they return
* objects. We try to merge the keys of the return values of all the mixed in
* functions. If there is a key conflict we throw.
*/
DEFINE_MANY_MERGED: null
});
var injectedMixins = [];
/**
* Composite components are higher-level components that compose other composite
* or native 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 available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: SpecPolicy.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: SpecPolicy.DEFINE_MANY,
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: SpecPolicy.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: SpecPolicy.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: SpecPolicy.DEFINE_MANY_MERGED,
/**
* @return {object}
* @optional
*/
getChildContext: SpecPolicy.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}
* @nosideeffects
* @required
*/
render: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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(Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function(Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function(Constructor, childContextTypes) {
if ("production" !== "development") {
validateTypeDef(
Constructor,
childContextTypes,
ReactPropTypeLocations.childContext
);
}
Constructor.childContextTypes = assign(
{},
Constructor.childContextTypes,
childContextTypes
);
},
contextTypes: function(Constructor, contextTypes) {
if ("production" !== "development") {
validateTypeDef(
Constructor,
contextTypes,
ReactPropTypeLocations.context
);
}
Constructor.contextTypes = assign(
{},
Constructor.contextTypes,
contextTypes
);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function(Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(
Constructor.getDefaultProps,
getDefaultProps
);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function(Constructor, propTypes) {
if ("production" !== "development") {
validateTypeDef(
Constructor,
propTypes,
ReactPropTypeLocations.prop
);
}
Constructor.propTypes = assign(
{},
Constructor.propTypes,
propTypes
);
},
statics: function(Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
}
};
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 not in __DEV__
("production" !== "development" ? 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
) : null);
}
}
}
function validateMethodOverride(proto, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
ReactClassInterface[name] :
null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
("production" !== "development" ? invariant(
specPolicy === 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
) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
("production" !== "development" ? invariant(
specPolicy === SpecPolicy.DEFINE_MANY ||
specPolicy === 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
) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
return;
}
("production" !== "development" ? invariant(
typeof spec !== 'function',
'ReactClass: You\'re attempting to ' +
'use a component class as a mixin. Instead, just use a regular object.'
) : invariant(typeof spec !== 'function'));
("production" !== "development" ? invariant(
!ReactElement.isValidElement(spec),
'ReactClass: You\'re attempting to ' +
'use a component as a mixin. Instead, just use a regular object.'
) : invariant(!ReactElement.isValidElement(spec)));
var proto = Constructor.prototype;
// 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];
validateMethodOverride(proto, 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 isAlreadyDefined = proto.hasOwnProperty(name);
var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
var shouldAutoBind =
isFunction &&
!isReactClassMethod &&
!isAlreadyDefined &&
!markedDontBind;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride
("production" !== "development" ? invariant(
isReactClassMethod && (
(specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
),
'ReactClass: Unexpected spec policy %s for key %s ' +
'when mixing in component specs.',
specPolicy,
name
) : invariant(isReactClassMethod && (
(specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
)));
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === SpecPolicy.DEFINE_MANY) {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if ("production" !== "development") {
// 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;
("production" !== "development" ? 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
) : invariant(!isReserved));
var isInherited = name in Constructor;
("production" !== "development" ? invariant(
!isInherited,
'ReactClass: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be ' +
'due to a mixin.',
name
) : invariant(!isInherited));
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) {
("production" !== "development" ? invariant(
one && two && typeof one === 'object' && typeof two === 'object',
'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
for (var key in two) {
if (two.hasOwnProperty(key)) {
("production" !== "development" ? 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
) : invariant(one[key] === undefined));
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 ("production" !== "development") {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
// 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) {
("production" !== "development" ? warning(
false,
'bind(): React component methods may only be bound to the ' +
'component instance. See %s',
componentName
) : null);
} else if (!args.length) {
("production" !== "development" ? 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 ',
componentName
) : null);
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
/* eslint-enable */
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
component[autoBindKey] = bindAutoBindMethod(
component,
ReactErrorUtils.guard(
method,
component.constructor.displayName + '.' + autoBindKey
)
);
}
}
}
var typeDeprecationDescriptor = {
enumerable: false,
get: function() {
var displayName = this.displayName || this.name || 'Component';
("production" !== "development" ? warning(
false,
'%s.type is deprecated. Use %s directly to access the class.',
displayName,
displayName
) : null);
Object.defineProperty(this, 'type', {
value: this
});
return this;
}
};
/**
* 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(newState, callback) {
ReactUpdateQueue.enqueueReplaceState(this, newState);
if (callback) {
ReactUpdateQueue.enqueueCallback(this, callback);
}
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function() {
var internalInstance = ReactInstanceMap.get(this);
return (
internalInstance &&
internalInstance !== ReactLifeCycle.currentlyMountingInstance
);
},
/**
* Sets a subset of the props.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
setProps: function(partialProps, callback) {
ReactUpdateQueue.enqueueSetProps(this, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallback(this, callback);
}
},
/**
* Replace all the props.
*
* @param {object} newProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
replaceProps: function(newProps, callback) {
ReactUpdateQueue.enqueueReplaceProps(this, newProps);
if (callback) {
ReactUpdateQueue.enqueueCallback(this, callback);
}
}
};
var ReactClassComponent = function() {};
assign(
ReactClassComponent.prototype,
ReactComponent.prototype,
ReactClassMixin
);
/**
* Module for creating composite components.
*
* @class ReactClass
*/
var ReactClass = {
/**
* Creates a composite component class given a class specification.
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function(spec) {
var Constructor = function(props, context) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
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 ("production" !== "development") {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' &&
this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
("production" !== "development" ? invariant(
typeof initialState === 'object' && !Array.isArray(initialState),
'%s.getInitialState(): must return an object or null',
Constructor.displayName || 'ReactCompositeComponent'
) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
injectedMixins.forEach(
mixSpecIntoComponent.bind(null, Constructor)
);
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if ("production" !== "development") {
// 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 = {};
}
}
("production" !== "development" ? invariant(
Constructor.prototype.render,
'createClass(...): Class specification must implement a `render` method.'
) : invariant(Constructor.prototype.render));
if ("production" !== "development") {
("production" !== "development" ? 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'
) : null);
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
// Legacy hook
Constructor.type = Constructor;
if ("production" !== "development") {
try {
Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
} catch (x) {
// IE will fail on defineProperty (es5-shim/sham too)
}
}
return Constructor;
},
injection: {
injectMixin: function(mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactClass;
},{}],39:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactComponent
*/
'use strict';
var ReactUpdateQueue = _dereq_(99);
var invariant = _dereq_(150);
var warning = _dereq_(171);
/**
* Base class helpers for the updating state of a component.
*/
function ReactComponent(props, context) {
this.props = props;
this.context = context;
}
/**
* 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) {
("production" !== "development" ? invariant(
typeof partialState === 'object' ||
typeof partialState === 'function' ||
partialState == null,
'setState(...): takes an object of state variables to update or a ' +
'function which returns an object of state variables.'
) : invariant(typeof partialState === 'object' ||
typeof partialState === 'function' ||
partialState == null));
if ("production" !== "development") {
("production" !== "development" ? warning(
partialState != null,
'setState(...): You passed an undefined or null state object; ' +
'instead, use forceUpdate().'
) : null);
}
ReactUpdateQueue.enqueueSetState(this, partialState);
if (callback) {
ReactUpdateQueue.enqueueCallback(this, 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 `shouldUpdateComponent`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
ReactComponent.prototype.forceUpdate = function(callback) {
ReactUpdateQueue.enqueueForceUpdate(this);
if (callback) {
ReactUpdateQueue.enqueueCallback(this, callback);
}
};
/**
* 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 ("production" !== "development") {
var deprecatedAPIs = {
getDOMNode: 'getDOMNode',
isMounted: 'isMounted',
replaceState: 'replaceState',
setProps: 'setProps'
};
var defineDeprecationWarning = function(methodName, displayName) {
try {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function() {
("production" !== "development" ? warning(
false,
'%s(...) is deprecated in plain JavaScript React classes.',
displayName
) : null);
return undefined;
}
});
} catch (x) {
// IE will fail on defineProperty (es5-shim/sham too)
}
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
module.exports = ReactComponent;
},{}],40:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactComponentBrowserEnvironment
*/
/*jslint evil: true */
'use strict';
var ReactDOMIDOperations = _dereq_(50);
var ReactMount = _dereq_(77);
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
* the browser context. TODO: These callers should be refactored to avoid the
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates:
ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkupByID:
ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
* specify this in the injected Mixin. In the DOM, we would likely want to
* purge any cached node ID lookups.
*
* @private
*/
unmountIDFromEnvironment: function(rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
},{}],41:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactComponentEnvironment
*/
'use strict';
var invariant = _dereq_(150);
var injected = false;
var ReactComponentEnvironment = {
/**
* Optionally injectable environment dependent cleanup hook. (server vs.
* browser etc). Example: A browser system caches DOM nodes based on component
* ID and must remove that cache entry when this instance is unmounted.
*/
unmountIDFromEnvironment: null,
/**
* Optionally injectable hook for swapping out mount images in the middle of
* the tree.
*/
replaceNodeWithMarkupByID: null,
/**
* Optionally injectable hook for processing a queue of child updates. Will
* later move into MultiChildComponents.
*/
processChildrenUpdates: null,
injection: {
injectEnvironment: function(environment) {
("production" !== "development" ? invariant(
!injected,
'ReactCompositeComponent: injectEnvironment() can only be called once.'
) : invariant(!injected));
ReactComponentEnvironment.unmountIDFromEnvironment =
environment.unmountIDFromEnvironment;
ReactComponentEnvironment.replaceNodeWithMarkupByID =
environment.replaceNodeWithMarkupByID;
ReactComponentEnvironment.processChildrenUpdates =
environment.processChildrenUpdates;
injected = true;
}
}
};
module.exports = ReactComponentEnvironment;
},{}],42:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactComponentWithPureRenderMixin
*/
'use strict';
var shallowEqual = _dereq_(166);
/**
* If your React component's render function is "pure", e.g. it will render the
* same result given the same props and state, provide this Mixin for a
* considerable performance boost.
*
* Most React components have pure render functions.
*
* Example:
*
* var ReactComponentWithPureRenderMixin =
* require('ReactComponentWithPureRenderMixin');
* React.createClass({
* mixins: [ReactComponentWithPureRenderMixin],
*
* render: function() {
* return <div className={this.props.className}>foo</div>;
* }
* });
*
* Note: This only checks shallow equality for props and state. If these contain
* complex data structures this mixin may have false-negatives for deeper
* differences. Only mixin to components which have simple props and state, or
* use `forceUpdate()` when you know deep data structures have changed.
*/
var ReactComponentWithPureRenderMixin = {
shouldComponentUpdate: function(nextProps, nextState) {
return !shallowEqual(this.props, nextProps) ||
!shallowEqual(this.state, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
},{}],43:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactCompositeComponent
*/
'use strict';
var ReactComponentEnvironment = _dereq_(41);
var ReactContext = _dereq_(44);
var ReactCurrentOwner = _dereq_(45);
var ReactElement = _dereq_(63);
var ReactElementValidator = _dereq_(64);
var ReactInstanceMap = _dereq_(73);
var ReactLifeCycle = _dereq_(74);
var ReactNativeComponent = _dereq_(80);
var ReactPerf = _dereq_(82);
var ReactPropTypeLocations = _dereq_(85);
var ReactPropTypeLocationNames = _dereq_(84);
var ReactReconciler = _dereq_(89);
var ReactUpdates = _dereq_(100);
var assign = _dereq_(29);
var emptyObject = _dereq_(130);
var invariant = _dereq_(150);
var shouldUpdateReactComponent = _dereq_(167);
var warning = _dereq_(171);
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function(element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
// See ReactUpdateQueue
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._isTopLevel = false;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function(rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
var publicContext = this._processContext(this._currentElement._context);
var Component = ReactNativeComponent.getComponentClassForElement(
this._currentElement
);
// Initialize the public class
var inst = new Component(publicProps, publicContext);
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if ("production" !== "development") {
this._warnIfContextsDiffer(this._currentElement._context, context);
}
if ("production" !== "development") {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
("production" !== "development" ? warning(
!inst.getInitialState ||
inst.getInitialState.isReactClassApproved,
'getInitialState was defined on %s, a plain JavaScript class. ' +
'This is only supported for classes created using React.createClass. ' +
'Did you mean to define a state property instead?',
this.getName() || 'a component'
) : null);
("production" !== "development" ? warning(
!inst.propTypes,
'propTypes was defined as an instance property on %s. Use a static ' +
'property to define propTypes instead.',
this.getName() || 'a component'
) : null);
("production" !== "development" ? warning(
!inst.contextTypes,
'contextTypes was defined as an instance property on %s. Use a ' +
'static property to define contextTypes instead.',
this.getName() || 'a component'
) : null);
("production" !== "development" ? warning(
typeof inst.componentShouldUpdate !== 'function',
'%s has a method called ' +
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
'The name is phrased as a question because the function is ' +
'expected to return a value.',
(this.getName() || 'A component')
) : null);
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
("production" !== "development" ? invariant(
typeof initialState === 'object' && !Array.isArray(initialState),
'%s.state: must be set to an object or null',
this.getName() || 'ReactCompositeComponent'
) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
var renderedElement;
var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
ReactLifeCycle.currentlyMountingInstance = this;
try {
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
renderedElement = this._renderValidatedComponent();
} finally {
ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
}
this._renderedComponent = this._instantiateReactComponent(
renderedElement,
this._currentElement.type // The wrapping type
);
var markup = ReactReconciler.mountComponent(
this._renderedComponent,
rootID,
transaction,
this._processChildContext(context)
);
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function() {
var inst = this._instance;
if (inst.componentWillUnmount) {
var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
ReactLifeCycle.currentlyUnmountingInstance = this;
try {
inst.componentWillUnmount();
} finally {
ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
}
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
// Reset pending fields
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Schedule a partial update to the props. Only used for internal testing.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @internal
*/
_setPropsInternal: function(partialProps, callback) {
// This is a deoptimized path. We optimize for always having an element.
// This creates an extra internal element.
var element = this._pendingElement || this._currentElement;
this._pendingElement = ReactElement.cloneAndReplaceProps(
element,
assign({}, element.props, partialProps)
);
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function(context) {
var maskedContext = null;
// This really should be getting the component class for the element,
// but we know that we're not going to need it for built-ins.
if (typeof this._currentElement.type === 'string') {
return emptyObject;
}
var contextTypes = this._currentElement.type.contextTypes;
if (!contextTypes) {
return emptyObject;
}
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function(context) {
var maskedContext = this._maskContext(context);
if ("production" !== "development") {
var Component = ReactNativeComponent.getComponentClassForElement(
this._currentElement
);
if (Component.contextTypes) {
this._checkPropTypes(
Component.contextTypes,
maskedContext,
ReactPropTypeLocations.context
);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function(currentContext) {
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
("production" !== "development" ? invariant(
typeof inst.constructor.childContextTypes === 'object',
'%s.getChildContext(): childContextTypes must be defined in order to ' +
'use getChildContext().',
this.getName() || 'ReactCompositeComponent'
) : invariant(typeof inst.constructor.childContextTypes === 'object'));
if ("production" !== "development") {
this._checkPropTypes(
inst.constructor.childContextTypes,
childContext,
ReactPropTypeLocations.childContext
);
}
for (var name in childContext) {
("production" !== "development" ? invariant(
name in inst.constructor.childContextTypes,
'%s.getChildContext(): key "%s" is not defined in childContextTypes.',
this.getName() || 'ReactCompositeComponent',
name
) : invariant(name in inst.constructor.childContextTypes));
}
return assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid. Does not mutate its argument; returns
* a new props object with defaults merged in.
*
* @param {object} newProps
* @return {object}
* @private
*/
_processProps: function(newProps) {
if ("production" !== "development") {
var Component = ReactNativeComponent.getComponentClassForElement(
this._currentElement
);
if (Component.propTypes) {
this._checkPropTypes(
Component.propTypes,
newProps,
ReactPropTypeLocations.prop
);
}
}
return newProps;
},
/**
* Assert that the props are valid
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkPropTypes: function(propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
("production" !== "development" ? invariant(
typeof propTypes[propName] === 'function',
'%s: %s type `%s` is invalid; it must be a function, usually ' +
'from React.PropTypes.',
componentName || 'React class',
ReactPropTypeLocationNames[location],
propName
) : invariant(typeof propTypes[propName] === 'function'));
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// React.render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
("production" !== "development" ? warning(
false,
'Failed Composite propType: %s',
error.message + addendum
) : null);
} else {
("production" !== "development" ? warning(
false,
'Failed Context Types: %s',
error.message + addendum
) : null);
}
}
}
}
},
receiveComponent: function(nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(
transaction,
prevElement,
nextElement,
prevContext,
nextContext
);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function(transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(
this,
this._pendingElement || this._currentElement,
transaction,
this._context
);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
if ("production" !== "development") {
ReactElementValidator.checkAndWarnForMutatedProps(
this._currentElement
);
}
this.updateComponent(
transaction,
this._currentElement,
this._currentElement,
this._context,
this._context
);
}
},
/**
* Compare two contexts, warning if they are different
* TODO: Remove this check when owner-context is removed
*/
_warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
ownerBasedContext = this._maskContext(ownerBasedContext);
parentBasedContext = this._maskContext(parentBasedContext);
var parentKeys = Object.keys(parentBasedContext).sort();
var displayName = this.getName() || 'ReactCompositeComponent';
for (var i = 0; i < parentKeys.length; i++) {
var key = parentKeys[i];
("production" !== "development" ? warning(
ownerBasedContext[key] === parentBasedContext[key],
'owner-based and parent-based contexts differ ' +
'(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
'(see: http://fb.me/react-context-by-parent)',
ownerBasedContext[key],
parentBasedContext[key],
key,
displayName
) : null);
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function(
transaction,
prevParentElement,
nextParentElement,
prevUnmaskedContext,
nextUnmaskedContext
) {
var inst = this._instance;
var nextContext = inst.context;
var nextProps = inst.props;
// Distinguish between a props update versus a simple state update
if (prevParentElement !== nextParentElement) {
nextContext = this._processContext(nextParentElement._context);
nextProps = this._processProps(nextParentElement.props);
if ("production" !== "development") {
if (nextUnmaskedContext != null) {
this._warnIfContextsDiffer(
nextParentElement._context,
nextUnmaskedContext
);
}
}
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (inst.componentWillReceiveProps) {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate =
this._pendingForceUpdate ||
!inst.shouldComponentUpdate ||
inst.shouldComponentUpdate(nextProps, nextState, nextContext);
if ("production" !== "development") {
("production" !== "development" ? warning(
typeof shouldUpdate !== 'undefined',
'%s.shouldComponentUpdate(): Returned undefined instead of a ' +
'boolean value. Make sure to return true or false.',
this.getName() || 'ReactCompositeComponent'
) : null);
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(
nextParentElement,
nextProps,
nextState,
nextContext,
transaction,
nextUnmaskedContext
);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function(props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
assign(
nextState,
typeof partial === 'function' ?
partial.call(inst, nextState, props, context) :
partial
);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function(
nextElement,
nextProps,
nextState,
nextContext,
transaction,
unmaskedContext
) {
var inst = this._instance;
var prevProps = inst.props;
var prevState = inst.state;
var prevContext = inst.context;
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (inst.componentDidUpdate) {
transaction.getReactMountReady().enqueue(
inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
inst
);
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function(transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(
prevComponentInstance,
nextRenderedElement,
transaction,
this._processChildContext(context)
);
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
this._renderedComponent = this._instantiateReactComponent(
nextRenderedElement,
this._currentElement.type
);
var nextMarkup = ReactReconciler.mountComponent(
this._renderedComponent,
thisID,
transaction,
context
);
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
/**
* @protected
*/
_replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
ReactComponentEnvironment.replaceNodeWithMarkupByID(
prevComponentID,
nextMarkup
);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function() {
var inst = this._instance;
var renderedComponent = inst.render();
if ("production" !== "development") {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof renderedComponent === 'undefined' &&
inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
}
}
return renderedComponent;
},
/**
* @private
*/
_renderValidatedComponent: function() {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._processChildContext(
this._currentElement._context
);
ReactCurrentOwner.current = this;
try {
renderedComponent =
this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
("production" !== "development" ? invariant(
// TODO: An `isValidNode` function would probably be more appropriate
renderedComponent === null || renderedComponent === false ||
ReactElement.isValidElement(renderedComponent),
'%s.render(): A valid ReactComponent must be returned. You may have ' +
'returned undefined, an array or some other invalid object.',
this.getName() || 'ReactCompositeComponent'
) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
renderedComponent === null || renderedComponent === false ||
ReactElement.isValidElement(renderedComponent)));
return renderedComponent;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function(ref, component) {
var inst = this.getPublicInstance();
var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
refs[ref] = component.getPublicInstance();
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function(ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function() {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return (
type.displayName || (constructor && constructor.displayName) ||
type.name || (constructor && constructor.name) ||
null
);
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by React.render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function() {
return this._instance;
},
// Stub
_instantiateReactComponent: null
};
ReactPerf.measureMethods(
ReactCompositeComponentMixin,
'ReactCompositeComponent',
{
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
}
);
var ReactCompositeComponent = {
Mixin: ReactCompositeComponentMixin
};
module.exports = ReactCompositeComponent;
},{}],44:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactContext
*/
'use strict';
var assign = _dereq_(29);
var emptyObject = _dereq_(130);
var warning = _dereq_(171);
var didWarn = false;
/**
* Keeps track of the current context.
*
* The context is automatically passed down the component ownership hierarchy
* and is accessible via `this.context` on ReactCompositeComponents.
*/
var ReactContext = {
/**
* @internal
* @type {object}
*/
current: emptyObject,
/**
* Temporarily extends the current context while executing scopedCallback.
*
* A typical use case might look like
*
* render: function() {
* var children = ReactContext.withContext({foo: 'foo'}, () => (
*
* ));
* return <div>{children}</div>;
* }
*
* @param {object} newContext New context to merge into the existing context
* @param {function} scopedCallback Callback to run with the new context
* @return {ReactComponent|array<ReactComponent>}
*/
withContext: function(newContext, scopedCallback) {
if ("production" !== "development") {
("production" !== "development" ? warning(
didWarn,
'withContext is deprecated and will be removed in a future version. ' +
'Use a wrapper component with getChildContext instead.'
) : null);
didWarn = true;
}
var result;
var previousContext = ReactContext.current;
ReactContext.current = assign({}, previousContext, newContext);
try {
result = scopedCallback();
} finally {
ReactContext.current = previousContext;
}
return result;
}
};
module.exports = ReactContext;
},{}],45:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactCurrentOwner
*/
'use strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*
* The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
},{}],46:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOM
* @typechecks static-only
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactElementValidator = _dereq_(64);
var mapObject = _dereq_(158);
/**
* Create a factory that creates HTML tag elements.
*
* @param {string} tag Tag name (e.g. `div`).
* @private
*/
function createDOMFactory(tag) {
if ("production" !== "development") {
return ReactElementValidator.createFactory(tag);
}
return ReactElement.createFactory(tag);
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOM = mapObject({
a: 'a',
abbr: 'abbr',
address: 'address',
area: 'area',
article: 'article',
aside: 'aside',
audio: 'audio',
b: 'b',
base: 'base',
bdi: 'bdi',
bdo: 'bdo',
big: 'big',
blockquote: 'blockquote',
body: 'body',
br: 'br',
button: 'button',
canvas: 'canvas',
caption: 'caption',
cite: 'cite',
code: 'code',
col: 'col',
colgroup: 'colgroup',
data: 'data',
datalist: 'datalist',
dd: 'dd',
del: 'del',
details: 'details',
dfn: 'dfn',
dialog: 'dialog',
div: 'div',
dl: 'dl',
dt: 'dt',
em: 'em',
embed: 'embed',
fieldset: 'fieldset',
figcaption: 'figcaption',
figure: 'figure',
footer: 'footer',
form: 'form',
h1: 'h1',
h2: 'h2',
h3: 'h3',
h4: 'h4',
h5: 'h5',
h6: 'h6',
head: 'head',
header: 'header',
hr: 'hr',
html: 'html',
i: 'i',
iframe: 'iframe',
img: 'img',
input: 'input',
ins: 'ins',
kbd: 'kbd',
keygen: 'keygen',
label: 'label',
legend: 'legend',
li: 'li',
link: 'link',
main: 'main',
map: 'map',
mark: 'mark',
menu: 'menu',
menuitem: 'menuitem',
meta: 'meta',
meter: 'meter',
nav: 'nav',
noscript: 'noscript',
object: 'object',
ol: 'ol',
optgroup: 'optgroup',
option: 'option',
output: 'output',
p: 'p',
param: 'param',
picture: 'picture',
pre: 'pre',
progress: 'progress',
q: 'q',
rp: 'rp',
rt: 'rt',
ruby: 'ruby',
s: 's',
samp: 'samp',
script: 'script',
section: 'section',
select: 'select',
small: 'small',
source: 'source',
span: 'span',
strong: 'strong',
style: 'style',
sub: 'sub',
summary: 'summary',
sup: 'sup',
table: 'table',
tbody: 'tbody',
td: 'td',
textarea: 'textarea',
tfoot: 'tfoot',
th: 'th',
thead: 'thead',
time: 'time',
title: 'title',
tr: 'tr',
track: 'track',
u: 'u',
ul: 'ul',
'var': 'var',
video: 'video',
wbr: 'wbr',
// SVG
circle: 'circle',
defs: 'defs',
ellipse: 'ellipse',
g: 'g',
line: 'line',
linearGradient: 'linearGradient',
mask: 'mask',
path: 'path',
pattern: 'pattern',
polygon: 'polygon',
polyline: 'polyline',
radialGradient: 'radialGradient',
rect: 'rect',
stop: 'stop',
svg: 'svg',
text: 'text',
tspan: 'tspan'
}, createDOMFactory);
module.exports = ReactDOM;
},{}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMButton
*/
'use strict';
var AutoFocusMixin = _dereq_(2);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var keyMirror = _dereq_(156);
var button = ReactElement.createFactory('button');
var mouseListenerNames = keyMirror({
onClick: true,
onDoubleClick: true,
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
});
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = ReactClass.createClass({
displayName: 'ReactDOMButton',
tagName: 'BUTTON',
mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
render: function() {
var props = {};
// Copy the props; except the mouse listeners if we're disabled
for (var key in this.props) {
if (this.props.hasOwnProperty(key) &&
(!this.props.disabled || !mouseListenerNames[key])) {
props[key] = this.props[key];
}
}
return button(props, this.props.children);
}
});
module.exports = ReactDOMButton;
},{}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMComponent
* @typechecks static-only
*/
/* global hasOwnProperty:true */
'use strict';
var CSSPropertyOperations = _dereq_(6);
var DOMProperty = _dereq_(11);
var DOMPropertyOperations = _dereq_(12);
var ReactBrowserEventEmitter = _dereq_(33);
var ReactComponentBrowserEnvironment =
_dereq_(40);
var ReactMount = _dereq_(77);
var ReactMultiChild = _dereq_(78);
var ReactPerf = _dereq_(82);
var assign = _dereq_(29);
var escapeTextContentForBrowser = _dereq_(131);
var invariant = _dereq_(150);
var isEventSupported = _dereq_(151);
var keyOf = _dereq_(157);
var warning = _dereq_(171);
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = {'string': true, 'number': true};
var STYLE = keyOf({style: null});
var ELEMENT_NODE_TYPE = 1;
/**
* Optionally injectable operations for mutating the DOM
*/
var BackendIDOperations = null;
/**
* @param {?object} props
*/
function assertValidProps(props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if (props.dangerouslySetInnerHTML != null) {
("production" !== "development" ? invariant(
props.children == null,
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
) : invariant(props.children == null));
("production" !== "development" ? invariant(
props.dangerouslySetInnerHTML.__html != null,
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
'for more information.'
) : invariant(props.dangerouslySetInnerHTML.__html != null));
}
if ("production" !== "development") {
("production" !== "development" ? warning(
props.innerHTML == null,
'Directly setting property `innerHTML` is not permitted. ' +
'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
) : null);
("production" !== "development" ? warning(
!props.contentEditable || props.children == null,
'A component is `contentEditable` and contains `children` managed by ' +
'React. It is now your responsibility to guarantee that none of ' +
'those nodes are unexpectedly modified or duplicated. This is ' +
'probably not intentional.'
) : null);
}
("production" !== "development" ? invariant(
props.style == null || typeof props.style === 'object',
'The `style` prop expects a mapping from style properties to values, ' +
'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
'using JSX.'
) : invariant(props.style == null || typeof props.style === 'object'));
}
function putListener(id, registrationName, listener, transaction) {
if ("production" !== "development") {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
("production" !== "development" ? warning(
registrationName !== 'onScroll' || isEventSupported('scroll', true),
'This browser doesn\'t support the `onScroll` event'
) : null);
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
container.ownerDocument :
container;
listenTo(registrationName, doc);
}
transaction.getPutListenerQueue().enqueuePutListener(
id,
registrationName,
listener
);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
// those special cased tags.
var omittedCloseTags = {
'area': true,
'base': true,
'br': true,
'col': true,
'embed': true,
'hr': true,
'img': true,
'input': true,
'keygen': true,
'link': true,
'meta': true,
'param': true,
'source': true,
'track': true,
'wbr': true
// NOTE: menuitem's close tag should be omitted, but that causes problems.
};
// We accept any tag to be rendered but since this gets injected into abitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
var hasOwnProperty = {}.hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
validatedTagCache[tag] = true;
}
}
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @constructor ReactDOMComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
this._tag = tag;
this._renderedChildren = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
construct: function(element) {
this._currentElement = element;
},
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} The computed markup.
*/
mountComponent: function(rootID, transaction, context) {
this._rootNodeID = rootID;
assertValidProps(this._currentElement.props);
var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
return (
this._createOpenTagMarkupAndPutListeners(transaction) +
this._createContentMarkup(transaction, context) +
closeTag
);
},
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkupAndPutListeners: function(transaction) {
var props = this._currentElement.props;
var ret = '<' + this._tag;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
putListener(this._rootNodeID, propKey, propValue, transaction);
} else {
if (propKey === STYLE) {
if (propValue) {
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
var markup =
DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
if (markup) {
ret += ' ' + markup;
}
}
}
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret + '>';
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
return ret + ' ' + markupForID + '>';
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
* @return {string} Content markup.
*/
_createContentMarkup: function(transaction, context) {
var prefix = '';
if (this._tag === 'listing' ||
this._tag === 'pre' ||
this._tag === 'textarea') {
// Add an initial newline because browsers ignore the first newline in
// a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
prefix = '\n';
}
var props = this._currentElement.props;
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
return prefix + innerHTML.__html;
}
} else {
var contentToUse =
CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
return prefix + escapeTextContentForBrowser(contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(
childrenToUse,
transaction,
context
);
return prefix + mountImages.join('');
}
}
return prefix;
},
receiveComponent: function(nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
},
/**
* Updates a native DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevElement
* @param {ReactElement} nextElement
* @internal
* @overridable
*/
updateComponent: function(transaction, prevElement, nextElement, context) {
assertValidProps(this._currentElement.props);
this._updateDOMProperties(prevElement.props, transaction);
this._updateDOMChildren(prevElement.props, transaction, context);
},
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
* @param {ReactReconcileTransaction} transaction
*/
_updateDOMProperties: function(lastProps, transaction) {
var nextProps = this._currentElement.props;
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) ||
!lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
var lastStyle = this._previousStyleCopy;
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
deleteListener(this._rootNodeID, propKey);
} else if (
DOMProperty.isStandardName[propKey] ||
DOMProperty.isCustomAttribute(propKey)) {
BackendIDOperations.deletePropertyByID(
this._rootNodeID,
propKey
);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = propKey === STYLE ?
this._previousStyleCopy :
lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
nextProp = this._previousStyleCopy = assign({}, nextProp);
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) &&
(!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) &&
lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
putListener(this._rootNodeID, propKey, nextProp, transaction);
} else if (
DOMProperty.isStandardName[propKey] ||
DOMProperty.isCustomAttribute(propKey)) {
BackendIDOperations.updatePropertyByID(
this._rootNodeID,
propKey,
nextProp
);
}
}
if (styleUpdates) {
BackendIDOperations.updateStylesByID(
this._rootNodeID,
styleUpdates
);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {ReactReconcileTransaction} transaction
*/
_updateDOMChildren: function(lastProps, transaction, context) {
var nextProps = this._currentElement.props;
var lastContent =
CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent =
CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml =
lastProps.dangerouslySetInnerHTML &&
lastProps.dangerouslySetInnerHTML.__html;
var nextHtml =
nextProps.dangerouslySetInnerHTML &&
nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction, context);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
BackendIDOperations.updateInnerHTMLByID(
this._rootNodeID,
nextHtml
);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
}
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function() {
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
}
};
ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent'
});
assign(
ReactDOMComponent.prototype,
ReactDOMComponent.Mixin,
ReactMultiChild.Mixin
);
ReactDOMComponent.injection = {
injectIDOperations: function(IDOperations) {
ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
}
};
module.exports = ReactDOMComponent;
},{}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMForm
*/
'use strict';
var EventConstants = _dereq_(16);
var LocalEventTrapMixin = _dereq_(27);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var form = ReactElement.createFactory('form');
/**
* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
* to capture it on the <form> element itself. There are lots of hacks we could
* do to accomplish this, but the most reliable is to make <form> a
* composite component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMForm = ReactClass.createClass({
displayName: 'ReactDOMForm',
tagName: 'FORM',
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
render: function() {
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
// `jshint` fails to parse JSX so in order for linting to work in the open
// source repo, we need to just use `ReactDOM.form`.
return form(this.props);
},
componentDidMount: function() {
this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
}
});
module.exports = ReactDOMForm;
},{}],50:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMIDOperations
* @typechecks static-only
*/
/*jslint evil: true */
'use strict';
var CSSPropertyOperations = _dereq_(6);
var DOMChildrenOperations = _dereq_(10);
var DOMPropertyOperations = _dereq_(12);
var ReactMount = _dereq_(77);
var ReactPerf = _dereq_(82);
var invariant = _dereq_(150);
var setInnerHTML = _dereq_(164);
/**
* Errors for properties that should not be updated with `updatePropertyById()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
dangerouslySetInnerHTML:
'`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
* Operations used to process updates to DOM nodes. This is made injectable via
* `ReactDOMComponent.BackendIDOperations`.
*/
var ReactDOMIDOperations = {
/**
* Updates a DOM node with new property values. This should only be used to
* update DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name, see `DOMProperty`.
* @param {*} value New value of the property.
* @internal
*/
updatePropertyByID: function(id, name, value) {
var node = ReactMount.getNode(id);
("production" !== "development" ? invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (value != null) {
DOMPropertyOperations.setValueForProperty(node, name, value);
} else {
DOMPropertyOperations.deleteValueForProperty(node, name);
}
},
/**
* Updates a DOM node to remove a property. This should only be used to remove
* DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A property name to remove, see `DOMProperty`.
* @internal
*/
deletePropertyByID: function(id, name, value) {
var node = ReactMount.getNode(id);
("production" !== "development" ? invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
DOMPropertyOperations.deleteValueForProperty(node, name, value);
},
/**
* Updates a DOM node with new style values. If a value is specified as '',
* the corresponding style property will be unset.
*
* @param {string} id ID of the node to update.
* @param {object} styles Mapping from styles to values.
* @internal
*/
updateStylesByID: function(id, styles) {
var node = ReactMount.getNode(id);
CSSPropertyOperations.setValueForStyles(node, styles);
},
/**
* Updates a DOM node's innerHTML.
*
* @param {string} id ID of the node to update.
* @param {string} html An HTML string.
* @internal
*/
updateInnerHTMLByID: function(id, html) {
var node = ReactMount.getNode(id);
setInnerHTML(node, html);
},
/**
* Updates a DOM node's text content set by `props.content`.
*
* @param {string} id ID of the node to update.
* @param {string} content Text content.
* @internal
*/
updateTextContentByID: function(id, content) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.updateTextContent(node, content);
},
/**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
* @param {string} markup Dangerous markup to inject in place of child.
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markup List of markup strings.
* @internal
*/
dangerouslyProcessChildrenUpdates: function(updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
DOMChildrenOperations.processUpdates(updates, markup);
}
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
updatePropertyByID: 'updatePropertyByID',
deletePropertyByID: 'deletePropertyByID',
updateStylesByID: 'updateStylesByID',
updateInnerHTMLByID: 'updateInnerHTMLByID',
updateTextContentByID: 'updateTextContentByID',
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
},{}],51:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMIframe
*/
'use strict';
var EventConstants = _dereq_(16);
var LocalEventTrapMixin = _dereq_(27);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var iframe = ReactElement.createFactory('iframe');
/**
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
* capture it on the <iframe> element itself. There are lots of hacks we could
* do to accomplish this, but the most reliable is to make <iframe> a composite
* component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMIframe = ReactClass.createClass({
displayName: 'ReactDOMIframe',
tagName: 'IFRAME',
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
render: function() {
return iframe(this.props);
},
componentDidMount: function() {
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
}
});
module.exports = ReactDOMIframe;
},{}],52:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMImg
*/
'use strict';
var EventConstants = _dereq_(16);
var LocalEventTrapMixin = _dereq_(27);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var img = ReactElement.createFactory('img');
/**
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
* capture it on the <img> element itself. There are lots of hacks we could do
* to accomplish this, but the most reliable is to make <img> a composite
* component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMImg = ReactClass.createClass({
displayName: 'ReactDOMImg',
tagName: 'IMG',
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
render: function() {
return img(this.props);
},
componentDidMount: function() {
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
}
});
module.exports = ReactDOMImg;
},{}],53:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMInput
*/
'use strict';
var AutoFocusMixin = _dereq_(2);
var DOMPropertyOperations = _dereq_(12);
var LinkedValueUtils = _dereq_(26);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var ReactMount = _dereq_(77);
var ReactUpdates = _dereq_(100);
var assign = _dereq_(29);
var invariant = _dereq_(150);
var input = ReactElement.createFactory('input');
var instancesByReactID = {};
function forceUpdateIfMounted() {
/*jshint validthis:true */
if (this.isMounted()) {
this.forceUpdate();
}
}
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = ReactClass.createClass({
displayName: 'ReactDOMInput',
tagName: 'INPUT',
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
getInitialState: function() {
var defaultValue = this.props.defaultValue;
return {
initialChecked: this.props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null
};
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = assign({}, this.props);
props.defaultChecked = null;
props.defaultValue = null;
var value = LinkedValueUtils.getValue(this);
props.value = value != null ? value : this.state.initialValue;
var checked = LinkedValueUtils.getChecked(this);
props.checked = checked != null ? checked : this.state.initialChecked;
props.onChange = this._handleChange;
return input(props, this.props.children);
},
componentDidMount: function() {
var id = ReactMount.getID(this.getDOMNode());
instancesByReactID[id] = this;
},
componentWillUnmount: function() {
var rootNode = this.getDOMNode();
var id = ReactMount.getID(rootNode);
delete instancesByReactID[id];
},
componentDidUpdate: function(prevProps, prevState, prevContext) {
var rootNode = this.getDOMNode();
if (this.props.checked != null) {
DOMPropertyOperations.setValueForProperty(
rootNode,
'checked',
this.props.checked || false
);
}
var value = LinkedValueUtils.getValue(this);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = LinkedValueUtils.getOnChange(this);
if (onChange) {
returnValue = onChange.call(this, event);
}
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
var name = this.props.name;
if (this.props.type === 'radio' && name != null) {
var rootNode = this.getDOMNode();
var queryRoot = rootNode;
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
var group = queryRoot.querySelectorAll(
'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
for (var i = 0, groupLen = group.length; i < groupLen; i++) {
var otherNode = group[i];
if (otherNode === rootNode ||
otherNode.form !== rootNode.form) {
continue;
}
var otherID = ReactMount.getID(otherNode);
("production" !== "development" ? invariant(
otherID,
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
'same `name` is not supported.'
) : invariant(otherID));
var otherInstance = instancesByReactID[otherID];
("production" !== "development" ? invariant(
otherInstance,
'ReactDOMInput: Unknown radio button ID %s.',
otherID
) : invariant(otherInstance));
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
}
}
return returnValue;
}
});
module.exports = ReactDOMInput;
},{}],54:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMOption
*/
'use strict';
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var warning = _dereq_(171);
var option = ReactElement.createFactory('option');
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = ReactClass.createClass({
displayName: 'ReactDOMOption',
tagName: 'OPTION',
mixins: [ReactBrowserComponentMixin],
componentWillMount: function() {
// TODO (yungsters): Remove support for `selected` in <option>.
if ("production" !== "development") {
("production" !== "development" ? warning(
this.props.selected == null,
'Use the `defaultValue` or `value` props on <select> instead of ' +
'setting `selected` on <option>.'
) : null);
}
},
render: function() {
return option(this.props, this.props.children);
}
});
module.exports = ReactDOMOption;
},{}],55:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMSelect
*/
'use strict';
var AutoFocusMixin = _dereq_(2);
var LinkedValueUtils = _dereq_(26);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var ReactUpdates = _dereq_(100);
var assign = _dereq_(29);
var select = ReactElement.createFactory('select');
function updateOptionsIfPendingUpdateAndMounted() {
/*jshint validthis:true */
if (this._pendingUpdate) {
this._pendingUpdate = false;
var value = LinkedValueUtils.getValue(this);
if (value != null && this.isMounted()) {
updateOptions(this, value);
}
}
}
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function selectValueType(props, propName, componentName) {
if (props[propName] == null) {
return null;
}
if (props.multiple) {
if (!Array.isArray(props[propName])) {
return new Error(
("The `" + propName + "` prop supplied to <select> must be an array if ") +
("`multiple` is true.")
);
}
} else {
if (Array.isArray(props[propName])) {
return new Error(
("The `" + propName + "` prop supplied to <select> must be a scalar ") +
("value if `multiple` is false.")
);
}
}
}
/**
* @param {ReactComponent} component Instance of ReactDOMSelect
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
function updateOptions(component, propValue) {
var selectedValue, i, l;
var options = component.getDOMNode().options;
if (component.props.multiple) {
selectedValue = {};
for (i = 0, l = propValue.length; i < l; i++) {
selectedValue['' + propValue[i]] = true;
}
for (i = 0, l = options.length; i < l; 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, l = options.length; i < l; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
}
}
options[0].selected = true;
}
}
/**
* Implements a <select> native 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 = ReactClass.createClass({
displayName: 'ReactDOMSelect',
tagName: 'SELECT',
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
propTypes: {
defaultValue: selectValueType,
value: selectValueType
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = assign({}, this.props);
props.onChange = this._handleChange;
props.value = null;
return select(props, this.props.children);
},
componentWillMount: function() {
this._pendingUpdate = false;
},
componentDidMount: function() {
var value = LinkedValueUtils.getValue(this);
if (value != null) {
updateOptions(this, value);
} else if (this.props.defaultValue != null) {
updateOptions(this, this.props.defaultValue);
}
},
componentDidUpdate: function(prevProps) {
var value = LinkedValueUtils.getValue(this);
if (value != null) {
this._pendingUpdate = false;
updateOptions(this, value);
} else if (!prevProps.multiple !== !this.props.multiple) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
if (this.props.defaultValue != null) {
updateOptions(this, this.props.defaultValue);
} else {
// Revert the select back to its default unselected state.
updateOptions(this, this.props.multiple ? [] : '');
}
}
},
_handleChange: function(event) {
var returnValue;
var onChange = LinkedValueUtils.getOnChange(this);
if (onChange) {
returnValue = onChange.call(this, event);
}
this._pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
}
});
module.exports = ReactDOMSelect;
},{}],56:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMSelection
*/
'use strict';
var ExecutionEnvironment = _dereq_(22);
var getNodeForCharacterOffset = _dereq_(143);
var getTextContentAccessor = _dereq_(145);
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
* is available on the Range object, IE11 sometimes gets them wrong.
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
*/
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
return anchorNode === focusNode && anchorOffset === focusOffset;
}
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection && window.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
var isSelectionCollapsed = isCollapsed(
selection.anchorNode,
selection.anchorOffset,
selection.focusNode,
selection.focusOffset
);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var isTempRangeCollapsed = isCollapsed(
tempRange.startContainer,
tempRange.startOffset,
tempRange.endContainer,
tempRange.endOffset
);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (typeof offsets.end === 'undefined') {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
if (!window.getSelection) {
return;
}
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = typeof offsets.end === 'undefined' ?
start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
}
}
var useIEOffsets = (
ExecutionEnvironment.canUseDOM &&
'selection' in document &&
!('getSelection' in window)
);
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
};
module.exports = ReactDOMSelection;
},{}],57:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMTextComponent
* @typechecks static-only
*/
'use strict';
var DOMPropertyOperations = _dereq_(12);
var ReactComponentBrowserEnvironment =
_dereq_(40);
var ReactDOMComponent = _dereq_(48);
var assign = _dereq_(29);
var escapeTextContentForBrowser = _dereq_(131);
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings in elements so that they can undergo
* the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactDOMTextComponent
* @extends ReactComponent
* @internal
*/
var ReactDOMTextComponent = function(props) {
// This constructor and its argument is currently used by mocks.
};
assign(ReactDOMTextComponent.prototype, {
/**
* @param {ReactText} text
* @internal
*/
construct: function(text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
// Properties
this._rootNodeID = null;
this._mountIndex = 0;
},
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function(rootID, transaction, context) {
this._rootNodeID = rootID;
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
}
return (
'<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
escapedText +
'</span>'
);
},
/**
* Updates this component by updating the text content.
*
* @param {ReactText} nextText The next text content
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function(nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
if (nextStringText !== this._stringText) {
// TODO: Save this as pending props and use performUpdateIfNecessary
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
ReactDOMComponent.BackendIDOperations.updateTextContentByID(
this._rootNodeID,
nextStringText
);
}
}
},
unmountComponent: function() {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
},{}],58:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDOMTextarea
*/
'use strict';
var AutoFocusMixin = _dereq_(2);
var DOMPropertyOperations = _dereq_(12);
var LinkedValueUtils = _dereq_(26);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var ReactUpdates = _dereq_(100);
var assign = _dereq_(29);
var invariant = _dereq_(150);
var warning = _dereq_(171);
var textarea = ReactElement.createFactory('textarea');
function forceUpdateIfMounted() {
/*jshint validthis:true */
if (this.isMounted()) {
this.forceUpdate();
}
}
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = ReactClass.createClass({
displayName: 'ReactDOMTextarea',
tagName: 'TEXTAREA',
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
getInitialState: function() {
var defaultValue = this.props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = this.props.children;
if (children != null) {
if ("production" !== "development") {
("production" !== "development" ? warning(
false,
'Use the `defaultValue` or `value` props instead of setting ' +
'children on <textarea>.'
) : null);
}
("production" !== "development" ? invariant(
defaultValue == null,
'If you supply `defaultValue` on a <textarea>, do not pass children.'
) : invariant(defaultValue == null));
if (Array.isArray(children)) {
("production" !== "development" ? invariant(
children.length <= 1,
'<textarea> can only have at most one child.'
) : invariant(children.length <= 1));
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
var value = LinkedValueUtils.getValue(this);
return {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue)
};
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = assign({}, this.props);
("production" !== "development" ? invariant(
props.dangerouslySetInnerHTML == null,
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
) : invariant(props.dangerouslySetInnerHTML == null));
props.defaultValue = null;
props.value = null;
props.onChange = this._handleChange;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
return textarea(props, this.state.initialValue);
},
componentDidUpdate: function(prevProps, prevState, prevContext) {
var value = LinkedValueUtils.getValue(this);
if (value != null) {
var rootNode = this.getDOMNode();
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = LinkedValueUtils.getOnChange(this);
if (onChange) {
returnValue = onChange.call(this, event);
}
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
}
});
module.exports = ReactDOMTextarea;
},{}],59:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDefaultBatchingStrategy
*/
'use strict';
var ReactUpdates = _dereq_(100);
var Transaction = _dereq_(116);
var assign = _dereq_(29);
var emptyFunction = _dereq_(129);
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function() {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
assign(
ReactDefaultBatchingStrategyTransaction.prototype,
Transaction.Mixin,
{
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
}
}
);
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function(callback, a, b, c, d) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(a, b, c, d);
} else {
transaction.perform(callback, null, a, b, c, d);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
},{}],60:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDefaultInjection
*/
'use strict';
var BeforeInputEventPlugin = _dereq_(3);
var ChangeEventPlugin = _dereq_(8);
var ClientReactRootIndex = _dereq_(9);
var DefaultEventPluginOrder = _dereq_(14);
var EnterLeaveEventPlugin = _dereq_(15);
var ExecutionEnvironment = _dereq_(22);
var HTMLDOMPropertyConfig = _dereq_(24);
var MobileSafariClickEventPlugin = _dereq_(28);
var ReactBrowserComponentMixin = _dereq_(32);
var ReactClass = _dereq_(38);
var ReactComponentBrowserEnvironment =
_dereq_(40);
var ReactDefaultBatchingStrategy = _dereq_(59);
var ReactDOMComponent = _dereq_(48);
var ReactDOMButton = _dereq_(47);
var ReactDOMForm = _dereq_(49);
var ReactDOMImg = _dereq_(52);
var ReactDOMIDOperations = _dereq_(50);
var ReactDOMIframe = _dereq_(51);
var ReactDOMInput = _dereq_(53);
var ReactDOMOption = _dereq_(54);
var ReactDOMSelect = _dereq_(55);
var ReactDOMTextarea = _dereq_(58);
var ReactDOMTextComponent = _dereq_(57);
var ReactElement = _dereq_(63);
var ReactEventListener = _dereq_(68);
var ReactInjection = _dereq_(70);
var ReactInstanceHandles = _dereq_(72);
var ReactMount = _dereq_(77);
var ReactReconcileTransaction = _dereq_(88);
var SelectEventPlugin = _dereq_(102);
var ServerReactRootIndex = _dereq_(103);
var SimpleEventPlugin = _dereq_(104);
var SVGDOMPropertyConfig = _dereq_(101);
var createFullPageComponent = _dereq_(125);
function autoGenerateWrapperClass(type) {
return ReactClass.createClass({
tagName: type.toUpperCase(),
render: function() {
return new ReactElement(
type,
null,
null,
null,
null,
this.props
);
}
});
}
function inject() {
ReactInjection.EventEmitter.injectReactEventListener(
ReactEventListener
);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
ReactInjection.EventPluginHub.injectMount(ReactMount);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.NativeComponent.injectGenericComponentClass(
ReactDOMComponent
);
ReactInjection.NativeComponent.injectTextComponentClass(
ReactDOMTextComponent
);
ReactInjection.NativeComponent.injectAutoWrapper(
autoGenerateWrapperClass
);
// This needs to happen before createFullPageComponent() otherwise the mixin
// won't be included.
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
ReactInjection.NativeComponent.injectComponentClasses({
'button': ReactDOMButton,
'form': ReactDOMForm,
'iframe': ReactDOMIframe,
'img': ReactDOMImg,
'input': ReactDOMInput,
'option': ReactDOMOption,
'select': ReactDOMSelect,
'textarea': ReactDOMTextarea,
'html': createFullPageComponent('html'),
'head': createFullPageComponent('head'),
'body': createFullPageComponent('body')
});
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
ReactInjection.Updates.injectReconcileTransaction(
ReactReconcileTransaction
);
ReactInjection.Updates.injectBatchingStrategy(
ReactDefaultBatchingStrategy
);
ReactInjection.RootIndex.injectCreateReactRootIndex(
ExecutionEnvironment.canUseDOM ?
ClientReactRootIndex.createReactRootIndex :
ServerReactRootIndex.createReactRootIndex
);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
if ("production" !== "development") {
var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
if ((/[?&]react_perf\b/).test(url)) {
var ReactDefaultPerf = _dereq_(61);
ReactDefaultPerf.start();
}
}
}
module.exports = {
inject: inject
};
},{}],61:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDefaultPerf
* @typechecks static-only
*/
'use strict';
var DOMProperty = _dereq_(11);
var ReactDefaultPerfAnalysis = _dereq_(62);
var ReactMount = _dereq_(77);
var ReactPerf = _dereq_(82);
var performanceNow = _dereq_(162);
function roundFloat(val) {
return Math.floor(val * 100) / 100;
}
function addValue(obj, key, val) {
obj[key] = (obj[key] || 0) + val;
}
var ReactDefaultPerf = {
_allMeasurements: [], // last item in the list is the current one
_mountStack: [0],
_injected: false,
start: function() {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
ReactDefaultPerf._allMeasurements.length = 0;
ReactPerf.enableMeasure = true;
},
stop: function() {
ReactPerf.enableMeasure = false;
},
getLastMeasurements: function() {
return ReactDefaultPerf._allMeasurements;
},
printExclusive: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
console.table(summary.map(function(item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
'Exclusive mount time (ms)': roundFloat(item.exclusive),
'Exclusive render time (ms)': roundFloat(item.render),
'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
'Render time per instance (ms)': roundFloat(item.render / item.count),
'Instances': item.count
};
}));
// TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
// number.
},
printInclusive: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
console.table(summary.map(function(item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
console.log(
'Total time:',
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
);
},
getMeasurementsSummaryMap: function(measurements) {
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
measurements,
true
);
return summary.map(function(item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
'Instances': item.count
};
});
},
printWasted: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
console.log(
'Total time:',
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
);
},
printDOM: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
console.table(summary.map(function(item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
result['type'] = item.type;
result['args'] = JSON.stringify(item.args);
return result;
}));
console.log(
'Total time:',
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
);
},
_recordWrite: function(id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
var writes =
ReactDefaultPerf
._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
.writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
time: totalTime,
args: args
});
},
measure: function(moduleName, fnName, func) {
return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
var totalTime;
var rv;
var start;
if (fnName === '_renderNewRootComponent' ||
fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
// happened to determine the amount of "wasted work" performed.
ReactDefaultPerf._allMeasurements.push({
exclusive: {},
inclusive: {},
render: {},
counts: {},
writes: {},
displayNames: {},
totalTime: 0
});
start = performanceNow();
rv = func.apply(this, args);
ReactDefaultPerf._allMeasurements[
ReactDefaultPerf._allMeasurements.length - 1
].totalTime = performanceNow() - start;
return rv;
} else if (moduleName === 'ReactDOMIDOperations' ||
moduleName === 'ReactComponentBrowserEnvironment') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (fnName === '_mountImageIntoNode') {
var mountID = ReactMount.getID(args[1]);
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
args[0].forEach(function(update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
}
if (update.toIndex !== null) {
writeArgs.toIndex = update.toIndex;
}
if (update.textContent !== null) {
writeArgs.textContent = update.textContent;
}
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
ReactDefaultPerf._recordWrite(
update.parentID,
update.type,
totalTime,
writeArgs
);
});
} else {
// basic format
ReactDefaultPerf._recordWrite(
args[0],
fnName,
totalTime,
Array.prototype.slice.call(args, 1)
);
}
return rv;
} else if (moduleName === 'ReactCompositeComponent' && (
(// TODO: receiveComponent()?
(fnName === 'mountComponent' ||
fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
var rootNodeID = fnName === 'mountComponent' ?
args[0] :
this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
var entry = ReactDefaultPerf._allMeasurements[
ReactDefaultPerf._allMeasurements.length - 1
];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
mountStack.push(0);
}
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (isRender) {
addValue(entry.render, rootNodeID, totalTime);
} else if (isMount) {
var subMountTime = mountStack.pop();
mountStack[mountStack.length - 1] += totalTime;
addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
addValue(entry.inclusive, rootNodeID, totalTime);
} else {
addValue(entry.inclusive, rootNodeID, totalTime);
}
var displayName = null;
if (this._instance.constructor.displayName) {
displayName = this._instance.constructor.displayName;
} else if (this._currentElement.type) {
displayName = this._currentElement.type;
}
entry.displayNames[rootNodeID] = {
current: displayName,
owner: this._currentElement._owner ?
this._currentElement._owner._instance.constructor.displayName :
'<root>'
};
return rv;
} else {
return func.apply(this, args);
}
};
}
};
module.exports = ReactDefaultPerf;
},{}],62:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactDefaultPerfAnalysis
*/
var assign = _dereq_(29);
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
var DOM_OPERATION_TYPES = {
'_mountImageIntoNode': 'set innerHTML',
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
TEXT_CONTENT: 'set textContent',
'updatePropertyByID': 'update attribute',
'deletePropertyByID': 'delete attribute',
'updateStylesByID': 'update styles',
'updateInnerHTMLByID': 'set innerHTML',
'dangerouslyReplaceNodeWithMarkupByID': 'replace'
};
function getTotalTime(measurements) {
// TODO: return number of DOM ops? could be misleading.
// TODO: measure dropped frames after reconcile?
// TODO: log total time of each reconcile and the top-level component
// class that triggered it.
var totalTime = 0;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
totalTime += measurement.totalTime;
}
return totalTime;
}
function getDOMSummary(measurements) {
var items = [];
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var id;
for (id in measurement.writes) {
measurement.writes[id].forEach(function(write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
}
}
return items;
}
function getExclusiveSummary(measurements) {
var candidates = {};
var displayName;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign(
{},
measurement.exclusive,
measurement.inclusive
);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
candidates[displayName] = candidates[displayName] || {
componentName: displayName,
inclusive: 0,
exclusive: 0,
render: 0,
count: 0
};
if (measurement.render[id]) {
candidates[displayName].render += measurement.render[id];
}
if (measurement.exclusive[id]) {
candidates[displayName].exclusive += measurement.exclusive[id];
}
if (measurement.inclusive[id]) {
candidates[displayName].inclusive += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[displayName].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (displayName in candidates) {
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
arr.push(candidates[displayName]);
}
}
arr.sort(function(a, b) {
return b.exclusive - a.exclusive;
});
return arr;
}
function getInclusiveSummary(measurements, onlyClean) {
var candidates = {};
var inclusiveKey;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign(
{},
measurement.exclusive,
measurement.inclusive
);
var cleanComponents;
if (onlyClean) {
cleanComponents = getUnchangedComponents(measurement);
}
for (var id in allIDs) {
if (onlyClean && !cleanComponents[id]) {
continue;
}
var displayName = measurement.displayNames[id];
// Inclusive time is not useful for many components without knowing where
// they are instantiated. So we aggregate inclusive time with both the
// owner and current displayName as the key.
inclusiveKey = displayName.owner + ' > ' + displayName.current;
candidates[inclusiveKey] = candidates[inclusiveKey] || {
componentName: inclusiveKey,
time: 0,
count: 0
};
if (measurement.inclusive[id]) {
candidates[inclusiveKey].time += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[inclusiveKey].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (inclusiveKey in candidates) {
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
arr.push(candidates[inclusiveKey]);
}
}
arr.sort(function(a, b) {
return b.time - a.time;
});
return arr;
}
function getUnchangedComponents(measurement) {
// For a given reconcile, look at which components did not actually
// render anything to the DOM and return a mapping of their ID to
// the amount of time it took to render the entire subtree.
var cleanComponents = {};
var dirtyLeafIDs = Object.keys(measurement.writes);
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
var isDirty = false;
// For each component that rendered, see if a component that triggered
// a DOM op is in its subtree.
for (var i = 0; i < dirtyLeafIDs.length; i++) {
if (dirtyLeafIDs[i].indexOf(id) === 0) {
isDirty = true;
break;
}
}
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
}
return cleanComponents;
}
var ReactDefaultPerfAnalysis = {
getExclusiveSummary: getExclusiveSummary,
getInclusiveSummary: getInclusiveSummary,
getDOMSummary: getDOMSummary,
getTotalTime: getTotalTime
};
module.exports = ReactDefaultPerfAnalysis;
},{}],63:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactElement
*/
'use strict';
var ReactContext = _dereq_(44);
var ReactCurrentOwner = _dereq_(45);
var assign = _dereq_(29);
var warning = _dereq_(171);
var RESERVED_PROPS = {
key: true,
ref: true
};
/**
* Warn for mutations.
*
* @internal
* @param {object} object
* @param {string} key
*/
function defineWarningProperty(object, key) {
Object.defineProperty(object, key, {
configurable: false,
enumerable: true,
get: function() {
if (!this._store) {
return null;
}
return this._store[key];
},
set: function(value) {
("production" !== "development" ? warning(
false,
'Don\'t set the %s property of the React element. Instead, ' +
'specify the correct value when initially creating the element.',
key
) : null);
this._store[key] = value;
}
});
}
/**
* This is updated to true if the membrane is successfully created.
*/
var useMutationMembrane = false;
/**
* Warn for mutations.
*
* @internal
* @param {object} element
*/
function defineMutationMembrane(prototype) {
try {
var pseudoFrozenProperties = {
props: true
};
for (var key in pseudoFrozenProperties) {
defineWarningProperty(prototype, key);
}
useMutationMembrane = true;
} catch (x) {
// IE will fail on defineProperty
}
}
/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
* @param {string|object} ref
* @param {*} key
* @param {*} props
* @internal
*/
var ReactElement = function(type, key, ref, owner, context, props) {
// Built-in properties that belong on the element
this.type = type;
this.key = key;
this.ref = ref;
// Record the component responsible for creating this element.
this._owner = owner;
// TODO: Deprecate withContext, and then the context becomes accessible
// through the owner.
this._context = context;
if ("production" !== "development") {
// The validation flag and props are currently mutative. We put them 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.
this._store = { props: props, originalProps: assign({}, props) };
// 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.
try {
Object.defineProperty(this._store, 'validated', {
configurable: false,
enumerable: false,
writable: true
});
} catch (x) {
}
this._store.validated = false;
// We're not allowed to set props directly on the object so we early
// return and rely on the prototype membrane to forward to the backing
// store.
if (useMutationMembrane) {
Object.freeze(this);
return;
}
}
this.props = props;
};
// We intentionally don't expose the function on the constructor property.
// ReactElement should be indistinguishable from a plain object.
ReactElement.prototype = {
_isReactElement: true
};
if ("production" !== "development") {
defineMutationMembrane(ReactElement.prototype);
}
ReactElement.createElement = function(type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
// Remaining properties are added to a new props object
for (propName in config) {
if (config.hasOwnProperty(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];
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (typeof props[propName] === 'undefined') {
props[propName] = defaultProps[propName];
}
}
}
return new ReactElement(
type,
key,
ref,
ReactCurrentOwner.current,
ReactContext.current,
props
);
};
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.type.
// 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.cloneAndReplaceProps = function(oldElement, newProps) {
var newElement = new ReactElement(
oldElement.type,
oldElement.key,
oldElement.ref,
oldElement._owner,
oldElement._context,
newProps
);
if ("production" !== "development") {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
return newElement;
};
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactElement.isValidElement = function(object) {
// ReactTestUtils is often used outside of beforeEach where as React is
// within it. This leads to two different instances of React on the same
// page. To identify a element from a different React instance we use
// a flag instead of an instanceof check.
var isElement = !!(object && object._isReactElement);
// if (isElement && !(object instanceof ReactElement)) {
// This is an indicator that you're using multiple versions of React at the
// same time. This will screw with ownership and stuff. Fix it, please.
// TODO: We could possibly warn here.
// }
return isElement;
};
module.exports = ReactElement;
},{}],64:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactElementValidator
*/
/**
* 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.
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactFragment = _dereq_(69);
var ReactPropTypeLocations = _dereq_(85);
var ReactPropTypeLocationNames = _dereq_(84);
var ReactCurrentOwner = _dereq_(45);
var ReactNativeComponent = _dereq_(80);
var getIteratorFn = _dereq_(141);
var invariant = _dereq_(150);
var warning = _dereq_(171);
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
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 = {};
var loggedTypeFailures = {};
var NUMERIC_PROPERTY_REGEX = /^\d+$/;
/**
* Gets the instance's name for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getName(instance) {
var publicInstance = instance && instance.getPublicInstance();
if (!publicInstance) {
return undefined;
}
var constructor = publicInstance.constructor;
if (!constructor) {
return undefined;
}
return constructor.displayName || constructor.name || undefined;
}
/**
* Gets the current owner's displayName for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getCurrentOwnerDisplayName() {
var current = ReactCurrentOwner.current;
return (
current && getName(current) || undefined
);
}
/**
* 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.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
warnAndMonitorForKeyUse(
'Each child in an array or iterator should have a unique "key" prop.',
element,
parentType
);
}
/**
* Warn if the key is being defined as an object property but has an incorrect
* value.
*
* @internal
* @param {string} name Property name of the key.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
*/
function validatePropertyKey(name, element, parentType) {
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
return;
}
warnAndMonitorForKeyUse(
'Child objects should have non-numeric keys so ordering is preserved.',
element,
parentType
);
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
* @param {string} message The base warning that gets output.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
*/
function warnAndMonitorForKeyUse(message, element, parentType) {
var ownerName = getCurrentOwnerDisplayName();
var parentName = parentType.displayName || parentType.name;
var useName = ownerName || parentName;
var memoizer = ownerHasKeyUseWarning[message] || (
(ownerHasKeyUseWarning[message] = {})
);
if (memoizer.hasOwnProperty(useName)) {
return;
}
memoizer[useName] = true;
message += ownerName ?
(" Check the render method of " + ownerName + ".") :
(" Check the React.render call using <" + parentName + ">.");
// 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.
if (element &&
element._owner &&
element._owner !== ReactCurrentOwner.current) {
// Name of the component that originally created this child.
var childOwnerName = getName(element._owner);
message += (" It was passed a child from " + childOwnerName + ".");
}
message += ' See http://fb.me/react-warning-keys for more information.';
("production" !== "development" ? warning(false, message) : null);
}
/**
* 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 (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.
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);
}
}
}
} else if (typeof node === 'object') {
var fragment = ReactFragment.extractIfFragment(node);
for (var key in fragment) {
if (fragment.hasOwnProperty(key)) {
validatePropertyKey(key, fragment[key], parentType);
}
}
}
}
}
/**
* Assert that the props are valid
*
* @param {string} componentName Name of the component for error messages.
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
function checkPropTypes(componentName, propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
("production" !== "development" ? invariant(
typeof propTypes[propName] === 'function',
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
'React.PropTypes.',
componentName || 'React class',
ReactPropTypeLocationNames[location],
propName
) : invariant(typeof propTypes[propName] === 'function'));
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
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(this);
("production" !== "development" ? warning(false, 'Failed propType: ' + error.message + addendum) : null);
}
}
}
}
var warnedPropsMutations = {};
/**
* Warn about mutating props when setting `propName` on `element`.
*
* @param {string} propName The string key within props that was set
* @param {ReactElement} element
*/
function warnForPropsMutation(propName, element) {
var type = element.type;
var elementName = typeof type === 'string' ? type : type.displayName;
var ownerName = element._owner ?
element._owner.getPublicInstance().constructor.displayName : null;
var warningKey = propName + '|' + elementName + '|' + ownerName;
if (warnedPropsMutations.hasOwnProperty(warningKey)) {
return;
}
warnedPropsMutations[warningKey] = true;
var elementInfo = '';
if (elementName) {
elementInfo = ' <' + elementName + ' />';
}
var ownerInfo = '';
if (ownerName) {
ownerInfo = ' The element was created by ' + ownerName + '.';
}
("production" !== "development" ? warning(
false,
'Don\'t set .props.%s of the React component%s. ' +
'Instead, specify the correct value when ' +
'initially creating the element.%s',
propName,
elementInfo,
ownerInfo
) : null);
}
/**
* Given an element, check if its props have been mutated since element
* creation (or the last call to this function). In particular, check if any
* new props have been added, which we can't directly catch by defining warning
* properties on the props object.
*
* @param {ReactElement} element
*/
function checkAndWarnForMutatedProps(element) {
if (!element._store) {
// Element was created using `new ReactElement` directly or with
// `ReactElement.createElement`; skip mutation checking
return;
}
var originalProps = element._store.originalProps;
var props = element.props;
for (var propName in props) {
if (props.hasOwnProperty(propName)) {
if (!originalProps.hasOwnProperty(propName) ||
originalProps[propName] !== props[propName]) {
warnForPropsMutation(propName, element);
// Copy over the new value so that the two props objects match again
originalProps[propName] = props[propName];
}
}
}
}
var ReactElementValidator = {
checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
createElement: function(type, props, children) {
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
("production" !== "development" ? warning(
type != null,
'React.createElement: type should not be null or undefined. It should ' +
'be a string (for DOM elements) or a ReactClass (for composite ' +
'components).'
) : null);
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;
}
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
if (type) {
// Extract the component class from the element. Converts string types
// to a composite class which may have propTypes.
// TODO: Validating a string's propTypes is not decoupled from the
// rendering target which is problematic.
var componentClass = ReactNativeComponent.getComponentClassForElement(
element
);
var name = componentClass.displayName || componentClass.name;
if ("production" !== "development") {
if (componentClass.propTypes) {
checkPropTypes(
name,
componentClass.propTypes,
element.props,
ReactPropTypeLocations.prop
);
}
}
if (typeof componentClass.getDefaultProps === 'function') {
("production" !== "development" ? warning(
componentClass.getDefaultProps.isReactClassApproved,
'getDefaultProps is only used on classic React.createClass ' +
'definitions. Use a static property named `defaultProps` instead.'
) : null);
}
}
return element;
},
createFactory: function(type) {
var validatedFactory = ReactElementValidator.createElement.bind(
null,
type
);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
return validatedFactory;
}
};
module.exports = ReactElementValidator;
},{}],65:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactEmptyComponent
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactInstanceMap = _dereq_(73);
var invariant = _dereq_(150);
var component;
// This registry keeps track of the React IDs of the components that rendered to
// `null` (in reality a placeholder such as `noscript`)
var nullComponentIDsRegistry = {};
var ReactEmptyComponentInjection = {
injectEmptyComponent: function(emptyComponent) {
component = ReactElement.createFactory(emptyComponent);
}
};
var ReactEmptyComponentType = function() {};
ReactEmptyComponentType.prototype.componentDidMount = function() {
var internalInstance = ReactInstanceMap.get(this);
// TODO: Make sure we run these methods in the correct order, we shouldn't
// need this check. We're going to assume if we're here it means we ran
// componentWillUnmount already so there is no internal instance (it gets
// removed as part of the unmounting process).
if (!internalInstance) {
return;
}
registerNullComponentID(internalInstance._rootNodeID);
};
ReactEmptyComponentType.prototype.componentWillUnmount = function() {
var internalInstance = ReactInstanceMap.get(this);
// TODO: Get rid of this check. See TODO in componentDidMount.
if (!internalInstance) {
return;
}
deregisterNullComponentID(internalInstance._rootNodeID);
};
ReactEmptyComponentType.prototype.render = function() {
("production" !== "development" ? invariant(
component,
'Trying to return null from a render, but no null placeholder component ' +
'was injected.'
) : invariant(component));
return component();
};
var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
/**
* Mark the component as having rendered to null.
* @param {string} id Component's `_rootNodeID`.
*/
function registerNullComponentID(id) {
nullComponentIDsRegistry[id] = true;
}
/**
* Unmark the component as having rendered to null: it renders to something now.
* @param {string} id Component's `_rootNodeID`.
*/
function deregisterNullComponentID(id) {
delete nullComponentIDsRegistry[id];
}
/**
* @param {string} id Component's `_rootNodeID`.
* @return {boolean} True if the component is rendered to null.
*/
function isNullComponentID(id) {
return !!nullComponentIDsRegistry[id];
}
var ReactEmptyComponent = {
emptyElement: emptyElement,
injection: ReactEmptyComponentInjection,
isNullComponentID: isNullComponentID
};
module.exports = ReactEmptyComponent;
},{}],66:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactErrorUtils
* @typechecks
*/
"use strict";
var ReactErrorUtils = {
/**
* Creates a guarded version of a function. This is supposed to make debugging
* of event handlers easier. To aid debugging with the browser's debugger,
* this currently simply returns the original function.
*
* @param {function} func Function to be executed
* @param {string} name The name of the guard
* @return {function}
*/
guard: function(func, name) {
return func;
}
};
module.exports = ReactErrorUtils;
},{}],67:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactEventEmitterMixin
*/
'use strict';
var EventPluginHub = _dereq_(18);
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue();
}
var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
handleTopLevel: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var events = EventPluginHub.extractEvents(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
},{}],68:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactEventListener
* @typechecks static-only
*/
'use strict';
var EventListener = _dereq_(17);
var ExecutionEnvironment = _dereq_(22);
var PooledClass = _dereq_(30);
var ReactInstanceHandles = _dereq_(72);
var ReactMount = _dereq_(77);
var ReactUpdates = _dereq_(100);
var assign = _dereq_(29);
var getEventTarget = _dereq_(140);
var getUnboundedScrollPosition = _dereq_(146);
/**
* Finds the parent React component of `node`.
*
* @param {*} node
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
* is not nested.
*/
function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
var container = ReactMount.findReactContainerForID(rootID);
var parent = ReactMount.getFirstReactDOM(container);
return parent;
}
// Used to store ancestor hierarchy in top level callback
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function() {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
PooledClass.addPoolingTo(
TopLevelCallbackBookKeeping,
PooledClass.twoArgumentPooler
);
function handleTopLevelImpl(bookKeeping) {
var topLevelTarget = ReactMount.getFirstReactDOM(
getEventTarget(bookKeeping.nativeEvent)
) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = topLevelTarget;
while (ancestor) {
bookKeeping.ancestors.push(ancestor);
ancestor = findParent(ancestor);
}
for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
ReactEventListener._handleTopLevel(
bookKeeping.topLevelType,
topLevelTarget,
topLevelTargetID,
bookKeeping.nativeEvent
);
}
}
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
var ReactEventListener = {
_enabled: true,
_handleTopLevel: null,
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
setHandleTopLevel: function(handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
setEnabled: function(enabled) {
ReactEventListener._enabled = !!enabled;
},
isEnabled: function() {
return ReactEventListener._enabled;
},
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.listen(
element,
handlerBaseName,
ReactEventListener.dispatchEvent.bind(null, topLevelType)
);
},
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.capture(
element,
handlerBaseName,
ReactEventListener.dispatchEvent.bind(null, topLevelType)
);
},
monitorScrollValue: function(refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
dispatchEvent: function(topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
topLevelType,
nativeEvent
);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
} finally {
TopLevelCallbackBookKeeping.release(bookKeeping);
}
}
};
module.exports = ReactEventListener;
},{}],69:[function(_dereq_,module,exports){
/**
* Copyright 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.
*
* @providesModule ReactFragment
*/
'use strict';
var ReactElement = _dereq_(63);
var warning = _dereq_(171);
/**
* We used to allow keyed objects to serve as a collection of ReactElements,
* or nested sets. This allowed us a way to explicitly key a set a fragment of
* components. This is now being replaced with an opaque data structure.
* The upgrade path is to call React.addons.createFragment({ key: value }) to
* create a keyed fragment. The resulting data structure is opaque, for now.
*/
if ("production" !== "development") {
var fragmentKey = '_reactFragment';
var didWarnKey = '_reactDidWarn';
var canWarnForReactFragment = false;
try {
// Feature test. Don't even try to issue this warning if we can't use
// enumerable: false.
var dummy = function() {
return 1;
};
Object.defineProperty(
{},
fragmentKey,
{ enumerable: false, value: true }
);
Object.defineProperty(
{},
'key',
{ enumerable: true, get: dummy }
);
canWarnForReactFragment = true;
} catch (x) { }
var proxyPropertyAccessWithWarning = function(obj, key) {
Object.defineProperty(obj, key, {
enumerable: true,
get: function() {
("production" !== "development" ? warning(
this[didWarnKey],
'A ReactFragment is an opaque type. Accessing any of its ' +
'properties is deprecated. Pass it to one of the React.Children ' +
'helpers.'
) : null);
this[didWarnKey] = true;
return this[fragmentKey][key];
},
set: function(value) {
("production" !== "development" ? warning(
this[didWarnKey],
'A ReactFragment is an immutable opaque type. Mutating its ' +
'properties is deprecated.'
) : null);
this[didWarnKey] = true;
this[fragmentKey][key] = value;
}
});
};
var issuedWarnings = {};
var didWarnForFragment = function(fragment) {
// We use the keys and the type of the value as a heuristic to dedupe the
// warning to avoid spamming too much.
var fragmentCacheKey = '';
for (var key in fragment) {
fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
}
var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
issuedWarnings[fragmentCacheKey] = true;
return alreadyWarnedOnce;
};
}
var ReactFragment = {
// Wrap a keyed object in an opaque proxy that warns you if you access any
// of its properties.
create: function(object) {
if ("production" !== "development") {
if (typeof object !== 'object' || !object) {
("production" !== "development" ? warning(
false,
'React.addons.createFragment only accepts a single object. Not %s',
object
) : null);
return object;
}
if (canWarnForReactFragment) {
var proxy = {};
Object.defineProperty(proxy, fragmentKey, {
enumerable: false,
value: object
});
Object.defineProperty(proxy, didWarnKey, {
writable: true,
enumerable: false,
value: false
});
for (var key in object) {
proxyPropertyAccessWithWarning(proxy, key);
}
Object.preventExtensions(proxy);
return proxy;
}
}
return object;
},
// Extract the original keyed object from the fragment opaque type. Warn if
// a plain object is passed here.
extract: function(fragment) {
if ("production" !== "development") {
if (canWarnForReactFragment) {
if (!fragment[fragmentKey]) {
("production" !== "development" ? warning(
didWarnForFragment(fragment),
'Any use of a keyed object should be wrapped in ' +
'React.addons.createFragment(object) before passed as a child.'
) : null);
return fragment;
}
return fragment[fragmentKey];
}
}
return fragment;
},
// Check if this is a fragment and if so, extract the keyed object. If it
// is a fragment-like object, warn that it should be wrapped. Ignore if we
// can't determine what kind of object this is.
extractIfFragment: function(fragment) {
if ("production" !== "development") {
if (canWarnForReactFragment) {
// If it is the opaque type, return the keyed object.
if (fragment[fragmentKey]) {
return fragment[fragmentKey];
}
// Otherwise, check each property if it has an element, if it does
// it is probably meant as a fragment, so we can warn early. Defer,
// the warning to extract.
for (var key in fragment) {
if (fragment.hasOwnProperty(key) &&
ReactElement.isValidElement(fragment[key])) {
// This looks like a fragment object, we should provide an
// early warning.
return ReactFragment.extract(fragment);
}
}
}
}
return fragment;
}
};
module.exports = ReactFragment;
},{}],70:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactInjection
*/
'use strict';
var DOMProperty = _dereq_(11);
var EventPluginHub = _dereq_(18);
var ReactComponentEnvironment = _dereq_(41);
var ReactClass = _dereq_(38);
var ReactEmptyComponent = _dereq_(65);
var ReactBrowserEventEmitter = _dereq_(33);
var ReactNativeComponent = _dereq_(80);
var ReactDOMComponent = _dereq_(48);
var ReactPerf = _dereq_(82);
var ReactRootIndex = _dereq_(91);
var ReactUpdates = _dereq_(100);
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
DOMComponent: ReactDOMComponent.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
NativeComponent: ReactNativeComponent.injection,
Perf: ReactPerf.injection,
RootIndex: ReactRootIndex.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
},{}],71:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactInputSelection
*/
'use strict';
var ReactDOMSelection = _dereq_(56);
var containsNode = _dereq_(123);
var focusNode = _dereq_(134);
var getActiveElement = _dereq_(136);
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(elem) {
return elem && (
((elem.nodeName === 'INPUT' && elem.type === 'text') ||
elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
);
},
getSelectionInformation: function() {
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(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(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') {
// 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(input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof 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') {
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;
},{}],72:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactInstanceHandles
* @typechecks static-only
*/
'use strict';
var ReactRootIndex = _dereq_(91);
var invariant = _dereq_(150);
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
var MAX_TREE_DEPTH = 100;
/**
* Creates a DOM ID prefix to use when mounting React components.
*
* @param {number} index A unique integer
* @return {string} React root ID.
* @internal
*/
function getReactRootIDString(index) {
return SEPARATOR + index.toString(36);
}
/**
* Checks if a character in the supplied ID is a separator or the end.
*
* @param {string} id A React DOM ID.
* @param {number} index Index of the character to check.
* @return {boolean} True if the character is a separator or end of the ID.
* @private
*/
function isBoundary(id, index) {
return id.charAt(index) === SEPARATOR || index === id.length;
}
/**
* Checks if the supplied string is a valid React DOM ID.
*
* @param {string} id A React DOM ID, maybe.
* @return {boolean} True if the string is a valid React DOM ID.
* @private
*/
function isValidID(id) {
return id === '' || (
id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
);
}
/**
* Checks if the first ID is an ancestor of or equal to the second ID.
*
* @param {string} ancestorID
* @param {string} descendantID
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
return (
descendantID.indexOf(ancestorID) === 0 &&
isBoundary(descendantID, ancestorID.length)
);
}
/**
* Gets the parent ID of the supplied React DOM ID, `id`.
*
* @param {string} id ID of a component.
* @return {string} ID of the parent, or an empty string.
* @private
*/
function getParentID(id) {
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
}
/**
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
* supplied `destinationID`. If they are equal, the ID is returned.
*
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
* @param {string} destinationID ID of the destination node.
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
("production" !== "development" ? invariant(
isValidID(ancestorID) && isValidID(destinationID),
'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
ancestorID,
destinationID
) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
("production" !== "development" ? invariant(
isAncestorIDOf(ancestorID, destinationID),
'getNextDescendantID(...): React has made an invalid assumption about ' +
'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
ancestorID,
destinationID
) : invariant(isAncestorIDOf(ancestorID, destinationID)));
if (ancestorID === destinationID) {
return ancestorID;
}
// Skip over the ancestor and the immediate separator. Traverse until we hit
// another separator or we reach the end of `destinationID`.
var start = ancestorID.length + SEPARATOR_LENGTH;
var i;
for (i = start; i < destinationID.length; i++) {
if (isBoundary(destinationID, i)) {
break;
}
}
return destinationID.substr(0, i);
}
/**
* Gets the nearest common ancestor ID of two IDs.
*
* Using this ID scheme, the nearest common ancestor ID is the longest common
* prefix of the two IDs that immediately preceded a "marker" in both strings.
*
* @param {string} oneID
* @param {string} twoID
* @return {string} Nearest common ancestor ID, or the empty string if none.
* @private
*/
function getFirstCommonAncestorID(oneID, twoID) {
var minLength = Math.min(oneID.length, twoID.length);
if (minLength === 0) {
return '';
}
var lastCommonMarkerIndex = 0;
// Use `<=` to traverse until the "EOL" of the shorter string.
for (var i = 0; i <= minLength; i++) {
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
lastCommonMarkerIndex = i;
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
break;
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
("production" !== "development" ? invariant(
isValidID(longestCommonID),
'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
oneID,
twoID,
longestCommonID
) : invariant(isValidID(longestCommonID)));
return longestCommonID;
}
/**
* Traverses the parent path between two IDs (either up or down). The IDs must
* not be the same, and there must exist a parent path between them. If the
* callback returns `false`, traversal is stopped.
*
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
*/
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
("production" !== "development" ? invariant(
start !== stop,
'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
start
) : invariant(start !== stop));
var traverseUp = isAncestorIDOf(stop, start);
("production" !== "development" ? invariant(
traverseUp || isAncestorIDOf(start, stop),
'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
'not have a parent path.',
start,
stop
) : invariant(traverseUp || isAncestorIDOf(start, stop)));
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
for (var id = start; /* until break */; id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
}
if (ret === false || id === stop) {
// Only break //after// visiting `stop`.
break;
}
("production" !== "development" ? invariant(
depth++ < MAX_TREE_DEPTH,
'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
start, stop
) : invariant(depth++ < MAX_TREE_DEPTH));
}
}
/**
* Manages the IDs assigned to DOM representations of React components. This
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
* order to simulate events).
*
* @internal
*/
var ReactInstanceHandles = {
/**
* Constructs a React root ID
* @return {string} A React root ID.
*/
createReactRootID: function() {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
/**
* Constructs a React ID by joining a root ID with a name.
*
* @param {string} rootID Root ID of a parent component.
* @param {string} name A component's name (as flattened children).
* @return {string} A React ID.
* @internal
*/
createReactID: function(rootID, name) {
return rootID + name;
},
/**
* Gets the DOM ID of the React component that is the root of the tree that
* contains the React component with the supplied DOM ID.
*
* @param {string} id DOM ID of a React component.
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
getReactRootIDFromNodeID: function(id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
}
return null;
},
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* NOTE: Does not invoke the callback on the nearest common ancestor because
* nothing "entered" or "left" that element.
*
* @param {string} leaveID ID being left.
* @param {string} enterID ID being entered.
* @param {function} cb Callback to invoke on each entered/left ID.
* @param {*} upArg Argument to invoke the callback with on left IDs.
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
}
if (ancestorID !== enterID) {
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
}
},
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseTwoPhase: function(targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
}
},
/**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseAncestors: function(targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
/**
* Exposed for unit testing.
* @private
*/
_getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
* @private
*/
_getNextDescendantID: getNextDescendantID,
isAncestorIDOf: isAncestorIDOf,
SEPARATOR: SEPARATOR
};
module.exports = ReactInstanceHandles;
},{}],73:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactInstanceMap
*/
'use strict';
/**
* `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(key) {
key._reactInternalInstance = undefined;
},
get: function(key) {
return key._reactInternalInstance;
},
has: function(key) {
return key._reactInternalInstance !== undefined;
},
set: function(key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
},{}],74:[function(_dereq_,module,exports){
/**
* Copyright 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.
*
* @providesModule ReactLifeCycle
*/
'use strict';
/**
* This module manages the bookkeeping when a component is in the process
* of being mounted or being unmounted. This is used as a way to enforce
* invariants (or warnings) when it is not recommended to call
* setState/forceUpdate.
*
* currentlyMountingInstance: During the construction phase, it is not possible
* to trigger an update since the instance is not fully mounted yet. However, we
* currently allow this as a convenience for mutating the initial state.
*
* currentlyUnmountingInstance: During the unmounting phase, the instance is
* still mounted and can therefore schedule an update. However, this is not
* recommended and probably an error since it's about to be unmounted.
* Therefore we still want to trigger in an error for that case.
*/
var ReactLifeCycle = {
currentlyMountingInstance: null,
currentlyUnmountingInstance: null
};
module.exports = ReactLifeCycle;
},{}],75:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactLink
* @typechecks static-only
*/
'use strict';
/**
* ReactLink encapsulates a common pattern in which a component wants to modify
* a prop received from its parent. ReactLink allows the parent to pass down a
* value coupled with a callback that, when invoked, expresses an intent to
* modify that value. For example:
*
* React.createClass({
* getInitialState: function() {
* return {value: ''};
* },
* render: function() {
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
* this._handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
*
* We have provided some sugary mixins to make the creation and
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
var React = _dereq_(31);
/**
* @param {*} value current value of the link
* @param {function} requestChange callback to request a change
*/
function ReactLink(value, requestChange) {
this.value = value;
this.requestChange = requestChange;
}
/**
* Creates a PropType that enforces the ReactLink API and optionally checks the
* type of the value being passed inside the link. Example:
*
* MyComponent.propTypes = {
* tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
* }
*/
function createLinkTypeChecker(linkType) {
var shapes = {
value: typeof linkType === 'undefined' ?
React.PropTypes.any.isRequired :
linkType.isRequired,
requestChange: React.PropTypes.func.isRequired
};
return React.PropTypes.shape(shapes);
}
ReactLink.PropTypes = {
link: createLinkTypeChecker
};
module.exports = ReactLink;
},{}],76:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactMarkupChecksum
*/
'use strict';
var adler32 = _dereq_(119);
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function(markup) {
var checksum = adler32(markup);
return markup.replace(
'>',
' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
);
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function(markup, element) {
var existingChecksum = element.getAttribute(
ReactMarkupChecksum.CHECKSUM_ATTR_NAME
);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
},{}],77:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactMount
*/
'use strict';
var DOMProperty = _dereq_(11);
var ReactBrowserEventEmitter = _dereq_(33);
var ReactCurrentOwner = _dereq_(45);
var ReactElement = _dereq_(63);
var ReactElementValidator = _dereq_(64);
var ReactEmptyComponent = _dereq_(65);
var ReactInstanceHandles = _dereq_(72);
var ReactInstanceMap = _dereq_(73);
var ReactMarkupChecksum = _dereq_(76);
var ReactPerf = _dereq_(82);
var ReactReconciler = _dereq_(89);
var ReactUpdateQueue = _dereq_(99);
var ReactUpdates = _dereq_(100);
var emptyObject = _dereq_(130);
var containsNode = _dereq_(123);
var getReactRootElementInContainer = _dereq_(144);
var instantiateReactComponent = _dereq_(149);
var invariant = _dereq_(150);
var setInnerHTML = _dereq_(164);
var shouldUpdateReactComponent = _dereq_(167);
var warning = _dereq_(171);
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
if ("production" !== "development") {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
// Used to store breadth-first search state in findComponentRoot.
var findComponentRootReusableArray = [];
/**
* 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} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
function getReactRootID(container) {
var rootElement = getReactRootElementInContainer(container);
return rootElement && ReactMount.getID(rootElement);
}
/**
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
* element can return its control whose name or ID equals ATTR_NAME. All
* DOM nodes support `getAttributeNode` but this can also get called on
* other objects so just return '' if we're given something other than a
* DOM node (such as window).
*
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
* @return {string} ID of the supplied `domNode`.
*/
function getID(node) {
var id = internalGetID(node);
if (id) {
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
("production" !== "development" ? invariant(
!isValid(cached, id),
'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
ATTR_NAME, id
) : invariant(!isValid(cached, id)));
nodeCache[id] = node;
}
} else {
nodeCache[id] = node;
}
}
return id;
}
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 && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Sets the React-specific ID of the given node.
*
* @param {DOMElement} node The DOM node whose ID will be set.
* @param {string} id The value of the ID attribute.
*/
function setID(node, id) {
var oldID = internalGetID(node);
if (oldID !== id) {
delete nodeCache[oldID];
}
node.setAttribute(ATTR_NAME, id);
nodeCache[id] = node;
}
/**
* Finds the node with the supplied React-generated DOM ID.
*
* @param {string} id A React-generated DOM ID.
* @return {DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNode(id) {
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* Finds the node with the supplied public React instance.
*
* @param {*} instance A public React instance.
* @return {?DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
if (ReactEmptyComponent.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* A node is "valid" if it is contained by a currently mounted container.
*
* This means that the node does not have to be contained by a document in
* order to be considered valid.
*
* @param {?DOMElement} node The candidate DOM node.
* @param {string} id The expected ID of the node.
* @return {boolean} Whether the node is contained by a mounted container.
*/
function isValid(node, id) {
if (node) {
("production" !== "development" ? invariant(
internalGetID(node) === id,
'ReactMount: Unexpected modification of `%s`',
ATTR_NAME
) : invariant(internalGetID(node) === id));
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
return true;
}
}
return false;
}
/**
* Causes the cache to forget about one React-specific ID.
*
* @param {string} id The ID to forget.
*/
function purgeID(id) {
delete nodeCache[id];
}
var deepestNodeSoFar = null;
function findDeepestCachedAncestorImpl(ancestorID) {
var ancestor = nodeCache[ancestorID];
if (ancestor && isValid(ancestor, ancestorID)) {
deepestNodeSoFar = ancestor;
} else {
// This node isn't populated in the cache, so presumably none of its
// descendants are. Break out of the loop.
return false;
}
}
/**
* Return the deepest cached node whose ID is a prefix of `targetID`.
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
ReactInstanceHandles.traverseAncestors(
targetID,
findDeepestCachedAncestorImpl
);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
return foundNode;
}
/**
* Mounts this component and inserts it into the DOM.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function mountComponentIntoNode(
componentInstance,
rootID,
container,
transaction,
shouldReuseMarkup) {
var markup = ReactReconciler.mountComponent(
componentInstance, rootID, transaction, emptyObject
);
componentInstance._isTopLevel = true;
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
}
/**
* Batched mount.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function batchedMountComponentIntoNode(
componentInstance,
rootID,
container,
shouldReuseMarkup) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
transaction.perform(
mountComponentIntoNode,
null,
componentInstance,
rootID,
container,
transaction,
shouldReuseMarkup
);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
* Mounting is the process of initializing a React component by creatings 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 = {
/** Exposed for debugging purposes **/
_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(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(
prevComponent,
nextElement,
container,
callback) {
if ("production" !== "development") {
ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
}
ReactMount.scrollMonitor(container, function() {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
if ("production" !== "development") {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[getReactRootID(container)] =
getReactRootElementInContainer(container);
}
return prevComponent;
},
/**
* Register a component into the instance map and starts scroll value
* monitoring
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
_registerComponent: function(nextComponent, container) {
("production" !== "development" ? invariant(
container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
),
'_registerComponent(...): Target container is not a DOM element.'
) : invariant(container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
)));
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var reactRootID = ReactMount.registerContainer(container);
instancesByReactRootID[reactRootID] = nextComponent;
return reactRootID;
},
/**
* Render a new component into the DOM.
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: function(
nextComponent,
container,
shouldReuseMarkup
) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
("production" !== "development" ? 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.'
) : null);
var componentInstance = instantiateReactComponent(nextComponent, null);
var reactRootID = ReactMount._registerComponent(
componentInstance,
container
);
// 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,
reactRootID,
container,
shouldReuseMarkup
);
if ("production" !== "development") {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[reactRootID] =
getReactRootElementInContainer(container);
}
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 {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(nextElement, container, callback) {
("production" !== "development" ? invariant(
ReactElement.isValidElement(nextElement),
'React.render(): Invalid component element.%s',
(
typeof nextElement === 'string' ?
' Instead of passing an element string, make sure to instantiate ' +
'it by passing it to React.createElement.' :
typeof nextElement === 'function' ?
' Instead of passing a component class, make sure to instantiate ' +
'it by passing it to React.createElement.' :
// Check if it quacks like an element
nextElement != null && nextElement.props !== undefined ?
' This may be caused by unintentionally loading two independent ' +
'copies of React.' :
''
)
) : invariant(ReactElement.isValidElement(nextElement)));
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
var prevElement = prevComponent._currentElement;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
return ReactMount._updateRootComponent(
prevComponent,
nextElement,
container,
callback
).getPublicInstance();
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup =
reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
if ("production" !== "development") {
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (ReactMount.isRenderedByReact(rootElementSibling)) {
("production" !== "development" ? 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.'
) : null);
break;
}
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
var component = ReactMount._renderNewRootComponent(
nextElement,
container,
shouldReuseMarkup
).getPublicInstance();
if (callback) {
callback.call(component);
}
return component;
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into the supplied `container`.
*
* @param {function} constructor React component constructor.
* @param {?object} props Initial props of the component instance.
* @param {DOMElement} container DOM element to render into.
* @return {ReactComponent} Component instance rendered in `container`.
*/
constructAndRenderComponent: function(constructor, props, container) {
var element = ReactElement.createElement(constructor, props);
return ReactMount.render(element, container);
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into a container node identified by supplied `id`.
*
* @param {function} componentConstructor React component constructor
* @param {?object} props Initial props of the component instance.
* @param {string} id ID of the DOM element to render into.
* @return {ReactComponent} Component instance rendered in the container node.
*/
constructAndRenderComponentByID: function(constructor, props, id) {
var domNode = document.getElementById(id);
("production" !== "development" ? invariant(
domNode,
'Tried to get element with id of "%s" but it is not present on the page.',
id
) : invariant(domNode));
return ReactMount.constructAndRenderComponent(constructor, props, domNode);
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reactRoot" ID that will be assigned to the element
* rendered within.
*
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
registerContainer: function(container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
}
if (!reactRootID) {
// No valid "reactRoot" ID found, create one.
reactRootID = ReactInstanceHandles.createReactRootID();
}
containersByReactRootID[reactRootID] = container;
return reactRootID;
},
/**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function(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.)
("production" !== "development" ? 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.'
) : null);
("production" !== "development" ? invariant(
container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
),
'unmountComponentAtNode(...): Target container is not a DOM element.'
) : invariant(container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
)));
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
return false;
}
ReactMount.unmountComponentFromNode(component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
if ("production" !== "development") {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
* 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}
*/
unmountComponentFromNode: function(instance, container) {
ReactReconciler.unmountComponent(instance);
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
},
/**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
findReactContainerForID: function(id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if ("production" !== "development") {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
("production" !== "development" ? invariant(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID,
'ReactMount: Root element ID differed from reactRootID.'
) : invariant(// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID));
var containerChild = container.firstChild;
if (containerChild &&
reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
("production" !== "development" ? warning(
false,
'ReactMount: Root element has been removed from its original ' +
'container. New container:', rootElement.parentNode
) : null);
}
}
}
return container;
},
/**
* Finds an element rendered by React with the supplied ID.
*
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
findReactNodeByID: function(id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
* True if the supplied `node` is rendered by React.
*
* @param {*} node DOM Element to check.
* @return {boolean} True if the DOM Element appears to be rendered by React.
* @internal
*/
isRenderedByReact: function(node) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
return false;
}
var id = ReactMount.getID(node);
return id ? id.charAt(0) === SEPARATOR : false;
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
getFirstReactDOM: function(node) {
var current = node;
while (current && current.parentNode !== current) {
if (ReactMount.isRenderedByReact(current)) {
return current;
}
current = current.parentNode;
}
return null;
},
/**
* Finds a node with the supplied `targetID` inside of the supplied
* `ancestorNode`. Exploits the ID naming scheme to perform the search
* quickly.
*
* @param {DOMEventTarget} ancestorNode Search from this root.
* @pararm {string} targetID ID of the DOM representation of the component.
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
findComponentRoot: function(ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
while (childIndex < firstChildren.length) {
var child = firstChildren[childIndex++];
var targetChild;
while (child) {
var childID = ReactMount.getID(child);
if (childID) {
// Even if we find the node we're looking for, we finish looping
// through its siblings to ensure they're cached so that we don't have
// to revisit this node again. Otherwise, we make n^2 calls to getID
// when visiting the many children of a single node in order.
if (targetID === childID) {
targetChild = child;
} else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
// If we find a child whose ID is an ancestor of the given ID,
// then we can be sure that we only want to search the subtree
// rooted at this child, so we can throw out the rest of the
// search state.
firstChildren.length = childIndex = 0;
firstChildren.push(child.firstChild);
}
} else {
// If this child had no ID, then there's a chance that it was
// injected automatically by the browser, as when a `<table>`
// element sprouts an extra `<tbody>` child as a side effect of
// `.innerHTML` parsing. Optimistically continue down this
// branch, but not before examining the other siblings.
firstChildren.push(child.firstChild);
}
child = child.nextSibling;
}
if (targetChild) {
// Emptying firstChildren/findComponentRootReusableArray is
// not necessary for correctness, but it helps the GC reclaim
// any nodes that were left at the end of the search.
firstChildren.length = 0;
return targetChild;
}
}
firstChildren.length = 0;
("production" !== "development" ? invariant(
false,
'findComponentRoot(..., %s): Unable to find element. This probably ' +
'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
'usually due to forgetting a <tbody> when using tables, nesting tags ' +
'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
'parent. ' +
'Try inspecting the child nodes of the element with React ID `%s`.',
targetID,
ReactMount.getID(ancestorNode)
) : invariant(false));
},
_mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
("production" !== "development" ? invariant(
container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
),
'mountComponentIntoNode(...): Target container is not valid.'
) : invariant(container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
)));
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, 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 diffIndex = firstDifferenceIndex(markup, rootMarkup);
var difference = ' (client) ' +
markup.substring(diffIndex - 20, diffIndex + 20) +
'\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
("production" !== "development" ? invariant(
container.nodeType !== DOC_NODE_TYPE,
'You\'re trying to render a component to the document using ' +
'server rendering but the checksum was invalid. This usually ' +
'means you rendered a different component type or props on ' +
'the client from the one on the server, or your render() ' +
'methods are impure. React cannot handle this case due to ' +
'cross-browser quirks by rendering at the document root. You ' +
'should look for environment dependent code in your components ' +
'and ensure the props are the same client and server side:\n%s',
difference
) : invariant(container.nodeType !== DOC_NODE_TYPE));
if ("production" !== "development") {
("production" !== "development" ? 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
) : null);
}
}
}
("production" !== "development" ? invariant(
container.nodeType !== DOC_NODE_TYPE,
'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 React.renderToString() for server rendering.'
) : invariant(container.nodeType !== DOC_NODE_TYPE));
setInnerHTML(container, markup);
},
/**
* React ID utilities.
*/
getReactRootID: getReactRootID,
getID: getID,
setID: setID,
getNode: getNode,
getNodeFromInstance: getNodeFromInstance,
purgeID: purgeID
};
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
_renderNewRootComponent: '_renderNewRootComponent',
_mountImageIntoNode: '_mountImageIntoNode'
});
module.exports = ReactMount;
},{}],78:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
'use strict';
var ReactComponentEnvironment = _dereq_(41);
var ReactMultiChildUpdateTypes = _dereq_(79);
var ReactReconciler = _dereq_(89);
var ReactChildReconciler = _dereq_(36);
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
textContent: null,
fromIndex: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
textContent: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponentEnvironment.processChildrenUpdates(
updateQueue,
markupQueue
);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function(nestedChildren, transaction, context) {
var children = ReactChildReconciler.instantiateChildren(
nestedChildren, transaction, context
);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(
child,
rootID,
transaction,
context
);
child._mountIndex = index;
mountImages.push(mountImage);
index++;
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function(nextContent) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
}
}
// Set new text content.
this.setTextContent(nextContent);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function(nextNestedChildren, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildren, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function(nextNestedChildren, transaction, context) {
var prevChildren = this._renderedChildren;
var nextChildren = ReactChildReconciler.updateChildren(
prevChildren, nextNestedChildren, transaction, context
);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChildByName(prevChild, name);
}
// The child must be instantiated before it's mounted.
this._mountChildByNameAtIndex(
nextChild, name, nextIndex, transaction, context
);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
!(nextChildren && nextChildren.hasOwnProperty(name))) {
this._unmountChildByName(prevChildren[name], name);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function() {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function(child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function(child, mountImage) {
enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function(child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function(textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function(
child,
name,
index,
transaction,
context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(
child,
rootID,
transaction,
context
);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
* Unmounts a rendered child by name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
_unmountChildByName: function(child, name) {
this.removeChild(child);
child._mountIndex = null;
}
}
};
module.exports = ReactMultiChild;
},{}],79:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactMultiChildUpdateTypes
*/
'use strict';
var keyMirror = _dereq_(156);
/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
},{}],80:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactNativeComponent
*/
'use strict';
var assign = _dereq_(29);
var invariant = _dereq_(150);
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
// This registry keeps track of wrapper classes around native tags
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
injectGenericComponentClass: function(componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
injectTextComponentClass: function(componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
injectComponentClasses: function(componentClasses) {
assign(tagToComponentClass, componentClasses);
},
// Temporary hack since we expect DOM refs to behave like composites,
// for this release.
injectAutoWrapper: function(wrapperFactory) {
autoGenerateWrapperClass = wrapperFactory;
}
};
/**
* Get a composite component wrapper class for a specific tag.
*
* @param {ReactElement} element The tag for which to get the class.
* @return {function} The React class constructor function.
*/
function getComponentClassForElement(element) {
if (typeof element.type === 'function') {
return element.type;
}
var tag = element.type;
var componentClass = tagToComponentClass[tag];
if (componentClass == null) {
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
}
return componentClass;
}
/**
* Get a native internal component class for a specific tag.
*
* @param {ReactElement} element The element to create.
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
("production" !== "development" ? invariant(
genericComponentClass,
'There is no registered component for the tag %s',
element.type
) : invariant(genericComponentClass));
return new genericComponentClass(element.type, element.props);
}
/**
* @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 ReactNativeComponent = {
getComponentClassForElement: getComponentClassForElement,
createInternalComponent: createInternalComponent,
createInstanceForText: createInstanceForText,
isTextComponent: isTextComponent,
injection: ReactNativeComponentInjection
};
module.exports = ReactNativeComponent;
},{}],81:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactOwner
*/
'use strict';
var invariant = _dereq_(150);
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function(object) {
return !!(
(object &&
typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
);
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function(component, ref, owner) {
("production" !== "development" ? invariant(
ReactOwner.isValidOwner(owner),
'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
'usually means that you\'re trying to add a ref to a component that ' +
'doesn\'t have an owner (that is, was not created inside of another ' +
'component\'s `render` method). Try rendering this component inside of ' +
'a new top-level component which will hold the ref.'
) : invariant(ReactOwner.isValidOwner(owner)));
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function(component, ref, owner) {
("production" !== "development" ? invariant(
ReactOwner.isValidOwner(owner),
'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
'usually means that you\'re trying to remove a ref to a component that ' +
'doesn\'t have an owner (that is, was not created inside of another ' +
'component\'s `render` method). Try rendering this component inside of ' +
'a new top-level component which will hold the ref.'
) : invariant(ReactOwner.isValidOwner(owner)));
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
};
module.exports = ReactOwner;
},{}],82:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactPerf
* @typechecks static-only
*/
'use strict';
/**
* ReactPerf is a general AOP system designed to measure performance. This
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
*/
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
* accidental logging and perf loss.
*/
enableMeasure: false,
/**
* Holds onto the measure function in use. By default, don't measure
* anything, but we'll override this if we inject a measure function.
*/
storedMeasure: _noMeasure,
/**
* @param {object} object
* @param {string} objectName
* @param {object<string>} methodNames
*/
measureMethods: function(object, objectName, methodNames) {
if ("production" !== "development") {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
object[key] = ReactPerf.measure(
objectName,
methodNames[key],
object[key]
);
}
}
},
/**
* Use this to wrap methods you want to measure. Zero overhead in production.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function(objName, fnName, func) {
if ("production" !== "development") {
var measuredFunc = null;
var wrapper = function() {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
}
return measuredFunc.apply(this, arguments);
}
return func.apply(this, arguments);
};
wrapper.displayName = objName + '_' + fnName;
return wrapper;
}
return func;
},
injection: {
/**
* @param {function} measure
*/
injectMeasure: function(measure) {
ReactPerf.storedMeasure = measure;
}
}
};
/**
* Simply passes through the measured function, without measuring it.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
function _noMeasure(objName, fnName, func) {
return func;
}
module.exports = ReactPerf;
},{}],83:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactPropTransferer
*/
'use strict';
var assign = _dereq_(29);
var emptyFunction = _dereq_(129);
var joinClasses = _dereq_(155);
/**
* Creates a transfer strategy that will merge prop values using the supplied
* `mergeStrategy`. If a prop was previously unset, this just sets it.
*
* @param {function} mergeStrategy
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
return function(props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
props[key] = mergeStrategy(props[key], value);
}
};
}
var transferStrategyMerge = createTransferStrategy(function(a, b) {
// `merge` overrides the first object's (`props[key]` above) keys using the
// second object's (`value`) keys. An object's style's existing `propA` would
// get overridden. Flip the order here.
return assign({}, b, a);
});
/**
* Transfer strategies dictate how props are transferred by `transferPropsTo`.
* NOTE: if you add any more exceptions to this list you should be sure to
* update `cloneWithProps()` accordingly.
*/
var TransferStrategies = {
/**
* Never transfer `children`.
*/
children: emptyFunction,
/**
* Transfer the `className` prop by merging them.
*/
className: createTransferStrategy(joinClasses),
/**
* Transfer the `style` prop (which is an object) by merging them.
*/
style: transferStrategyMerge
};
/**
* Mutates the first argument by transferring the properties from the second
* argument.
*
* @param {object} props
* @param {object} newProps
* @return {object}
*/
function transferInto(props, newProps) {
for (var thisKey in newProps) {
if (!newProps.hasOwnProperty(thisKey)) {
continue;
}
var transferStrategy = TransferStrategies[thisKey];
if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
transferStrategy(props, thisKey, newProps[thisKey]);
} else if (!props.hasOwnProperty(thisKey)) {
props[thisKey] = newProps[thisKey];
}
}
return props;
}
/**
* ReactPropTransferer are capable of transferring props to another component
* using a `transferPropsTo` method.
*
* @class ReactPropTransferer
*/
var ReactPropTransferer = {
/**
* Merge two props objects using TransferStrategies.
*
* @param {object} oldProps original props (they take precedence)
* @param {object} newProps new props to merge in
* @return {object} a new object containing both sets of props merged.
*/
mergeProps: function(oldProps, newProps) {
return transferInto(assign({}, oldProps), newProps);
}
};
module.exports = ReactPropTransferer;
},{}],84:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactPropTypeLocationNames
*/
'use strict';
var ReactPropTypeLocationNames = {};
if ("production" !== "development") {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
},{}],85:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactPropTypeLocations
*/
'use strict';
var keyMirror = _dereq_(156);
var ReactPropTypeLocations = keyMirror({
prop: null,
context: null,
childContext: null
});
module.exports = ReactPropTypeLocations;
},{}],86:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactPropTypes
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactPropTypeLocationNames = _dereq_(84);
var emptyFunction = _dereq_(129);
/**
* 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>>';
var elementTypeChecker = createElementTypeChecker();
var nodeTypeChecker = createNodeChecker();
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: elementTypeChecker,
instanceOf: createInstanceTypeChecker,
node: nodeTypeChecker,
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName, location) {
componentName = componentName || ANONYMOUS;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
return new Error(
("Required " + locationName + " `" + propName + "` was not specified in ") +
("`" + componentName + "`.")
);
}
return null;
} else {
return validate(props, propName, componentName, location);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
var locationName = ReactPropTypeLocationNames[location];
// `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 Error(
("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
);
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturns(null));
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
return new Error(
("Invalid " + locationName + " `" + propName + "` of type ") +
("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
);
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`, expected a ReactElement.")
);
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
);
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
return new Error(
("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
);
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` 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);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
function validate(props, propName, componentName, location) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location) == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`.")
);
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`, expected a ReactNode.")
);
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` 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);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (ReactElement.isValidElement(propValue)) {
return true;
}
for (var k in propValue) {
if (!isNode(propValue[k])) {
return false;
}
}
return true;
default:
return false;
}
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = 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';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
module.exports = ReactPropTypes;
},{}],87:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactPutListenerQueue
*/
'use strict';
var PooledClass = _dereq_(30);
var ReactBrowserEventEmitter = _dereq_(33);
var assign = _dereq_(29);
function ReactPutListenerQueue() {
this.listenersToPut = [];
}
assign(ReactPutListenerQueue.prototype, {
enqueuePutListener: function(rootNodeID, propKey, propValue) {
this.listenersToPut.push({
rootNodeID: rootNodeID,
propKey: propKey,
propValue: propValue
});
},
putListeners: function() {
for (var i = 0; i < this.listenersToPut.length; i++) {
var listenerToPut = this.listenersToPut[i];
ReactBrowserEventEmitter.putListener(
listenerToPut.rootNodeID,
listenerToPut.propKey,
listenerToPut.propValue
);
}
},
reset: function() {
this.listenersToPut.length = 0;
},
destructor: function() {
this.reset();
}
});
PooledClass.addPoolingTo(ReactPutListenerQueue);
module.exports = ReactPutListenerQueue;
},{}],88:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactReconcileTransaction
* @typechecks static-only
*/
'use strict';
var CallbackQueue = _dereq_(7);
var PooledClass = _dereq_(30);
var ReactBrowserEventEmitter = _dereq_(33);
var ReactInputSelection = _dereq_(71);
var ReactPutListenerQueue = _dereq_(87);
var Transaction = _dereq_(116);
var assign = _dereq_(29);
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
initialize: function() {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occured. `close`
* restores the previous value.
*/
close: function(previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function() {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function() {
this.reactMountReady.notifyAll();
}
};
var PUT_LISTENER_QUEUEING = {
initialize: function() {
this.putListenerQueue.reset();
},
close: function() {
this.putListenerQueue.putListeners();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [
PUT_LISTENER_QUEUEING,
SELECTION_RESTORATION,
EVENT_SUPPRESSION,
ON_DOM_READY_QUEUEING
];
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction() {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.putListenerQueue = ReactPutListenerQueue.getPooled();
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap proceedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function() {
return this.reactMountReady;
},
getPutListenerQueue: function() {
return this.putListenerQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be resused.
*/
destructor: function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
this.putListenerQueue = null;
}
};
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
},{}],89:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactReconciler
*/
'use strict';
var ReactRef = _dereq_(90);
var ReactElementValidator = _dereq_(64);
/**
* 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 {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function(internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
if ("production" !== "development") {
ReactElementValidator.checkAndWarnForMutatedProps(
internalInstance._currentElement
);
}
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function(internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
/**
* Update a component using a new element.
*
* @param {ReactComponent} internalInstance
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @internal
*/
receiveComponent: function(
internalInstance, nextElement, transaction, context
) {
var prevElement = internalInstance._currentElement;
if (nextElement === prevElement && nextElement._owner != null) {
// 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.
return;
}
if ("production" !== "development") {
ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
}
var refsChanged = ReactRef.shouldUpdateRefs(
this,
prevElement,
nextElement
);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
}
internalInstance.receiveComponent(nextElement, transaction, context);
if (refsChanged) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
/**
* Flush any dirty changes in a component.
*
* @param {ReactComponent} internalInstance
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function(
internalInstance,
transaction
) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
},{}],90:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactRef
*/
'use strict';
var ReactOwner = _dereq_(81);
var ReactRef = {};
function attachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(component.getPublicInstance());
} else {
// Legacy ref
ReactOwner.addComponentAsRefTo(component, ref, owner);
}
}
function detachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(null);
} else {
// Legacy ref
ReactOwner.removeComponentAsRefFrom(component, ref, owner);
}
}
ReactRef.attachRefs = function(instance, element) {
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
ReactRef.shouldUpdateRefs = function(instance, prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
// of the public this.props because the post processing cannot determine
// a ref. The ref conceptually lives on the element.
// TODO: Should this even be possible? The owner cannot change because
// it's forbidden by shouldUpdateReactComponent. The ref can change
// if you swap the keys of but not the refs. Reconsider where this check
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
return (
nextElement._owner !== prevElement._owner ||
nextElement.ref !== prevElement.ref
);
};
ReactRef.detachRefs = function(instance, element) {
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
}
};
module.exports = ReactRef;
},{}],91:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactRootIndex
* @typechecks
*/
'use strict';
var ReactRootIndexInjection = {
/**
* @param {function} _createReactRootIndex
*/
injectCreateReactRootIndex: function(_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
var ReactRootIndex = {
createReactRootIndex: null,
injection: ReactRootIndexInjection
};
module.exports = ReactRootIndex;
},{}],92:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @typechecks static-only
* @providesModule ReactServerRendering
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactInstanceHandles = _dereq_(72);
var ReactMarkupChecksum = _dereq_(76);
var ReactServerRenderingTransaction =
_dereq_(93);
var emptyObject = _dereq_(130);
var instantiateReactComponent = _dereq_(149);
var invariant = _dereq_(150);
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
("production" !== "development" ? invariant(
ReactElement.isValidElement(element),
'renderToString(): You must pass a valid ReactElement.'
) : invariant(ReactElement.isValidElement(element)));
var transaction;
try {
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
return transaction.perform(function() {
var componentInstance = instantiateReactComponent(element, null);
var markup =
componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
}
}
/**
* @param {ReactElement} element
* @return {string} the HTML markup, without the extra React ID and checksum
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
("production" !== "development" ? invariant(
ReactElement.isValidElement(element),
'renderToStaticMarkup(): You must pass a valid ReactElement.'
) : invariant(ReactElement.isValidElement(element)));
var transaction;
try {
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
return transaction.perform(function() {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
}
}
module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
},{}],93:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule ReactServerRenderingTransaction
* @typechecks
*/
'use strict';
var PooledClass = _dereq_(30);
var CallbackQueue = _dereq_(7);
var ReactPutListenerQueue = _dereq_(87);
var Transaction = _dereq_(116);
var assign = _dereq_(29);
var emptyFunction = _dereq_(129);
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function() {
this.reactMountReady.reset();
},
close: emptyFunction
};
var PUT_LISTENER_QUEUEING = {
initialize: function() {
this.putListenerQueue.reset();
},
close: emptyFunction
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [
PUT_LISTENER_QUEUEING,
ON_DOM_READY_QUEUEING
];
/**
* @class ReactServerRenderingTransaction
* @param {boolean} renderToStaticMarkup
*/
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
this.putListenerQueue = ReactPutListenerQueue.getPooled();
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array} Empty list of operation wrap proceedures.
*/
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function() {
return this.reactMountReady;
},
getPutListenerQueue: function() {
return this.putListenerQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be resused.
*/
destructor: function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
this.putListenerQueue = null;
}
};
assign(
ReactServerRenderingTransaction.prototype,
Transaction.Mixin,
Mixin
);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
},{}],94:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactStateSetters
*/
'use strict';
var ReactStateSetters = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* @param {ReactCompositeComponent} component
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(component, funcReturningState) {
return function(a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {ReactCompositeComponent} component
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
}
};
function createStateKeySetter(component, key) {
// Partial state is allocated outside of the function closure so it can be
// reused with every call, avoiding memory allocation when this function
// is called.
var partialState = {};
return function stateKeySetter(value) {
partialState[key] = value;
component.setState(partialState);
};
}
ReactStateSetters.Mixin = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateSetter(function(xValue) {
* return {x: xValue};
* })(1);
*
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateKeySetter('x')(1);
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
module.exports = ReactStateSetters;
},{}],95:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactTestUtils
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPluginHub = _dereq_(18);
var EventPropagators = _dereq_(21);
var React = _dereq_(31);
var ReactElement = _dereq_(63);
var ReactBrowserEventEmitter = _dereq_(33);
var ReactCompositeComponent = _dereq_(43);
var ReactInstanceHandles = _dereq_(72);
var ReactInstanceMap = _dereq_(73);
var ReactMount = _dereq_(77);
var ReactUpdates = _dereq_(100);
var SyntheticEvent = _dereq_(108);
var assign = _dereq_(29);
var topLevelTypes = EventConstants.topLevelTypes;
function Event(suffix) {}
/**
* @class ReactTestUtils
*/
/**
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
var ReactTestUtils = {
renderIntoDocument: function(instance) {
var div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
return React.render(instance, div);
},
isElement: function(element) {
return ReactElement.isValidElement(element);
},
isElementOfType: function(inst, convenienceConstructor) {
return (
ReactElement.isValidElement(inst) &&
inst.type === convenienceConstructor
);
},
isDOMComponent: function(inst) {
// TODO: Fix this heuristic. It's just here because composites can currently
// pretend to be DOM components.
return !!(inst && inst.getDOMNode && inst.tagName);
},
isDOMComponentElement: function(inst) {
return !!(inst &&
ReactElement.isValidElement(inst) &&
!!inst.tagName);
},
isCompositeComponent: function(inst) {
return typeof inst.render === 'function' &&
typeof inst.setState === 'function';
},
isCompositeComponentWithType: function(inst, type) {
return !!(ReactTestUtils.isCompositeComponent(inst) &&
(inst.constructor === type));
},
isCompositeComponentElement: function(inst) {
if (!ReactElement.isValidElement(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
return (
typeof prototype.render === 'function' &&
typeof prototype.setState === 'function'
);
},
isCompositeComponentElementWithType: function(inst, type) {
return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
(inst.constructor === type));
},
getRenderedChildOfCompositeComponent: function(inst) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return null;
}
var internalInstance = ReactInstanceMap.get(inst);
return internalInstance._renderedComponent.getPublicInstance();
},
findAllInRenderedTree: function(inst, test) {
if (!inst) {
return [];
}
var ret = test(inst) ? [inst] : [];
if (ReactTestUtils.isDOMComponent(inst)) {
var internalInstance = ReactInstanceMap.get(inst);
var renderedChildren = internalInstance
._renderedComponent
._renderedChildren;
var key;
for (key in renderedChildren) {
if (!renderedChildren.hasOwnProperty(key)) {
continue;
}
if (!renderedChildren[key].getPublicInstance) {
continue;
}
ret = ret.concat(
ReactTestUtils.findAllInRenderedTree(
renderedChildren[key].getPublicInstance(),
test
)
);
}
} else if (ReactTestUtils.isCompositeComponent(inst)) {
ret = ret.concat(
ReactTestUtils.findAllInRenderedTree(
ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
test
)
);
}
return ret;
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
* @return an array of all the matches.
*/
scryRenderedDOMComponentsWithClass: function(root, className) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
var instClassName = inst.props.className;
return ReactTestUtils.isDOMComponent(inst) && (
(instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
);
});
},
/**
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithClass: function(root, className) {
var all =
ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match '+
'(found: ' + all.length + ') for class:' + className
);
}
return all[0];
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
* @return an array of all the matches.
*/
scryRenderedDOMComponentsWithTag: function(root, tagName) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
return ReactTestUtils.isDOMComponent(inst) &&
inst.tagName === tagName.toUpperCase();
});
},
/**
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithTag: function(root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for tag:' + tagName);
}
return all[0];
},
/**
* Finds all instances of components with type equal to `componentType`.
* @return an array of all the matches.
*/
scryRenderedComponentsWithType: function(root, componentType) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
return ReactTestUtils.isCompositeComponentWithType(
inst,
componentType
);
});
},
/**
* Same as `scryRenderedComponentsWithType` but expects there to be one result
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
findRenderedComponentWithType: function(root, componentType) {
var all = ReactTestUtils.scryRenderedComponentsWithType(
root,
componentType
);
if (all.length !== 1) {
throw new Error(
'Did not find exactly one match for componentType:' + componentType
);
}
return all[0];
},
/**
* Pass a mocked component module to this method to augment it with
* useful methods that allow it to be used as a dummy React component.
* Instead of rendering as usual, the component will become a simple
* <div> containing any provided children.
*
* @param {object} module the mock function object exported from a
* module that defines the component to be mocked
* @param {?string} mockTagName optional dummy root tag name to return
* from render method (overrides
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
mockComponent: function(module, mockTagName) {
mockTagName = mockTagName || module.mockTagName || "div";
module.prototype.render.mockImplementation(function() {
return React.createElement(
mockTagName,
null,
this.props.children
);
});
return this;
},
/**
* Simulates a top level event being dispatched from a raw event that occured
* on an `Element` node.
* @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
topLevelType,
fakeNativeEvent
);
},
/**
* Simulates a top level event being dispatched from a raw event that occured
* on the `ReactDOMComponent` `comp`.
* @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
* @param comp {!ReactDOMComponent}
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateNativeEventOnDOMComponent: function(
topLevelType,
comp,
fakeNativeEvent) {
ReactTestUtils.simulateNativeEventOnNode(
topLevelType,
comp.getDOMNode(),
fakeNativeEvent
);
},
nativeTouchData: function(x, y) {
return {
touches: [
{pageX: x, pageY: y}
]
};
},
createRenderer: function() {
return new ReactShallowRenderer();
},
Simulate: null,
SimulateNative: {}
};
/**
* @class ReactShallowRenderer
*/
var ReactShallowRenderer = function() {
this._instance = null;
};
ReactShallowRenderer.prototype.getRenderOutput = function() {
return (
(this._instance && this._instance._renderedComponent &&
this._instance._renderedComponent._currentElement)
|| null
);
};
var NoopInternalComponent = function(element) {
this._currentElement = element;
}
NoopInternalComponent.prototype = {
mountComponent: function() {
},
receiveComponent: function(element) {
this._currentElement = element;
},
unmountComponent: function() {
}
};
var ShallowComponentWrapper = function() { };
assign(
ShallowComponentWrapper.prototype,
ReactCompositeComponent.Mixin, {
_instantiateReactComponent: function(element) {
return new NoopInternalComponent(element);
},
_replaceNodeWithMarkupByID: function() {},
_renderValidatedComponent:
ReactCompositeComponent.Mixin.
_renderValidatedComponentWithoutOwnerOrContext
}
);
ReactShallowRenderer.prototype.render = function(element, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
this._render(element, transaction, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
};
ReactShallowRenderer.prototype._render = function(element, transaction, context) {
if (!this._instance) {
var rootID = ReactInstanceHandles.createReactRootID();
var instance = new ShallowComponentWrapper(element.type);
instance.construct(element);
instance.mountComponent(rootID, transaction, context);
this._instance = instance;
} else {
this._instance.receiveComponent(element, transaction, context);
}
};
/**
* Exports:
*
* - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
return function(domComponentOrNode, eventData) {
var node;
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
node = domComponentOrNode.getDOMNode();
} else if (domComponentOrNode.tagName) {
node = domComponentOrNode;
}
var fakeNativeEvent = new Event();
fakeNativeEvent.target = node;
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
var event = new SyntheticEvent(
ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
ReactMount.getID(node),
fakeNativeEvent
);
assign(event, eventData);
EventPropagators.accumulateTwoPhaseDispatches(event);
ReactUpdates.batchedUpdates(function() {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue();
});
};
}
function buildSimulators() {
ReactTestUtils.Simulate = {};
var eventType;
for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
/**
* @param {!Element || ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
}
}
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
EventPluginHub.injection.injectEventPluginOrder = function() {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
EventPluginHub.injection.injectEventPluginsByName = function() {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
buildSimulators();
/**
* Exports:
*
* - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
* - ... (All keys from `EventConstants.topLevelTypes`)
*
* Note: Top level event types are a subset of the entire set of handler types
* (which include a broader set of "synthetic" events). For example, onDragDone
* is a synthetic event. Except when testing an event plugin or React's event
* handling code specifically, you probably want to use ReactTestUtils.Simulate
* to dispatch synthetic events.
*/
function makeNativeSimulator(eventType) {
return function(domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
ReactTestUtils.simulateNativeEventOnDOMComponent(
eventType,
domComponentOrNode,
fakeNativeEvent
);
} else if (!!domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
ReactTestUtils.simulateNativeEventOnNode(
eventType,
domComponentOrNode,
fakeNativeEvent
);
}
};
}
var eventType;
for (eventType in topLevelTypes) {
// Event type is stored as 'topClick' - we transform that to 'click'
var convenienceName = eventType.indexOf('top') === 0 ?
eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
* @param {!Element || ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
ReactTestUtils.SimulateNative[convenienceName] =
makeNativeSimulator(eventType);
}
module.exports = ReactTestUtils;
},{}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @typechecks static-only
* @providesModule ReactTransitionChildMapping
*/
'use strict';
var ReactChildren = _dereq_(37);
var ReactFragment = _dereq_(69);
var ReactTransitionChildMapping = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
* simple syntactic sugar around ReactChildren.map().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
getChildMapping: function(children) {
if (!children) {
return children;
}
return ReactFragment.extract(ReactChildren.map(children, function(child) {
return child;
}));
},
/**
* When you're adding or removing children some may be added or removed in the
* same render pass. We want to show *both* since we want to simultaneously
* animate elements in and out. This function takes a previous set of keys
* and a new set of keys and merges them with its best guess of the correct
* ordering. In the future we may expose some of the utilities in
* ReactMultiChild to make this easy, but for now React itself does not
* directly have this concept of the union of prevChildren and nextChildren
* so we implement it here.
*
* @param {object} prev prev children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @param {object} next next children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
mergeChildMappings: function(prev, next) {
prev = prev || {};
next = next || {};
function getValueForKey(key) {
if (next.hasOwnProperty(key)) {
return next[key];
} else {
return prev[key];
}
}
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextKeysPending = {};
var pendingKeys = [];
for (var prevKey in prev) {
if (next.hasOwnProperty(prevKey)) {
if (pendingKeys.length) {
nextKeysPending[prevKey] = pendingKeys;
pendingKeys = [];
}
} else {
pendingKeys.push(prevKey);
}
}
var i;
var childMapping = {};
for (var nextKey in next) {
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
pendingNextKey
);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
}
// Finally, add the keys which didn't appear before any key in `next`
for (i = 0; i < pendingKeys.length; i++) {
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
}
return childMapping;
}
};
module.exports = ReactTransitionChildMapping;
},{}],97:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactTransitionEvents
*/
'use strict';
var ExecutionEnvironment = _dereq_(22);
/**
* EVENT_NAME_MAP is used to determine which event fired when a
* transition/animation ends, based on the style property used to
* define that event.
*/
var EVENT_NAME_MAP = {
transitionend: {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'mozTransitionEnd',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd'
},
animationend: {
'animation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'mozAnimationEnd',
'OAnimation': 'oAnimationEnd',
'msAnimation': 'MSAnimationEnd'
}
};
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
if (ExecutionEnvironment.canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function(node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function(endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function(endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
},{}],98:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactTransitionGroup
*/
'use strict';
var React = _dereq_(31);
var ReactTransitionChildMapping = _dereq_(96);
var assign = _dereq_(29);
var cloneWithProps = _dereq_(122);
var emptyFunction = _dereq_(129);
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
propTypes: {
component: React.PropTypes.any,
childFactory: React.PropTypes.func
},
getDefaultProps: function() {
return {
component: 'span',
childFactory: emptyFunction.thatReturnsArgument
};
},
getInitialState: function() {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
componentWillMount: function() {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
componentDidMount: function() {
var initialChildMapping = this.state.children;
for (var key in initialChildMapping) {
if (initialChildMapping[key]) {
this.performAppear(key);
}
}
},
componentWillReceiveProps: function(nextProps) {
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
nextProps.children
);
var prevChildMapping = this.state.children;
this.setState({
children: ReactTransitionChildMapping.mergeChildMappings(
prevChildMapping,
nextChildMapping
)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
if (nextChildMapping[key] && !hasPrev &&
!this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
if (prevChildMapping[key] && !hasNext &&
!this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
// If we want to someday check for reordering, we could do it here.
},
componentDidUpdate: function() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
},
performAppear: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillAppear) {
component.componentWillAppear(
this._handleDoneAppearing.bind(this, key)
);
} else {
this._handleDoneAppearing(key);
}
},
_handleDoneAppearing: function(key) {
var component = this.refs[key];
if (component.componentDidAppear) {
component.componentDidAppear();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully appeared. Remove it.
this.performLeave(key);
}
},
performEnter: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
component.componentWillEnter(
this._handleDoneEntering.bind(this, key)
);
} else {
this._handleDoneEntering(key);
}
},
_handleDoneEntering: function(key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
this.performLeave(key);
}
},
performLeave: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillLeave) {
component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
} else {
// Note that this is somewhat dangerous b/c it calls setState()
// again, effectively mutating the component before all the work
// is done.
this._handleDoneLeaving(key);
}
},
_handleDoneLeaving: function(key) {
var component = this.refs[key];
if (component.componentDidLeave) {
component.componentDidLeave();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
var newChildren = assign({}, this.state.children);
delete newChildren[key];
this.setState({children: newChildren});
}
},
render: function() {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = [];
for (var key in this.state.children) {
var child = this.state.children[key];
if (child) {
// You may need to apply reactive updates to a child as it is leaving.
// The normal React way to do it won't work since the child will have
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
childrenToRender.push(cloneWithProps(
this.props.childFactory(child),
{ref: key, key: key}
));
}
}
return React.createElement(
this.props.component,
this.props,
childrenToRender
);
}
});
module.exports = ReactTransitionGroup;
},{}],99:[function(_dereq_,module,exports){
/**
* Copyright 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.
*
* @providesModule ReactUpdateQueue
*/
'use strict';
var ReactLifeCycle = _dereq_(74);
var ReactCurrentOwner = _dereq_(45);
var ReactElement = _dereq_(63);
var ReactInstanceMap = _dereq_(73);
var ReactUpdates = _dereq_(100);
var assign = _dereq_(29);
var invariant = _dereq_(150);
var warning = _dereq_(171);
function enqueueUpdate(internalInstance) {
if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
// If we're in a componentWillMount handler, don't enqueue a rerender
// because ReactUpdates assumes we're in a browser context (which is
// wrong for server rendering) and we're about to do a render anyway.
// See bug in #1740.
ReactUpdates.enqueueUpdate(internalInstance);
}
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
("production" !== "development" ? invariant(
ReactCurrentOwner.current == null,
'%s(...): Cannot update during an existing state transition ' +
'(such as within `render`). Render methods should be a pure function ' +
'of props and state.',
callerName
) : invariant(ReactCurrentOwner.current == null));
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
if ("production" !== "development") {
// 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.
("production" !== "development" ? 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.',
callerName,
callerName
) : null);
}
return null;
}
if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
return null;
}
return internalInstance;
}
/**
* ReactUpdateQueue allows for state updates to be scheduled into a later
* reconciliation step.
*/
var ReactUpdateQueue = {
/**
* 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(publicInstance, callback) {
("production" !== "development" ? invariant(
typeof callback === 'function',
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
'isn\'t callable.'
) : invariant(typeof callback === 'function'));
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 ||
internalInstance === ReactLifeCycle.currentlyMountingInstance) {
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(internalInstance, callback) {
("production" !== "development" ? invariant(
typeof callback === 'function',
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
'isn\'t callable.'
) : invariant(typeof callback === 'function'));
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 `shouldUpdateComponent`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function(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(publicInstance, completeState) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'replaceState'
);
if (!internalInstance) {
return;
}
internalInstance._pendingStateQueue = [completeState];
internalInstance._pendingReplaceState = true;
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(publicInstance, partialState) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'setState'
);
if (!internalInstance) {
return;
}
var queue =
internalInstance._pendingStateQueue ||
(internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function(publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'setProps'
);
if (!internalInstance) {
return;
}
("production" !== "development" ? invariant(
internalInstance._isTopLevel,
'setProps(...): You called `setProps` on a ' +
'component with a parent. This is an anti-pattern since props will ' +
'get reactively updated when rendered. Instead, change the owner\'s ' +
'`render` method to pass the correct value as props to the component ' +
'where it is created.'
) : invariant(internalInstance._isTopLevel));
// Merge with the pending element if it exists, otherwise with existing
// element props.
var element = internalInstance._pendingElement ||
internalInstance._currentElement;
var props = assign({}, element.props, partialProps);
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
element,
props
);
enqueueUpdate(internalInstance);
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function(publicInstance, props) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'replaceProps'
);
if (!internalInstance) {
return;
}
("production" !== "development" ? invariant(
internalInstance._isTopLevel,
'replaceProps(...): You called `replaceProps` on a ' +
'component with a parent. This is an anti-pattern since props will ' +
'get reactively updated when rendered. Instead, change the owner\'s ' +
'`render` method to pass the correct value as props to the component ' +
'where it is created.'
) : invariant(internalInstance._isTopLevel));
// Merge with the pending element if it exists, otherwise with existing
// element props.
var element = internalInstance._pendingElement ||
internalInstance._currentElement;
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
element,
props
);
enqueueUpdate(internalInstance);
},
enqueueElementInternal: function(internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
};
module.exports = ReactUpdateQueue;
},{}],100:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ReactUpdates
*/
'use strict';
var CallbackQueue = _dereq_(7);
var PooledClass = _dereq_(30);
var ReactCurrentOwner = _dereq_(45);
var ReactPerf = _dereq_(82);
var ReactReconciler = _dereq_(89);
var Transaction = _dereq_(116);
var assign = _dereq_(29);
var invariant = _dereq_(150);
var warning = _dereq_(171);
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
("production" !== "development" ? invariant(
ReactUpdates.ReactReconcileTransaction && batchingStrategy,
'ReactUpdates: must inject a reconcile transaction class and batching ' +
'strategy'
) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
}
var NESTED_UPDATES = {
initialize: function() {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function() {
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() {
this.callbackQueue.reset();
},
close: function() {
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();
}
assign(
ReactUpdatesFlushTransaction.prototype,
Transaction.Mixin, {
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
},
destructor: function() {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function(method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.Mixin.perform.call(
this,
this.reconcileTransaction.perform,
this.reconcileTransaction,
method,
scope,
a
);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b, c, d) {
ensureInjected();
batchingStrategy.batchedUpdates(callback, a, b, c, d);
}
/**
* 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;
("production" !== "development" ? invariant(
len === dirtyComponents.length,
'Expected flush transaction\'s stored dirty-components length (%s) to ' +
'match dirty-components array length (%s).',
len,
dirtyComponents.length
) : invariant(len === dirtyComponents.length));
// 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);
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;
ReactReconciler.performUpdateIfNecessary(
component,
transaction.reconcileTransaction
);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(
callbacks[j],
component.getPublicInstance()
);
}
}
}
}
var flushBatchedUpdates = function() {
// 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);
}
}
};
flushBatchedUpdates = ReactPerf.measure(
'ReactUpdates',
'flushBatchedUpdates',
flushBatchedUpdates
);
/**
* 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 setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
("production" !== "development" ? warning(
ReactCurrentOwner.current == null,
'enqueueUpdate(): 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.'
) : null);
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
return;
}
dirtyComponents.push(component);
}
/**
* 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) {
("production" !== "development" ? invariant(
batchingStrategy.isBatchingUpdates,
'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
'updates are not being batched.'
) : invariant(batchingStrategy.isBatchingUpdates));
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function(ReconcileTransaction) {
("production" !== "development" ? invariant(
ReconcileTransaction,
'ReactUpdates: must provide a reconcile transaction class'
) : invariant(ReconcileTransaction));
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function(_batchingStrategy) {
("production" !== "development" ? invariant(
_batchingStrategy,
'ReactUpdates: must provide a batching strategy'
) : invariant(_batchingStrategy));
("production" !== "development" ? invariant(
typeof _batchingStrategy.batchedUpdates === 'function',
'ReactUpdates: must provide a batchedUpdates() function'
) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
("production" !== "development" ? invariant(
typeof _batchingStrategy.isBatchingUpdates === 'boolean',
'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
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;
},{}],101:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SVGDOMPropertyConfig
*/
/*jslint bitwise: true*/
'use strict';
var DOMProperty = _dereq_(11);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var SVGDOMPropertyConfig = {
Properties: {
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
dx: MUST_USE_ATTRIBUTE,
dy: MUST_USE_ATTRIBUTE,
fill: MUST_USE_ATTRIBUTE,
fillOpacity: MUST_USE_ATTRIBUTE,
fontFamily: MUST_USE_ATTRIBUTE,
fontSize: MUST_USE_ATTRIBUTE,
fx: MUST_USE_ATTRIBUTE,
fy: MUST_USE_ATTRIBUTE,
gradientTransform: MUST_USE_ATTRIBUTE,
gradientUnits: MUST_USE_ATTRIBUTE,
markerEnd: MUST_USE_ATTRIBUTE,
markerMid: MUST_USE_ATTRIBUTE,
markerStart: MUST_USE_ATTRIBUTE,
offset: MUST_USE_ATTRIBUTE,
opacity: MUST_USE_ATTRIBUTE,
patternContentUnits: MUST_USE_ATTRIBUTE,
patternUnits: MUST_USE_ATTRIBUTE,
points: MUST_USE_ATTRIBUTE,
preserveAspectRatio: MUST_USE_ATTRIBUTE,
r: MUST_USE_ATTRIBUTE,
rx: MUST_USE_ATTRIBUTE,
ry: MUST_USE_ATTRIBUTE,
spreadMethod: MUST_USE_ATTRIBUTE,
stopColor: MUST_USE_ATTRIBUTE,
stopOpacity: MUST_USE_ATTRIBUTE,
stroke: MUST_USE_ATTRIBUTE,
strokeDasharray: MUST_USE_ATTRIBUTE,
strokeLinecap: MUST_USE_ATTRIBUTE,
strokeOpacity: MUST_USE_ATTRIBUTE,
strokeWidth: MUST_USE_ATTRIBUTE,
textAnchor: MUST_USE_ATTRIBUTE,
transform: MUST_USE_ATTRIBUTE,
version: MUST_USE_ATTRIBUTE,
viewBox: MUST_USE_ATTRIBUTE,
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
fillOpacity: 'fill-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
gradientTransform: 'gradientTransform',
gradientUnits: 'gradientUnits',
markerEnd: 'marker-end',
markerMid: 'marker-mid',
markerStart: 'marker-start',
patternContentUnits: 'patternContentUnits',
patternUnits: 'patternUnits',
preserveAspectRatio: 'preserveAspectRatio',
spreadMethod: 'spreadMethod',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strokeDasharray: 'stroke-dasharray',
strokeLinecap: 'stroke-linecap',
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
viewBox: 'viewBox'
}
};
module.exports = SVGDOMPropertyConfig;
},{}],102:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SelectEventPlugin
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPropagators = _dereq_(21);
var ReactInputSelection = _dereq_(71);
var SyntheticEvent = _dereq_(108);
var getActiveElement = _dereq_(136);
var isTextInputElement = _dereq_(153);
var keyOf = _dereq_(157);
var shallowEqual = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: keyOf({onSelect: null}),
captured: keyOf({onSelectCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topContextMenu,
topLevelTypes.topFocus,
topLevelTypes.topKeyDown,
topLevelTypes.topMouseDown,
topLevelTypes.topMouseUp,
topLevelTypes.topSelectionChange
]
}
};
var activeElement = null;
var activeElementID = null;
var lastSelection = null;
var mouseDown = false;
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @param {object}
*/
function getSelection(node) {
if ('selectionStart' in node &&
ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown ||
activeElement == null ||
activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(
eventTypes.select,
activeElementID,
nativeEvent
);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
if (isTextInputElement(topLevelTarget) ||
topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
activeElementID = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case topLevelTypes.topMouseDown:
mouseDown = true;
break;
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
return constructSelectEvent(nativeEvent);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't).
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
case topLevelTypes.topSelectionChange:
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
return constructSelectEvent(nativeEvent);
}
}
};
module.exports = SelectEventPlugin;
},{}],103:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ServerReactRootIndex
* @typechecks
*/
'use strict';
/**
* Size of the reactRoot ID space. We generate random numbers for React root
* IDs and if there's a collision the events and DOM update system will
* get confused. In the future we need a way to generate GUIDs but for
* now this will work on a smaller scale.
*/
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
createReactRootIndex: function() {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
},{}],104:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SimpleEventPlugin
*/
'use strict';
var EventConstants = _dereq_(16);
var EventPluginUtils = _dereq_(20);
var EventPropagators = _dereq_(21);
var SyntheticClipboardEvent = _dereq_(105);
var SyntheticEvent = _dereq_(108);
var SyntheticFocusEvent = _dereq_(109);
var SyntheticKeyboardEvent = _dereq_(111);
var SyntheticMouseEvent = _dereq_(112);
var SyntheticDragEvent = _dereq_(107);
var SyntheticTouchEvent = _dereq_(113);
var SyntheticUIEvent = _dereq_(114);
var SyntheticWheelEvent = _dereq_(115);
var getEventCharCode = _dereq_(137);
var invariant = _dereq_(150);
var keyOf = _dereq_(157);
var warning = _dereq_(171);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
blur: {
phasedRegistrationNames: {
bubbled: keyOf({onBlur: true}),
captured: keyOf({onBlurCapture: true})
}
},
click: {
phasedRegistrationNames: {
bubbled: keyOf({onClick: true}),
captured: keyOf({onClickCapture: true})
}
},
contextMenu: {
phasedRegistrationNames: {
bubbled: keyOf({onContextMenu: true}),
captured: keyOf({onContextMenuCapture: true})
}
},
copy: {
phasedRegistrationNames: {
bubbled: keyOf({onCopy: true}),
captured: keyOf({onCopyCapture: true})
}
},
cut: {
phasedRegistrationNames: {
bubbled: keyOf({onCut: true}),
captured: keyOf({onCutCapture: true})
}
},
doubleClick: {
phasedRegistrationNames: {
bubbled: keyOf({onDoubleClick: true}),
captured: keyOf({onDoubleClickCapture: true})
}
},
drag: {
phasedRegistrationNames: {
bubbled: keyOf({onDrag: true}),
captured: keyOf({onDragCapture: true})
}
},
dragEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onDragEnd: true}),
captured: keyOf({onDragEndCapture: true})
}
},
dragEnter: {
phasedRegistrationNames: {
bubbled: keyOf({onDragEnter: true}),
captured: keyOf({onDragEnterCapture: true})
}
},
dragExit: {
phasedRegistrationNames: {
bubbled: keyOf({onDragExit: true}),
captured: keyOf({onDragExitCapture: true})
}
},
dragLeave: {
phasedRegistrationNames: {
bubbled: keyOf({onDragLeave: true}),
captured: keyOf({onDragLeaveCapture: true})
}
},
dragOver: {
phasedRegistrationNames: {
bubbled: keyOf({onDragOver: true}),
captured: keyOf({onDragOverCapture: true})
}
},
dragStart: {
phasedRegistrationNames: {
bubbled: keyOf({onDragStart: true}),
captured: keyOf({onDragStartCapture: true})
}
},
drop: {
phasedRegistrationNames: {
bubbled: keyOf({onDrop: true}),
captured: keyOf({onDropCapture: true})
}
},
focus: {
phasedRegistrationNames: {
bubbled: keyOf({onFocus: true}),
captured: keyOf({onFocusCapture: true})
}
},
input: {
phasedRegistrationNames: {
bubbled: keyOf({onInput: true}),
captured: keyOf({onInputCapture: true})
}
},
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyDown: true}),
captured: keyOf({onKeyDownCapture: true})
}
},
keyPress: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyPress: true}),
captured: keyOf({onKeyPressCapture: true})
}
},
keyUp: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyUp: true}),
captured: keyOf({onKeyUpCapture: true})
}
},
load: {
phasedRegistrationNames: {
bubbled: keyOf({onLoad: true}),
captured: keyOf({onLoadCapture: true})
}
},
error: {
phasedRegistrationNames: {
bubbled: keyOf({onError: true}),
captured: keyOf({onErrorCapture: true})
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseDown: true}),
captured: keyOf({onMouseDownCapture: true})
}
},
mouseMove: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseMove: true}),
captured: keyOf({onMouseMoveCapture: true})
}
},
mouseOut: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseOut: true}),
captured: keyOf({onMouseOutCapture: true})
}
},
mouseOver: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseOver: true}),
captured: keyOf({onMouseOverCapture: true})
}
},
mouseUp: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseUp: true}),
captured: keyOf({onMouseUpCapture: true})
}
},
paste: {
phasedRegistrationNames: {
bubbled: keyOf({onPaste: true}),
captured: keyOf({onPasteCapture: true})
}
},
reset: {
phasedRegistrationNames: {
bubbled: keyOf({onReset: true}),
captured: keyOf({onResetCapture: true})
}
},
scroll: {
phasedRegistrationNames: {
bubbled: keyOf({onScroll: true}),
captured: keyOf({onScrollCapture: true})
}
},
submit: {
phasedRegistrationNames: {
bubbled: keyOf({onSubmit: true}),
captured: keyOf({onSubmitCapture: true})
}
},
touchCancel: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchCancel: true}),
captured: keyOf({onTouchCancelCapture: true})
}
},
touchEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchEnd: true}),
captured: keyOf({onTouchEndCapture: true})
}
},
touchMove: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchMove: true}),
captured: keyOf({onTouchMoveCapture: true})
}
},
touchStart: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchStart: true}),
captured: keyOf({onTouchStartCapture: true})
}
},
wheel: {
phasedRegistrationNames: {
bubbled: keyOf({onWheel: true}),
captured: keyOf({onWheelCapture: true})
}
}
};
var topLevelEventsToDispatchConfig = {
topBlur: eventTypes.blur,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
topCut: eventTypes.cut,
topDoubleClick: eventTypes.doubleClick,
topDrag: eventTypes.drag,
topDragEnd: eventTypes.dragEnd,
topDragEnter: eventTypes.dragEnter,
topDragExit: eventTypes.dragExit,
topDragLeave: eventTypes.dragLeave,
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
topSubmit: eventTypes.submit,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
topWheel: eventTypes.wheel
};
for (var type in topLevelEventsToDispatchConfig) {
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
* Same as the default implementation, except cancels the event when return
* value is false. This behavior will be disabled in a future release.
*
* @param {object} Event to be dispatched.
* @param {function} Application-level callback.
* @param {string} domID DOM ID to pass to the callback.
*/
executeDispatch: function(event, listener, domID) {
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
("production" !== "development" ? warning(
typeof returnValue !== 'boolean',
'Returning `false` from an event handler is deprecated and will be ' +
'ignored in a future release. Instead, manually call ' +
'e.stopPropagation() or e.preventDefault(), as appropriate.'
) : null);
if (returnValue === false) {
event.stopPropagation();
event.preventDefault();
}
},
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
case topLevelTypes.topError:
case topLevelTypes.topReset:
case topLevelTypes.topSubmit:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyPress:
// FireFox creates a keypress event for function keys too. This removes
// the unwanted keypress events. Enter is however both printable and
// non-printable. One would expect Tab to be as well (but it isn't).
if (getEventCharCode(nativeEvent) === 0) {
return null;
}
/* falls through */
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
EventConstructor = SyntheticKeyboardEvent;
break;
case topLevelTypes.topBlur:
case topLevelTypes.topFocus:
EventConstructor = SyntheticFocusEvent;
break;
case topLevelTypes.topClick:
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case topLevelTypes.topContextMenu:
case topLevelTypes.topDoubleClick:
case topLevelTypes.topMouseDown:
case topLevelTypes.topMouseMove:
case topLevelTypes.topMouseOut:
case topLevelTypes.topMouseOver:
case topLevelTypes.topMouseUp:
EventConstructor = SyntheticMouseEvent;
break;
case topLevelTypes.topDrag:
case topLevelTypes.topDragEnd:
case topLevelTypes.topDragEnter:
case topLevelTypes.topDragExit:
case topLevelTypes.topDragLeave:
case topLevelTypes.topDragOver:
case topLevelTypes.topDragStart:
case topLevelTypes.topDrop:
EventConstructor = SyntheticDragEvent;
break;
case topLevelTypes.topTouchCancel:
case topLevelTypes.topTouchEnd:
case topLevelTypes.topTouchMove:
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
case topLevelTypes.topWheel:
EventConstructor = SyntheticWheelEvent;
break;
case topLevelTypes.topCopy:
case topLevelTypes.topCut:
case topLevelTypes.topPaste:
EventConstructor = SyntheticClipboardEvent;
break;
}
("production" !== "development" ? invariant(
EventConstructor,
'SimpleEventPlugin: Unhandled event type, `%s`.',
topLevelType
) : invariant(EventConstructor));
var event = EventConstructor.getPooled(
dispatchConfig,
topLevelTargetID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
};
module.exports = SimpleEventPlugin;
},{}],105:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticClipboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(108);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: function(event) {
return (
'clipboardData' in event ?
event.clipboardData :
window.clipboardData
);
}
};
/**
* @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 SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
},{}],106:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticCompositionEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(108);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @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 SyntheticCompositionEvent(
dispatchConfig,
dispatchMarker,
nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(
SyntheticCompositionEvent,
CompositionEventInterface
);
module.exports = SyntheticCompositionEvent;
},{}],107:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticDragEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = _dereq_(112);
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = {
dataTransfer: null
};
/**
* @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 SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
},{}],108:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticEvent
* @typechecks static-only
*/
'use strict';
var PooledClass = _dereq_(30);
var assign = _dereq_(29);
var emptyFunction = _dereq_(129);
var getEventTarget = _dereq_(140);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
target: getEventTarget,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function(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 {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} 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;
}
assign(SyntheticEvent.prototype, {
preventDefault: function() {
this.defaultPrevented = true;
var event = this.nativeEvent;
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function() {
var event = this.nativeEvent;
if (event.stopPropagation) {
event.stopPropagation();
} else {
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() {
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() {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
}
this.dispatchConfig = null;
this.dispatchMarker = null;
this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function(Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
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.threeArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
module.exports = SyntheticEvent;
},{}],109:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(114);
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @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 SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
},{}],110:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticInputEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(108);
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
var InputEventInterface = {
data: null
};
/**
* @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 SyntheticInputEvent(
dispatchConfig,
dispatchMarker,
nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(
SyntheticInputEvent,
InputEventInterface
);
module.exports = SyntheticInputEvent;
},{}],111:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticKeyboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(114);
var getEventCharCode = _dereq_(137);
var getEventKey = _dereq_(138);
var getEventModifierState = _dereq_(139);
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
key: getEventKey,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function(event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
return 0;
},
keyCode: function(event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function(event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 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 {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
},{}],112:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticMouseEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(114);
var ViewportMetrics = _dereq_(117);
var getEventModifierState = _dereq_(139);
/**
* @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(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(event) {
return event.relatedTarget || (
((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
);
},
// "Proprietary" Interface.
pageX: function(event) {
return 'pageX' in event ?
event.pageX :
event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function(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) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
},{}],113:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticTouchEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(114);
var getEventModifierState = _dereq_(139);
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null,
getModifierState: getEventModifierState
};
/**
* @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 SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
},{}],114:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticUIEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(108);
var getEventTarget = _dereq_(140);
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: function(event) {
if (event.view) {
return event.view;
}
var target = getEventTarget(event);
if (target != null && 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(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) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
},{}],115:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule SyntheticWheelEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = _dereq_(112);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function(event) {
return (
'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0
);
},
deltaY: function(event) {
return (
'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0
);
},
deltaZ: null,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
},{}],116:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule Transaction
*/
'use strict';
var invariant = _dereq_(150);
/**
* `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 upates.
*
* 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 Mixin = {
/**
* 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() {
this.transactionWrappers = this.getTransactionWrappers();
if (!this.wrapperInitData) {
this.wrapperInitData = [];
} else {
this.wrapperInitData.length = 0;
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function() {
return !!this._isInTransaction;
},
/**
* 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.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} args... Arguments to pass to the method (optional).
* Helps prevent need to bind in many cases.
* @return Return value from `method`.
*/
perform: function(method, scope, a, b, c, d, e, f) {
("production" !== "development" ? invariant(
!this.isInTransaction(),
'Transaction.perform(...): Cannot initialize a transaction when there ' +
'is already an outstanding transaction.'
) : invariant(!this.isInTransaction()));
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(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] = Transaction.OBSERVED_ERROR;
this.wrapperInitData[i] = wrapper.initialize ?
wrapper.initialize.call(this) :
null;
} finally {
if (this.wrapperInitData[i] === Transaction.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(startIndex) {
("production" !== "development" ? invariant(
this.isInTransaction(),
'Transaction.closeAll(): Cannot close transaction when none are open.'
) : invariant(this.isInTransaction()));
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 !== Transaction.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;
}
};
var Transaction = {
Mixin: Mixin,
/**
* Token to look for to determine if an error occured.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
},{}],117:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule ViewportMetrics
*/
'use strict';
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function(scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
};
module.exports = ViewportMetrics;
},{}],118:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule accumulateInto
*/
'use strict';
var invariant = _dereq_(150);
/**
*
* 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) {
("production" !== "development" ? invariant(
next != null,
'accumulateInto(...): Accumulated items must not be null or undefined.'
) : invariant(next != null));
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).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray && nextIsArray) {
current.push.apply(current, next);
return current;
}
if (currentIsArray) {
current.push(next);
return current;
}
if (nextIsArray) {
// A bit too dangerous to mutate `next`.
return [current].concat(next);
}
return [current, next];
}
module.exports = accumulateInto;
},{}],119:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule adler32
*/
/* jslint bitwise:true */
'use strict';
var MOD = 65521;
// This is a clean-room implementation of adler32 designed for detecting
// if markup is not what we expect it to be. It does not need to be
// cryptographically strong, only reasonably good at detecting if markup
// generated on the server is different than that on the client.
function adler32(data) {
var a = 1;
var b = 0;
for (var i = 0; i < data.length; i++) {
a = (a + data.charCodeAt(i)) % MOD;
b = (b + a) % MOD;
}
return a | (b << 16);
}
module.exports = adler32;
},{}],120:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule camelize
* @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;
},{}],121:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule camelizeStyleName
* @typechecks
*/
"use strict";
var camelize = _dereq_(120);
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;
},{}],122:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @typechecks
* @providesModule cloneWithProps
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactPropTransferer = _dereq_(83);
var keyOf = _dereq_(157);
var warning = _dereq_(171);
var CHILDREN_PROP = keyOf({children: null});
/**
* Sometimes you want to change the props of a child passed to you. Usually
* this is to add a CSS class.
*
* @param {object} child child component you'd like to clone
* @param {object} props props you'd like to modify. className and style will be
* merged automatically.
* @return {object} a clone of child with props merged in.
*/
function cloneWithProps(child, props) {
if ("production" !== "development") {
("production" !== "development" ? warning(
!child.ref,
'You are calling cloneWithProps() on a child with a ref. This is ' +
'dangerous because you\'re creating a new child which will not be ' +
'added as a ref to its parent.'
) : null);
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
// The current API doesn't retain _owner and _context, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
return ReactElement.createElement(child.type, newProps);
}
module.exports = cloneWithProps;
},{}],123:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule containsNode
* @typechecks
*/
var isTextNode = _dereq_(154);
/*jslint bitwise:true */
/**
* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
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 (outerNode.contains) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
module.exports = containsNode;
},{}],124:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule createArrayFromMixed
* @typechecks
*/
var toArray = _dereq_(168);
/**
* 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 == '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
(// HTMLCollection/NodeList
(Array.isArray(obj) ||
// arguments
('callee' in obj) || '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;
},{}],125:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule createFullPageComponent
* @typechecks
*/
'use strict';
// Defeat circular references by requiring this directly.
var ReactClass = _dereq_(38);
var ReactElement = _dereq_(63);
var invariant = _dereq_(150);
/**
* Create a component that will throw an exception when unmounted.
*
* Components like <html> <head> and <body> can't be removed or added
* easily in a cross-browser way, however it's valuable to be able to
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*
* @param {string} tag The tag to wrap
* @return {function} convenience constructor of new component
*/
function createFullPageComponent(tag) {
var elementFactory = ReactElement.createFactory(tag);
var FullPageComponent = ReactClass.createClass({
displayName: 'ReactFullPageComponent' + tag,
componentWillUnmount: function() {
("production" !== "development" ? invariant(
false,
'%s tried to unmount. Because of cross-browser quirks it is ' +
'impossible to unmount some top-level components (eg <html>, <head>, ' +
'and <body>) reliably and efficiently. To fix this, have a single ' +
'top-level component that never unmounts render these elements.',
this.constructor.displayName
) : invariant(false));
},
render: function() {
return elementFactory(this.props);
}
});
return FullPageComponent;
}
module.exports = createFullPageComponent;
},{}],126:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule createNodesFromMarkup
* @typechecks
*/
/*jslint evil: true, sub: true */
var ExecutionEnvironment = _dereq_(22);
var createArrayFromMixed = _dereq_(124);
var getMarkupWrap = _dereq_(142);
var invariant = _dereq_(150);
/**
* 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;
("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
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) {
("production" !== "development" ? invariant(
handleScript,
'createNodesFromMarkup(...): Unexpected <script> element rendered.'
) : invariant(handleScript));
createArrayFromMixed(scripts).forEach(handleScript);
}
var nodes = createArrayFromMixed(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
},{}],127:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule cx
*/
/**
* This function is used to mark string literals representing CSS class names
* so that they can be transformed statically. This allows for modularization
* and minification of CSS class names.
*
* In static_upstream, this function is actually implemented, but it should
* eventually be replaced with something more descriptive, and the transform
* that is used in the main stack should be ported for use elsewhere.
*
* @param string|object className to modularize, or an object of key/values.
* In the object case, the values are conditions that
* determine if the className keys should be included.
* @param [string ...] Variable list of classNames in the string case.
* @return string Renderable space-separated CSS className.
*/
function cx(classNames) {
if (typeof classNames == 'object') {
return Object.keys(classNames).filter(function(className) {
return classNames[className];
}).join(' ');
} else {
return Array.prototype.join.call(arguments, ' ');
}
}
module.exports = cx;
},{}],128:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule dangerousStyleValue
* @typechecks static-only
*/
'use strict';
var CSSProperty = _dereq_(5);
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 ||
isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
},{}],129:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule emptyFunction
*/
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.
*/
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;
},{}],130:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule emptyObject
*/
"use strict";
var emptyObject = {};
if ("production" !== "development") {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
},{}],131:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule escapeTextContentForBrowser
*/
'use strict';
var ESCAPE_LOOKUP = {
'&': '&',
'>': '>',
'<': '<',
'"': '"',
'\'': '''
};
var ESCAPE_REGEX = /[&><"']/g;
function escaper(match) {
return ESCAPE_LOOKUP[match];
}
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextContentForBrowser(text) {
return ('' + text).replace(ESCAPE_REGEX, escaper);
}
module.exports = escapeTextContentForBrowser;
},{}],132:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule findDOMNode
* @typechecks static-only
*/
'use strict';
var ReactInstanceMap = _dereq_(73);
var ReactMount = _dereq_(77);
var invariant = _dereq_(150);
var isNode = _dereq_(152);
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
* @return {DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
if (componentOrElement == null) {
return null;
}
if (isNode(componentOrElement)) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
("production" !== "development" ? invariant(
componentOrElement.render == null ||
typeof componentOrElement.render !== 'function',
'Component (with keys: %s) contains `render` method ' +
'but is not mounted in the DOM',
Object.keys(componentOrElement)
) : invariant(componentOrElement.render == null ||
typeof componentOrElement.render !== 'function'));
("production" !== "development" ? invariant(
false,
'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
Object.keys(componentOrElement)
) : invariant(false));
}
module.exports = findDOMNode;
},{}],133:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule flattenChildren
*/
'use strict';
var traverseAllChildren = _dereq_(169);
var warning = _dereq_(171);
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
*/
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
var keyUnique = !result.hasOwnProperty(name);
if ("production" !== "development") {
("production" !== "development" ? warning(
keyUnique,
'flattenChildren(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
) : null);
}
if (keyUnique && child != null) {
result[name] = child;
}
}
/**
* Flattens children that are typically specified as `props.children`. Any null
* children will not be included in the resulting object.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children) {
if (children == null) {
return children;
}
var result = {};
traverseAllChildren(children, flattenSingleChildIntoContext, result);
return result;
}
module.exports = flattenChildren;
},{}],134:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule focusNode
*/
"use strict";
/**
* @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;
},{}],135:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule forEachAccumulated
*/
'use strict';
/**
* @param {array} 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).
*/
var forEachAccumulated = function(arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
};
module.exports = forEachAccumulated;
},{}],136:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getActiveElement
* @typechecks
*/
/**
* 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 body is not yet defined.
*/
function getActiveElement() /*?DOMElement*/ {
try {
return document.activeElement || document.body;
} catch (e) {
return document.body;
}
}
module.exports = getActiveElement;
},{}],137:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getEventCharCode
* @typechecks static-only
*/
'use strict';
/**
* `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 {string} 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;
},{}],138:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getEventKey
* @typechecks static-only
*/
'use strict';
var getEventCharCode = _dereq_(137);
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
'Esc': 'Escape',
'Spacebar': ' ',
'Left': 'ArrowLeft',
'Up': 'ArrowUp',
'Right': 'ArrowRight',
'Down': 'ArrowDown',
'Del': 'Delete',
'Win': 'OS',
'Menu': 'ContextMenu',
'Apps': 'ContextMenu',
'Scroll': 'ScrollLock',
'MozPrintableKey': 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
224: 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode(nativeEvent);
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
module.exports = getEventKey;
},{}],139:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getEventModifierState
* @typechecks static-only
*/
'use strict';
/**
* 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) {
/*jshint validthis:true */
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;
},{}],140:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
'use strict';
/**
* 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;
// 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;
},{}],141:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getIteratorFn
* @typechecks static-only
*/
'use strict';
/* 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;
},{}],142:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getMarkupWrap
*/
var ExecutionEnvironment = _dereq_(22);
var invariant = _dereq_(150);
/**
* 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 = {
// Force wrapping for SVG elements because if they get created inside a <div>,
// they will be initialized in the wrong namespace (and will not display).
'circle': true,
'defs': true,
'ellipse': true,
'g': true,
'line': true,
'linearGradient': true,
'path': true,
'polygon': true,
'polyline': true,
'radialGradient': true,
'rect': true,
'stop': true,
'text': true
};
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>', '</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,
'circle': svgWrap,
'defs': svgWrap,
'ellipse': svgWrap,
'g': svgWrap,
'line': svgWrap,
'linearGradient': svgWrap,
'path': svgWrap,
'polygon': svgWrap,
'polyline': svgWrap,
'radialGradient': svgWrap,
'rect': svgWrap,
'stop': svgWrap,
'text': svgWrap
};
/**
* 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) {
("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
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;
},{}],143:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getNodeForCharacterOffset
*/
'use strict';
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
},{}],144:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getReactRootElementInContainer
*/
'use strict';
var DOC_NODE_TYPE = 9;
/**
* @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;
}
}
module.exports = getReactRootElementInContainer;
},{}],145:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getTextContentAccessor
*/
'use strict';
var ExecutionEnvironment = _dereq_(22);
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;
},{}],146:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule getUnboundedScrollPosition
* @typechecks
*/
"use strict";
/**
* 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) {
return {
x: window.pageXOffset || document.documentElement.scrollLeft,
y: window.pageYOffset || document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
},{}],147:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule hyphenate
* @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;
},{}],148:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule hyphenateStyleName
* @typechecks
*/
"use strict";
var hyphenate = _dereq_(147);
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;
},{}],149:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule instantiateReactComponent
* @typechecks static-only
*/
'use strict';
var ReactCompositeComponent = _dereq_(43);
var ReactEmptyComponent = _dereq_(65);
var ReactNativeComponent = _dereq_(80);
var assign = _dereq_(29);
var invariant = _dereq_(150);
var warning = _dereq_(171);
// To avoid a cyclic dependency, we create the final class in this module
var ReactCompositeComponentWrapper = function() { };
assign(
ReactCompositeComponentWrapper.prototype,
ReactCompositeComponent.Mixin,
{
_instantiateReactComponent: instantiateReactComponent
}
);
/**
* 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.mountComponent === 'function' &&
typeof type.prototype.receiveComponent === 'function'
);
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
* @param {*} parentCompositeType The composite type that resolved this.
* @return {object} A new instance of the element's constructor.
* @protected
*/
function instantiateReactComponent(node, parentCompositeType) {
var instance;
if (node === null || node === false) {
node = ReactEmptyComponent.emptyElement;
}
if (typeof node === 'object') {
var element = node;
if ("production" !== "development") {
("production" !== "development" ? warning(
element && (typeof element.type === 'function' ||
typeof element.type === 'string'),
'Only functions or strings can be mounted as React components.'
) : null);
}
// Special case string values
if (parentCompositeType === element.type &&
typeof element.type === 'string') {
// Avoid recursion if the wrapper renders itself.
instance = ReactNativeComponent.createInternalComponent(element);
// All native components are currently wrapped in a composite so we're
// safe to assume that this is what we should instantiate.
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
// represenations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
instance = new ReactCompositeComponentWrapper();
}
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
("production" !== "development" ? invariant(
false,
'Encountered invalid React node of type %s',
typeof node
) : invariant(false));
}
if ("production" !== "development") {
("production" !== "development" ? warning(
typeof instance.construct === 'function' &&
typeof instance.mountComponent === 'function' &&
typeof instance.receiveComponent === 'function' &&
typeof instance.unmountComponent === 'function',
'Only React Components can be mounted.'
) : null);
}
// Sets up the instance. This can probably just move into the constructor now.
instance.construct(node);
// 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 ("production" !== "development") {
instance._isOwnerNecessary = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
if ("production" !== "development") {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
}
return instance;
}
module.exports = instantiateReactComponent;
},{}],150:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule invariant
*/
"use strict";
/**
* 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 invariant = function(condition, format, a, b, c, d, e, f) {
if ("production" !== "development") {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
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(
'Invariant Violation: ' +
format.replace(/%s/g, function() { return args[argIndex++]; })
);
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
},{}],151:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule isEventSupported
*/
'use strict';
var ExecutionEnvironment = _dereq_(22);
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;
},{}],152:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule isNode
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
function isNode(object) {
return !!(object && (
((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
typeof object.nodeType === 'number' &&
typeof object.nodeName === 'string'))
));
}
module.exports = isNode;
},{}],153:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule isTextInputElement
*/
'use strict';
/**
* @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) {
return elem && (
(elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
);
}
module.exports = isTextInputElement;
},{}],154:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule isTextNode
* @typechecks
*/
var isNode = _dereq_(152);
/**
* @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;
},{}],155:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule joinClasses
* @typechecks static-only
*/
'use strict';
/**
* Combines multiple className strings into one.
* http://jsperf.com/joinclasses-args-vs-array
*
* @param {...?string} classes
* @return {string}
*/
function joinClasses(className/*, ... */) {
if (!className) {
className = '';
}
var nextClass;
var argLength = arguments.length;
if (argLength > 1) {
for (var ii = 1; ii < argLength; ii++) {
nextClass = arguments[ii];
if (nextClass) {
className = (className ? className + ' ' : '') + nextClass;
}
}
}
return className;
}
module.exports = joinClasses;
},{}],156:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule keyMirror
* @typechecks static-only
*/
'use strict';
var invariant = _dereq_(150);
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function(obj) {
var ret = {};
var key;
("production" !== "development" ? invariant(
obj instanceof Object && !Array.isArray(obj),
'keyMirror(...): Argument must be an object.'
) : invariant(obj instanceof Object && !Array.isArray(obj)));
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
},{}],157:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule keyOf
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without loosing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
var keyOf = function(oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
},{}],158:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule mapObject
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Executes the provided `callback` once for each enumerable own property in the
* object and constructs a new object from the results. The `callback` is
* invoked with three arguments:
*
* - the property value
* - the property name
* - the object being traversed
*
* Properties that are added after the call to `mapObject` will not be visited
* by `callback`. If the values of existing properties are changed, the value
* passed to `callback` will be the value at the time `mapObject` visits them.
* Properties that are deleted before being visited are not visited.
*
* @grep function objectMap()
* @grep function objMap()
*
* @param {?object} object
* @param {function} callback
* @param {*} context
* @return {?object}
*/
function mapObject(object, callback, context) {
if (!object) {
return null;
}
var result = {};
for (var name in object) {
if (hasOwnProperty.call(object, name)) {
result[name] = callback.call(context, object[name], name, object);
}
}
return result;
}
module.exports = mapObject;
},{}],159:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule memoizeStringOnly
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeStringOnly(callback) {
var cache = {};
return function(string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
},{}],160:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule onlyChild
*/
'use strict';
var ReactElement = _dereq_(63);
var invariant = _dereq_(150);
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection. The current implementation of this
* function assumes that a single child gets passed without a wrapper, but the
* purpose of this helper function is to abstract away the particular structure
* of children.
*
* @param {?object} children Child collection structure.
* @return {ReactComponent} The first and only `ReactComponent` contained in the
* structure.
*/
function onlyChild(children) {
("production" !== "development" ? invariant(
ReactElement.isValidElement(children),
'onlyChild must be passed a children with exactly one child.'
) : invariant(ReactElement.isValidElement(children)));
return children;
}
module.exports = onlyChild;
},{}],161:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule performance
* @typechecks
*/
"use strict";
var ExecutionEnvironment = _dereq_(22);
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance =
window.performance ||
window.msPerformance ||
window.webkitPerformance;
}
module.exports = performance || {};
},{}],162:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule performanceNow
* @typechecks
*/
var performance = _dereq_(161);
/**
* 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 || !performance.now) {
performance = Date;
}
var performanceNow = performance.now.bind(performance);
module.exports = performanceNow;
},{}],163:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule quoteAttributeValueForBrowser
*/
'use strict';
var escapeTextContentForBrowser = _dereq_(131);
/**
* Escapes attribute value to prevent scripting attacks.
*
* @param {*} value Value to escape.
* @return {string} An escaped string.
*/
function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextContentForBrowser(value) + '"';
}
module.exports = quoteAttributeValueForBrowser;
},{}],164:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule setInnerHTML
*/
/* globals MSApp */
'use strict';
var ExecutionEnvironment = _dereq_(22);
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
var setInnerHTML = function(node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
setInnerHTML = function(node, html) {
MSApp.execUnsafeLocalFunction(function() {
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(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.
node.innerHTML = '\uFEFF' + 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;
}
};
}
}
module.exports = setInnerHTML;
},{}],165:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule setTextContent
*/
'use strict';
var ExecutionEnvironment = _dereq_(22);
var escapeTextContentForBrowser = _dereq_(131);
var setInnerHTML = _dereq_(164);
/**
* 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(node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
setTextContent = function(node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
},{}],166:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule shallowEqual
*/
'use strict';
/**
* Performs equality by iterating through keys on an object and returning
* false when any key has values which are not strictly equal between
* objA and objB. Returns true when the values of all keys are strictly equal.
*
* @return {boolean}
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var key;
// Test for A's keys different from B.
for (key in objA) {
if (objA.hasOwnProperty(key) &&
(!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
return false;
}
}
// Test for B's keys missing from A.
for (key in objB) {
if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
},{}],167:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule shouldUpdateReactComponent
* @typechecks static-only
*/
'use strict';
var warning = _dereq_(171);
/**
* 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
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
if (prevElement != null && nextElement != null) {
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return (nextType === 'string' || nextType === 'number');
} else {
if (nextType === 'object' &&
prevElement.type === nextElement.type &&
prevElement.key === nextElement.key) {
var ownersMatch = prevElement._owner === nextElement._owner;
var prevName = null;
var nextName = null;
var nextDisplayName = null;
if ("production" !== "development") {
if (!ownersMatch) {
if (prevElement._owner != null &&
prevElement._owner.getPublicInstance() != null &&
prevElement._owner.getPublicInstance().constructor != null) {
prevName =
prevElement._owner.getPublicInstance().constructor.displayName;
}
if (nextElement._owner != null &&
nextElement._owner.getPublicInstance() != null &&
nextElement._owner.getPublicInstance().constructor != null) {
nextName =
nextElement._owner.getPublicInstance().constructor.displayName;
}
if (nextElement.type != null &&
nextElement.type.displayName != null) {
nextDisplayName = nextElement.type.displayName;
}
if (nextElement.type != null && typeof nextElement.type === 'string') {
nextDisplayName = nextElement.type;
}
if (typeof nextElement.type !== 'string' ||
nextElement.type === 'input' ||
nextElement.type === 'textarea') {
if ((prevElement._owner != null &&
prevElement._owner._isOwnerNecessary === false) ||
(nextElement._owner != null &&
nextElement._owner._isOwnerNecessary === false)) {
if (prevElement._owner != null) {
prevElement._owner._isOwnerNecessary = true;
}
if (nextElement._owner != null) {
nextElement._owner._isOwnerNecessary = true;
}
("production" !== "development" ? warning(
false,
'<%s /> is being rendered by both %s and %s using the same ' +
'key (%s) in the same place. Currently, this means that ' +
'they don\'t preserve state. This behavior should be very ' +
'rare so we\'re considering deprecating it. Please contact ' +
'the React team and explain your use case so that we can ' +
'take that into consideration.',
nextDisplayName || 'Unknown Component',
prevName || '[Unknown]',
nextName || '[Unknown]',
prevElement.key
) : null);
}
}
}
}
return ownersMatch;
}
}
}
return false;
}
module.exports = shouldUpdateReactComponent;
},{}],168:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule toArray
* @typechecks
*/
var invariant = _dereq_(150);
/**
* 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 browse builtin objects can report typeof 'function' (e.g. NodeList in
// old versions of Safari).
("production" !== "development" ? invariant(
!Array.isArray(obj) &&
(typeof obj === 'object' || typeof obj === 'function'),
'toArray: Array-like object expected'
) : invariant(!Array.isArray(obj) &&
(typeof obj === 'object' || typeof obj === 'function')));
("production" !== "development" ? invariant(
typeof length === 'number',
'toArray: Object needs a length property'
) : invariant(typeof length === 'number'));
("production" !== "development" ? invariant(
length === 0 ||
(length - 1) in obj,
'toArray: Object should have keys for indices'
) : invariant(length === 0 ||
(length - 1) in obj));
// 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;
}
module.exports = toArray;
},{}],169:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule traverseAllChildren
*/
'use strict';
var ReactElement = _dereq_(63);
var ReactFragment = _dereq_(69);
var ReactInstanceHandles = _dereq_(72);
var getIteratorFn = _dereq_(141);
var invariant = _dereq_(150);
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var userProvidedKeyEscaperLookup = {
'=': '=0',
'.': '=1',
':': '=2'
};
var userProvidedKeyEscapeRegex = /[=.:]/g;
function userProvidedKeyEscaper(match) {
return userProvidedKeyEscaperLookup[match];
}
/**
* 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) {
if (component && component.key != null) {
// Explicit key
return wrapUserProvidedKey(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* Escape a component key so that it is safe to use in a reactid.
*
* @param {*} key Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
return ('' + text).replace(
userProvidedKeyEscapeRegex,
userProvidedKeyEscaper
);
}
/**
* Wrap a `key` value explicitly provided by the user to distinguish it from
* implicitly-generated keys generated by a component's index in its parent.
*
* @param {string} key Value of a user-provided `key` attribute
* @return {string}
*/
function wrapUserProvidedKey(key) {
return '$' + escapeUserProvidedKey(key);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!number} indexSoFar Number of children encountered until this point.
* @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,
indexSoFar,
callback,
traverseContext
) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null ||
type === 'string' ||
type === 'number' ||
ReactElement.isValidElement(children)) {
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,
indexSoFar
);
return 1;
}
var child, nextName, nextIndex;
var subtreeCount = 0; // Count of children found in the current subtree.
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = (
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
getComponentKey(child, i)
);
nextIndex = indexSoFar + subtreeCount;
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
nextIndex,
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 = (
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
getComponentKey(child, ii++)
);
nextIndex = indexSoFar + subtreeCount;
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
nextIndex,
callback,
traverseContext
);
}
} else {
// 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 = (
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
getComponentKey(child, 0)
);
nextIndex = indexSoFar + subtreeCount;
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
nextIndex,
callback,
traverseContext
);
}
}
}
} else if (type === 'object') {
("production" !== "development" ? invariant(
children.nodeType !== 1,
'traverseAllChildren(...): Encountered an invalid child; DOM ' +
'elements are not valid children of React components.'
) : invariant(children.nodeType !== 1));
var fragment = ReactFragment.extract(children);
for (var key in fragment) {
if (fragment.hasOwnProperty(key)) {
child = fragment[key];
nextName = (
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
wrapUserProvidedKey(key) + SUBSEPARATOR +
getComponentKey(child, 0)
);
nextIndex = indexSoFar + subtreeCount;
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
nextIndex,
callback,
traverseContext
);
}
}
}
}
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, '', 0, callback, traverseContext);
}
module.exports = traverseAllChildren;
},{}],170:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule update
*/
'use strict';
var assign = _dereq_(29);
var keyOf = _dereq_(157);
var invariant = _dereq_(150);
function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
return assign(new x.constructor(), x);
} else {
return x;
}
}
var COMMAND_PUSH = keyOf({$push: null});
var COMMAND_UNSHIFT = keyOf({$unshift: null});
var COMMAND_SPLICE = keyOf({$splice: null});
var COMMAND_SET = keyOf({$set: null});
var COMMAND_MERGE = keyOf({$merge: null});
var COMMAND_APPLY = keyOf({$apply: null});
var ALL_COMMANDS_LIST = [
COMMAND_PUSH,
COMMAND_UNSHIFT,
COMMAND_SPLICE,
COMMAND_SET,
COMMAND_MERGE,
COMMAND_APPLY
];
var ALL_COMMANDS_SET = {};
ALL_COMMANDS_LIST.forEach(function(command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
("production" !== "development" ? invariant(
Array.isArray(value),
'update(): expected target of %s to be an array; got %s.',
command,
value
) : invariant(Array.isArray(value)));
var specValue = spec[command];
("production" !== "development" ? invariant(
Array.isArray(specValue),
'update(): expected spec of %s to be an array; got %s. ' +
'Did you forget to wrap your parameter in an array?',
command,
specValue
) : invariant(Array.isArray(specValue)));
}
function update(value, spec) {
("production" !== "development" ? invariant(
typeof spec === 'object',
'update(): You provided a key path to update() that did not contain one ' +
'of %s. Did you forget to include {%s: ...}?',
ALL_COMMANDS_LIST.join(', '),
COMMAND_SET
) : invariant(typeof spec === 'object'));
if (spec.hasOwnProperty(COMMAND_SET)) {
("production" !== "development" ? invariant(
Object.keys(spec).length === 1,
'Cannot have more than one key in an object with %s',
COMMAND_SET
) : invariant(Object.keys(spec).length === 1));
return spec[COMMAND_SET];
}
var nextValue = shallowCopy(value);
if (spec.hasOwnProperty(COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
("production" !== "development" ? invariant(
mergeObj && typeof mergeObj === 'object',
'update(): %s expects a spec of type \'object\'; got %s',
COMMAND_MERGE,
mergeObj
) : invariant(mergeObj && typeof mergeObj === 'object'));
("production" !== "development" ? invariant(
nextValue && typeof nextValue === 'object',
'update(): %s expects a target of type \'object\'; got %s',
COMMAND_MERGE,
nextValue
) : invariant(nextValue && typeof nextValue === 'object'));
assign(nextValue, spec[COMMAND_MERGE]);
}
if (spec.hasOwnProperty(COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
spec[COMMAND_PUSH].forEach(function(item) {
nextValue.push(item);
});
}
if (spec.hasOwnProperty(COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
spec[COMMAND_UNSHIFT].forEach(function(item) {
nextValue.unshift(item);
});
}
if (spec.hasOwnProperty(COMMAND_SPLICE)) {
("production" !== "development" ? invariant(
Array.isArray(value),
'Expected %s target to be an array; got %s',
COMMAND_SPLICE,
value
) : invariant(Array.isArray(value)));
("production" !== "development" ? invariant(
Array.isArray(spec[COMMAND_SPLICE]),
'update(): expected spec of %s to be an array of arrays; got %s. ' +
'Did you forget to wrap your parameters in an array?',
COMMAND_SPLICE,
spec[COMMAND_SPLICE]
) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
spec[COMMAND_SPLICE].forEach(function(args) {
("production" !== "development" ? invariant(
Array.isArray(args),
'update(): expected spec of %s to be an array of arrays; got %s. ' +
'Did you forget to wrap your parameters in an array?',
COMMAND_SPLICE,
spec[COMMAND_SPLICE]
) : invariant(Array.isArray(args)));
nextValue.splice.apply(nextValue, args);
});
}
if (spec.hasOwnProperty(COMMAND_APPLY)) {
("production" !== "development" ? invariant(
typeof spec[COMMAND_APPLY] === 'function',
'update(): expected spec of %s to be a function; got %s.',
COMMAND_APPLY,
spec[COMMAND_APPLY]
) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
nextValue = spec[COMMAND_APPLY](nextValue);
}
for (var k in spec) {
if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
nextValue[k] = update(value[k], spec[k]);
}
}
return nextValue;
}
module.exports = update;
},{}],171:[function(_dereq_,module,exports){
/**
* 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.
*
* @providesModule warning
*/
"use strict";
var emptyFunction = _dereq_(129);
/**
* 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 ("production" !== "development") {
warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || /^[s\W]*$/.test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
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) {}
}
};
}
module.exports = warning;
},{}]},{},[1])(1)
}); |
ajax/libs/clappr/0.0.86/clappr.js | camelotceo/cdnjs | require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
"use strict";
var Player = require('./components/player');
var IframePlayer = require('./components/iframe_player');
var Mediator = require('mediator');
var version = require('../package.json').version;
global.DEBUG = false;
window.Clappr = {
Player: Player,
Mediator: Mediator,
IframePlayer: IframePlayer
};
window.Clappr.version = version;
module.exports = window.Clappr;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../package.json":6,"./components/iframe_player":17,"./components/player":21,"mediator":"mediator"}],2:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canMutationObserver = typeof window !== 'undefined'
&& window.MutationObserver;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
var queue = [];
if (canMutationObserver) {
var hiddenDiv = document.createElement("div");
var observer = new MutationObserver(function () {
var queueList = queue.slice();
queue.length = 0;
queueList.forEach(function (fn) {
fn();
});
});
observer.observe(hiddenDiv, { attributes: true });
return function nextTick(fn) {
if (!queue.length) {
hiddenDiv.setAttribute('yes', 'no');
}
queue.push(fn);
};
}
if (canPost) {
window.addEventListener('message', function (ev) {
var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
},{}],3:[function(require,module,exports){
(function (process,global){
(function(global) {
'use strict';
if (global.$traceurRuntime) {
return;
}
var $Object = Object;
var $TypeError = TypeError;
var $create = $Object.create;
var $defineProperties = $Object.defineProperties;
var $defineProperty = $Object.defineProperty;
var $freeze = $Object.freeze;
var $getOwnPropertyDescriptor = $Object.getOwnPropertyDescriptor;
var $getOwnPropertyNames = $Object.getOwnPropertyNames;
var $keys = $Object.keys;
var $hasOwnProperty = $Object.prototype.hasOwnProperty;
var $toString = $Object.prototype.toString;
var $preventExtensions = Object.preventExtensions;
var $seal = Object.seal;
var $isExtensible = Object.isExtensible;
function nonEnum(value) {
return {
configurable: true,
enumerable: false,
value: value,
writable: true
};
}
var types = {
void: function voidType() {},
any: function any() {},
string: function string() {},
number: function number() {},
boolean: function boolean() {}
};
var method = nonEnum;
var counter = 0;
function newUniqueString() {
return '__$' + Math.floor(Math.random() * 1e9) + '$' + ++counter + '$__';
}
var symbolInternalProperty = newUniqueString();
var symbolDescriptionProperty = newUniqueString();
var symbolDataProperty = newUniqueString();
var symbolValues = $create(null);
var privateNames = $create(null);
function createPrivateName() {
var s = newUniqueString();
privateNames[s] = true;
return s;
}
function isSymbol(symbol) {
return typeof symbol === 'object' && symbol instanceof SymbolValue;
}
function typeOf(v) {
if (isSymbol(v))
return 'symbol';
return typeof v;
}
function Symbol(description) {
var value = new SymbolValue(description);
if (!(this instanceof Symbol))
return value;
throw new TypeError('Symbol cannot be new\'ed');
}
$defineProperty(Symbol.prototype, 'constructor', nonEnum(Symbol));
$defineProperty(Symbol.prototype, 'toString', method(function() {
var symbolValue = this[symbolDataProperty];
if (!getOption('symbols'))
return symbolValue[symbolInternalProperty];
if (!symbolValue)
throw TypeError('Conversion from symbol to string');
var desc = symbolValue[symbolDescriptionProperty];
if (desc === undefined)
desc = '';
return 'Symbol(' + desc + ')';
}));
$defineProperty(Symbol.prototype, 'valueOf', method(function() {
var symbolValue = this[symbolDataProperty];
if (!symbolValue)
throw TypeError('Conversion from symbol to string');
if (!getOption('symbols'))
return symbolValue[symbolInternalProperty];
return symbolValue;
}));
function SymbolValue(description) {
var key = newUniqueString();
$defineProperty(this, symbolDataProperty, {value: this});
$defineProperty(this, symbolInternalProperty, {value: key});
$defineProperty(this, symbolDescriptionProperty, {value: description});
freeze(this);
symbolValues[key] = this;
}
$defineProperty(SymbolValue.prototype, 'constructor', nonEnum(Symbol));
$defineProperty(SymbolValue.prototype, 'toString', {
value: Symbol.prototype.toString,
enumerable: false
});
$defineProperty(SymbolValue.prototype, 'valueOf', {
value: Symbol.prototype.valueOf,
enumerable: false
});
var hashProperty = createPrivateName();
var hashPropertyDescriptor = {value: undefined};
var hashObjectProperties = {
hash: {value: undefined},
self: {value: undefined}
};
var hashCounter = 0;
function getOwnHashObject(object) {
var hashObject = object[hashProperty];
if (hashObject && hashObject.self === object)
return hashObject;
if ($isExtensible(object)) {
hashObjectProperties.hash.value = hashCounter++;
hashObjectProperties.self.value = object;
hashPropertyDescriptor.value = $create(null, hashObjectProperties);
$defineProperty(object, hashProperty, hashPropertyDescriptor);
return hashPropertyDescriptor.value;
}
return undefined;
}
function freeze(object) {
getOwnHashObject(object);
return $freeze.apply(this, arguments);
}
function preventExtensions(object) {
getOwnHashObject(object);
return $preventExtensions.apply(this, arguments);
}
function seal(object) {
getOwnHashObject(object);
return $seal.apply(this, arguments);
}
Symbol.iterator = Symbol();
freeze(SymbolValue.prototype);
function toProperty(name) {
if (isSymbol(name))
return name[symbolInternalProperty];
return name;
}
function getOwnPropertyNames(object) {
var rv = [];
var names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var name = names[i];
if (!symbolValues[name] && !privateNames[name])
rv.push(name);
}
return rv;
}
function getOwnPropertyDescriptor(object, name) {
return $getOwnPropertyDescriptor(object, toProperty(name));
}
function getOwnPropertySymbols(object) {
var rv = [];
var names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var symbol = symbolValues[names[i]];
if (symbol)
rv.push(symbol);
}
return rv;
}
function hasOwnProperty(name) {
return $hasOwnProperty.call(this, toProperty(name));
}
function getOption(name) {
return global.traceur && global.traceur.options[name];
}
function setProperty(object, name, value) {
var sym,
desc;
if (isSymbol(name)) {
sym = name;
name = name[symbolInternalProperty];
}
object[name] = value;
if (sym && (desc = $getOwnPropertyDescriptor(object, name)))
$defineProperty(object, name, {enumerable: false});
return value;
}
function defineProperty(object, name, descriptor) {
if (isSymbol(name)) {
if (descriptor.enumerable) {
descriptor = $create(descriptor, {enumerable: {value: false}});
}
name = name[symbolInternalProperty];
}
$defineProperty(object, name, descriptor);
return object;
}
function polyfillObject(Object) {
$defineProperty(Object, 'defineProperty', {value: defineProperty});
$defineProperty(Object, 'getOwnPropertyNames', {value: getOwnPropertyNames});
$defineProperty(Object, 'getOwnPropertyDescriptor', {value: getOwnPropertyDescriptor});
$defineProperty(Object.prototype, 'hasOwnProperty', {value: hasOwnProperty});
$defineProperty(Object, 'freeze', {value: freeze});
$defineProperty(Object, 'preventExtensions', {value: preventExtensions});
$defineProperty(Object, 'seal', {value: seal});
Object.getOwnPropertySymbols = getOwnPropertySymbols;
}
function exportStar(object) {
for (var i = 1; i < arguments.length; i++) {
var names = $getOwnPropertyNames(arguments[i]);
for (var j = 0; j < names.length; j++) {
var name = names[j];
if (privateNames[name])
continue;
(function(mod, name) {
$defineProperty(object, name, {
get: function() {
return mod[name];
},
enumerable: true
});
})(arguments[i], names[j]);
}
}
return object;
}
function isObject(x) {
return x != null && (typeof x === 'object' || typeof x === 'function');
}
function toObject(x) {
if (x == null)
throw $TypeError();
return $Object(x);
}
function checkObjectCoercible(argument) {
if (argument == null) {
throw new TypeError('Value cannot be converted to an Object');
}
return argument;
}
function setupGlobals(global) {
global.Symbol = Symbol;
global.Reflect = global.Reflect || {};
global.Reflect.global = global.Reflect.global || global;
polyfillObject(global.Object);
}
setupGlobals(global);
global.$traceurRuntime = {
createPrivateName: createPrivateName,
exportStar: exportStar,
getOwnHashObject: getOwnHashObject,
privateNames: privateNames,
setProperty: setProperty,
setupGlobals: setupGlobals,
toObject: toObject,
isObject: isObject,
toProperty: toProperty,
type: types,
typeof: typeOf,
checkObjectCoercible: checkObjectCoercible,
hasOwnProperty: function(o, p) {
return hasOwnProperty.call(o, p);
},
defineProperties: $defineProperties,
defineProperty: $defineProperty,
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
getOwnPropertyNames: $getOwnPropertyNames,
keys: $keys
};
})(typeof global !== 'undefined' ? global : this);
(function() {
'use strict';
function spread() {
var rv = [],
j = 0,
iterResult;
for (var i = 0; i < arguments.length; i++) {
var valueToSpread = $traceurRuntime.checkObjectCoercible(arguments[i]);
if (typeof valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)] !== 'function') {
throw new TypeError('Cannot spread non-iterable object.');
}
var iter = valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)]();
while (!(iterResult = iter.next()).done) {
rv[j++] = iterResult.value;
}
}
return rv;
}
$traceurRuntime.spread = spread;
})();
(function() {
'use strict';
var $Object = Object;
var $TypeError = TypeError;
var $create = $Object.create;
var $defineProperties = $traceurRuntime.defineProperties;
var $defineProperty = $traceurRuntime.defineProperty;
var $getOwnPropertyDescriptor = $traceurRuntime.getOwnPropertyDescriptor;
var $getOwnPropertyNames = $traceurRuntime.getOwnPropertyNames;
var $getPrototypeOf = Object.getPrototypeOf;
function superDescriptor(homeObject, name) {
var proto = $getPrototypeOf(homeObject);
do {
var result = $getOwnPropertyDescriptor(proto, name);
if (result)
return result;
proto = $getPrototypeOf(proto);
} while (proto);
return undefined;
}
function superCall(self, homeObject, name, args) {
return superGet(self, homeObject, name).apply(self, args);
}
function superGet(self, homeObject, name) {
var descriptor = superDescriptor(homeObject, name);
if (descriptor) {
if (!descriptor.get)
return descriptor.value;
return descriptor.get.call(self);
}
return undefined;
}
function superSet(self, homeObject, name, value) {
var descriptor = superDescriptor(homeObject, name);
if (descriptor && descriptor.set) {
descriptor.set.call(self, value);
return value;
}
throw $TypeError("super has no setter '" + name + "'.");
}
function getDescriptors(object) {
var descriptors = {},
name,
names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var name = names[i];
descriptors[name] = $getOwnPropertyDescriptor(object, name);
}
return descriptors;
}
function createClass(ctor, object, staticObject, superClass) {
$defineProperty(object, 'constructor', {
value: ctor,
configurable: true,
enumerable: false,
writable: true
});
if (arguments.length > 3) {
if (typeof superClass === 'function')
ctor.__proto__ = superClass;
ctor.prototype = $create(getProtoParent(superClass), getDescriptors(object));
} else {
ctor.prototype = object;
}
$defineProperty(ctor, 'prototype', {
configurable: false,
writable: false
});
return $defineProperties(ctor, getDescriptors(staticObject));
}
function getProtoParent(superClass) {
if (typeof superClass === 'function') {
var prototype = superClass.prototype;
if ($Object(prototype) === prototype || prototype === null)
return superClass.prototype;
throw new $TypeError('super prototype must be an Object or null');
}
if (superClass === null)
return null;
throw new $TypeError(("Super expression must either be null or a function, not " + typeof superClass + "."));
}
function defaultSuperCall(self, homeObject, args) {
if ($getPrototypeOf(homeObject) !== null)
superCall(self, homeObject, 'constructor', args);
}
$traceurRuntime.createClass = createClass;
$traceurRuntime.defaultSuperCall = defaultSuperCall;
$traceurRuntime.superCall = superCall;
$traceurRuntime.superGet = superGet;
$traceurRuntime.superSet = superSet;
})();
(function() {
'use strict';
var createPrivateName = $traceurRuntime.createPrivateName;
var $defineProperties = $traceurRuntime.defineProperties;
var $defineProperty = $traceurRuntime.defineProperty;
var $create = Object.create;
var $TypeError = TypeError;
function nonEnum(value) {
return {
configurable: true,
enumerable: false,
value: value,
writable: true
};
}
var ST_NEWBORN = 0;
var ST_EXECUTING = 1;
var ST_SUSPENDED = 2;
var ST_CLOSED = 3;
var END_STATE = -2;
var RETHROW_STATE = -3;
function getInternalError(state) {
return new Error('Traceur compiler bug: invalid state in state machine: ' + state);
}
function GeneratorContext() {
this.state = 0;
this.GState = ST_NEWBORN;
this.storedException = undefined;
this.finallyFallThrough = undefined;
this.sent_ = undefined;
this.returnValue = undefined;
this.tryStack_ = [];
}
GeneratorContext.prototype = {
pushTry: function(catchState, finallyState) {
if (finallyState !== null) {
var finallyFallThrough = null;
for (var i = this.tryStack_.length - 1; i >= 0; i--) {
if (this.tryStack_[i].catch !== undefined) {
finallyFallThrough = this.tryStack_[i].catch;
break;
}
}
if (finallyFallThrough === null)
finallyFallThrough = RETHROW_STATE;
this.tryStack_.push({
finally: finallyState,
finallyFallThrough: finallyFallThrough
});
}
if (catchState !== null) {
this.tryStack_.push({catch: catchState});
}
},
popTry: function() {
this.tryStack_.pop();
},
get sent() {
this.maybeThrow();
return this.sent_;
},
set sent(v) {
this.sent_ = v;
},
get sentIgnoreThrow() {
return this.sent_;
},
maybeThrow: function() {
if (this.action === 'throw') {
this.action = 'next';
throw this.sent_;
}
},
end: function() {
switch (this.state) {
case END_STATE:
return this;
case RETHROW_STATE:
throw this.storedException;
default:
throw getInternalError(this.state);
}
},
handleException: function(ex) {
this.GState = ST_CLOSED;
this.state = END_STATE;
throw ex;
}
};
function nextOrThrow(ctx, moveNext, action, x) {
switch (ctx.GState) {
case ST_EXECUTING:
throw new Error(("\"" + action + "\" on executing generator"));
case ST_CLOSED:
if (action == 'next') {
return {
value: undefined,
done: true
};
}
throw x;
case ST_NEWBORN:
if (action === 'throw') {
ctx.GState = ST_CLOSED;
throw x;
}
if (x !== undefined)
throw $TypeError('Sent value to newborn generator');
case ST_SUSPENDED:
ctx.GState = ST_EXECUTING;
ctx.action = action;
ctx.sent = x;
var value = moveNext(ctx);
var done = value === ctx;
if (done)
value = ctx.returnValue;
ctx.GState = done ? ST_CLOSED : ST_SUSPENDED;
return {
value: value,
done: done
};
}
}
var ctxName = createPrivateName();
var moveNextName = createPrivateName();
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
GeneratorFunction.prototype = GeneratorFunctionPrototype;
$defineProperty(GeneratorFunctionPrototype, 'constructor', nonEnum(GeneratorFunction));
GeneratorFunctionPrototype.prototype = {
constructor: GeneratorFunctionPrototype,
next: function(v) {
return nextOrThrow(this[ctxName], this[moveNextName], 'next', v);
},
throw: function(v) {
return nextOrThrow(this[ctxName], this[moveNextName], 'throw', v);
}
};
$defineProperties(GeneratorFunctionPrototype.prototype, {
constructor: {enumerable: false},
next: {enumerable: false},
throw: {enumerable: false}
});
Object.defineProperty(GeneratorFunctionPrototype.prototype, Symbol.iterator, nonEnum(function() {
return this;
}));
function createGeneratorInstance(innerFunction, functionObject, self) {
var moveNext = getMoveNext(innerFunction, self);
var ctx = new GeneratorContext();
var object = $create(functionObject.prototype);
object[ctxName] = ctx;
object[moveNextName] = moveNext;
return object;
}
function initGeneratorFunction(functionObject) {
functionObject.prototype = $create(GeneratorFunctionPrototype.prototype);
functionObject.__proto__ = GeneratorFunctionPrototype;
return functionObject;
}
function AsyncFunctionContext() {
GeneratorContext.call(this);
this.err = undefined;
var ctx = this;
ctx.result = new Promise(function(resolve, reject) {
ctx.resolve = resolve;
ctx.reject = reject;
});
}
AsyncFunctionContext.prototype = $create(GeneratorContext.prototype);
AsyncFunctionContext.prototype.end = function() {
switch (this.state) {
case END_STATE:
this.resolve(this.returnValue);
break;
case RETHROW_STATE:
this.reject(this.storedException);
break;
default:
this.reject(getInternalError(this.state));
}
};
AsyncFunctionContext.prototype.handleException = function() {
this.state = RETHROW_STATE;
};
function asyncWrap(innerFunction, self) {
var moveNext = getMoveNext(innerFunction, self);
var ctx = new AsyncFunctionContext();
ctx.createCallback = function(newState) {
return function(value) {
ctx.state = newState;
ctx.value = value;
moveNext(ctx);
};
};
ctx.errback = function(err) {
handleCatch(ctx, err);
moveNext(ctx);
};
moveNext(ctx);
return ctx.result;
}
function getMoveNext(innerFunction, self) {
return function(ctx) {
while (true) {
try {
return innerFunction.call(self, ctx);
} catch (ex) {
handleCatch(ctx, ex);
}
}
};
}
function handleCatch(ctx, ex) {
ctx.storedException = ex;
var last = ctx.tryStack_[ctx.tryStack_.length - 1];
if (!last) {
ctx.handleException(ex);
return;
}
ctx.state = last.catch !== undefined ? last.catch : last.finally;
if (last.finallyFallThrough !== undefined)
ctx.finallyFallThrough = last.finallyFallThrough;
}
$traceurRuntime.asyncWrap = asyncWrap;
$traceurRuntime.initGeneratorFunction = initGeneratorFunction;
$traceurRuntime.createGeneratorInstance = createGeneratorInstance;
})();
(function() {
function buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
var out = [];
if (opt_scheme) {
out.push(opt_scheme, ':');
}
if (opt_domain) {
out.push('//');
if (opt_userInfo) {
out.push(opt_userInfo, '@');
}
out.push(opt_domain);
if (opt_port) {
out.push(':', opt_port);
}
}
if (opt_path) {
out.push(opt_path);
}
if (opt_queryData) {
out.push('?', opt_queryData);
}
if (opt_fragment) {
out.push('#', opt_fragment);
}
return out.join('');
}
;
var splitRe = new RegExp('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$');
var ComponentIndex = {
SCHEME: 1,
USER_INFO: 2,
DOMAIN: 3,
PORT: 4,
PATH: 5,
QUERY_DATA: 6,
FRAGMENT: 7
};
function split(uri) {
return (uri.match(splitRe));
}
function removeDotSegments(path) {
if (path === '/')
return '/';
var leadingSlash = path[0] === '/' ? '/' : '';
var trailingSlash = path.slice(-1) === '/' ? '/' : '';
var segments = path.split('/');
var out = [];
var up = 0;
for (var pos = 0; pos < segments.length; pos++) {
var segment = segments[pos];
switch (segment) {
case '':
case '.':
break;
case '..':
if (out.length)
out.pop();
else
up++;
break;
default:
out.push(segment);
}
}
if (!leadingSlash) {
while (up-- > 0) {
out.unshift('..');
}
if (out.length === 0)
out.push('.');
}
return leadingSlash + out.join('/') + trailingSlash;
}
function joinAndCanonicalizePath(parts) {
var path = parts[ComponentIndex.PATH] || '';
path = removeDotSegments(path);
parts[ComponentIndex.PATH] = path;
return buildFromEncodedParts(parts[ComponentIndex.SCHEME], parts[ComponentIndex.USER_INFO], parts[ComponentIndex.DOMAIN], parts[ComponentIndex.PORT], parts[ComponentIndex.PATH], parts[ComponentIndex.QUERY_DATA], parts[ComponentIndex.FRAGMENT]);
}
function canonicalizeUrl(url) {
var parts = split(url);
return joinAndCanonicalizePath(parts);
}
function resolveUrl(base, url) {
var parts = split(url);
var baseParts = split(base);
if (parts[ComponentIndex.SCHEME]) {
return joinAndCanonicalizePath(parts);
} else {
parts[ComponentIndex.SCHEME] = baseParts[ComponentIndex.SCHEME];
}
for (var i = ComponentIndex.SCHEME; i <= ComponentIndex.PORT; i++) {
if (!parts[i]) {
parts[i] = baseParts[i];
}
}
if (parts[ComponentIndex.PATH][0] == '/') {
return joinAndCanonicalizePath(parts);
}
var path = baseParts[ComponentIndex.PATH];
var index = path.lastIndexOf('/');
path = path.slice(0, index + 1) + parts[ComponentIndex.PATH];
parts[ComponentIndex.PATH] = path;
return joinAndCanonicalizePath(parts);
}
function isAbsolute(name) {
if (!name)
return false;
if (name[0] === '/')
return true;
var parts = split(name);
if (parts[ComponentIndex.SCHEME])
return true;
return false;
}
$traceurRuntime.canonicalizeUrl = canonicalizeUrl;
$traceurRuntime.isAbsolute = isAbsolute;
$traceurRuntime.removeDotSegments = removeDotSegments;
$traceurRuntime.resolveUrl = resolveUrl;
})();
(function(global) {
'use strict';
var $__2 = $traceurRuntime,
canonicalizeUrl = $__2.canonicalizeUrl,
resolveUrl = $__2.resolveUrl,
isAbsolute = $__2.isAbsolute;
var moduleInstantiators = Object.create(null);
var baseURL;
if (global.location && global.location.href)
baseURL = resolveUrl(global.location.href, './');
else
baseURL = '';
var UncoatedModuleEntry = function UncoatedModuleEntry(url, uncoatedModule) {
this.url = url;
this.value_ = uncoatedModule;
};
($traceurRuntime.createClass)(UncoatedModuleEntry, {}, {});
var ModuleEvaluationError = function ModuleEvaluationError(erroneousModuleName, cause) {
this.message = this.constructor.name + ': ' + this.stripCause(cause) + ' in ' + erroneousModuleName;
if (!(cause instanceof $ModuleEvaluationError) && cause.stack)
this.stack = this.stripStack(cause.stack);
else
this.stack = '';
};
var $ModuleEvaluationError = ModuleEvaluationError;
($traceurRuntime.createClass)(ModuleEvaluationError, {
stripError: function(message) {
return message.replace(/.*Error:/, this.constructor.name + ':');
},
stripCause: function(cause) {
if (!cause)
return '';
if (!cause.message)
return cause + '';
return this.stripError(cause.message);
},
loadedBy: function(moduleName) {
this.stack += '\n loaded by ' + moduleName;
},
stripStack: function(causeStack) {
var stack = [];
causeStack.split('\n').some((function(frame) {
if (/UncoatedModuleInstantiator/.test(frame))
return true;
stack.push(frame);
}));
stack[0] = this.stripError(stack[0]);
return stack.join('\n');
}
}, {}, Error);
var UncoatedModuleInstantiator = function UncoatedModuleInstantiator(url, func) {
$traceurRuntime.superCall(this, $UncoatedModuleInstantiator.prototype, "constructor", [url, null]);
this.func = func;
};
var $UncoatedModuleInstantiator = UncoatedModuleInstantiator;
($traceurRuntime.createClass)(UncoatedModuleInstantiator, {getUncoatedModule: function() {
if (this.value_)
return this.value_;
try {
return this.value_ = this.func.call(global);
} catch (ex) {
if (ex instanceof ModuleEvaluationError) {
ex.loadedBy(this.url);
throw ex;
}
throw new ModuleEvaluationError(this.url, ex);
}
}}, {}, UncoatedModuleEntry);
function getUncoatedModuleInstantiator(name) {
if (!name)
return;
var url = ModuleStore.normalize(name);
return moduleInstantiators[url];
}
;
var moduleInstances = Object.create(null);
var liveModuleSentinel = {};
function Module(uncoatedModule) {
var isLive = arguments[1];
var coatedModule = Object.create(null);
Object.getOwnPropertyNames(uncoatedModule).forEach((function(name) {
var getter,
value;
if (isLive === liveModuleSentinel) {
var descr = Object.getOwnPropertyDescriptor(uncoatedModule, name);
if (descr.get)
getter = descr.get;
}
if (!getter) {
value = uncoatedModule[name];
getter = function() {
return value;
};
}
Object.defineProperty(coatedModule, name, {
get: getter,
enumerable: true
});
}));
Object.preventExtensions(coatedModule);
return coatedModule;
}
var ModuleStore = {
normalize: function(name, refererName, refererAddress) {
if (typeof name !== "string")
throw new TypeError("module name must be a string, not " + typeof name);
if (isAbsolute(name))
return canonicalizeUrl(name);
if (/[^\.]\/\.\.\//.test(name)) {
throw new Error('module name embeds /../: ' + name);
}
if (name[0] === '.' && refererName)
return resolveUrl(refererName, name);
return canonicalizeUrl(name);
},
get: function(normalizedName) {
var m = getUncoatedModuleInstantiator(normalizedName);
if (!m)
return undefined;
var moduleInstance = moduleInstances[m.url];
if (moduleInstance)
return moduleInstance;
moduleInstance = Module(m.getUncoatedModule(), liveModuleSentinel);
return moduleInstances[m.url] = moduleInstance;
},
set: function(normalizedName, module) {
normalizedName = String(normalizedName);
moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, (function() {
return module;
}));
moduleInstances[normalizedName] = module;
},
get baseURL() {
return baseURL;
},
set baseURL(v) {
baseURL = String(v);
},
registerModule: function(name, func) {
var normalizedName = ModuleStore.normalize(name);
if (moduleInstantiators[normalizedName])
throw new Error('duplicate module named ' + normalizedName);
moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, func);
},
bundleStore: Object.create(null),
register: function(name, deps, func) {
if (!deps || !deps.length && !func.length) {
this.registerModule(name, func);
} else {
this.bundleStore[name] = {
deps: deps,
execute: function() {
var $__0 = arguments;
var depMap = {};
deps.forEach((function(dep, index) {
return depMap[dep] = $__0[index];
}));
var registryEntry = func.call(this, depMap);
registryEntry.execute.call(this);
return registryEntry.exports;
}
};
}
},
getAnonymousModule: function(func) {
return new Module(func.call(global), liveModuleSentinel);
},
getForTesting: function(name) {
var $__0 = this;
if (!this.testingPrefix_) {
Object.keys(moduleInstances).some((function(key) {
var m = /(traceur@[^\/]*\/)/.exec(key);
if (m) {
$__0.testingPrefix_ = m[1];
return true;
}
}));
}
return this.get(this.testingPrefix_ + name);
}
};
ModuleStore.set('@traceur/src/runtime/ModuleStore', new Module({ModuleStore: ModuleStore}));
var setupGlobals = $traceurRuntime.setupGlobals;
$traceurRuntime.setupGlobals = function(global) {
setupGlobals(global);
};
$traceurRuntime.ModuleStore = ModuleStore;
global.System = {
register: ModuleStore.register.bind(ModuleStore),
get: ModuleStore.get,
set: ModuleStore.set,
normalize: ModuleStore.normalize
};
$traceurRuntime.getModuleImpl = function(name) {
var instantiator = getUncoatedModuleInstantiator(name);
return instantiator && instantiator.getUncoatedModule();
};
})(typeof global !== 'undefined' ? global : this);
System.register("[email protected]/src/runtime/polyfills/utils", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/utils";
var $ceil = Math.ceil;
var $floor = Math.floor;
var $isFinite = isFinite;
var $isNaN = isNaN;
var $pow = Math.pow;
var $min = Math.min;
var toObject = $traceurRuntime.toObject;
function toUint32(x) {
return x >>> 0;
}
function isObject(x) {
return x && (typeof x === 'object' || typeof x === 'function');
}
function isCallable(x) {
return typeof x === 'function';
}
function isNumber(x) {
return typeof x === 'number';
}
function toInteger(x) {
x = +x;
if ($isNaN(x))
return 0;
if (x === 0 || !$isFinite(x))
return x;
return x > 0 ? $floor(x) : $ceil(x);
}
var MAX_SAFE_LENGTH = $pow(2, 53) - 1;
function toLength(x) {
var len = toInteger(x);
return len < 0 ? 0 : $min(len, MAX_SAFE_LENGTH);
}
function checkIterable(x) {
return !isObject(x) ? undefined : x[Symbol.iterator];
}
function isConstructor(x) {
return isCallable(x);
}
function createIteratorResultObject(value, done) {
return {
value: value,
done: done
};
}
function maybeDefine(object, name, descr) {
if (!(name in object)) {
Object.defineProperty(object, name, descr);
}
}
function maybeDefineMethod(object, name, value) {
maybeDefine(object, name, {
value: value,
configurable: true,
enumerable: false,
writable: true
});
}
function maybeDefineConst(object, name, value) {
maybeDefine(object, name, {
value: value,
configurable: false,
enumerable: false,
writable: false
});
}
function maybeAddFunctions(object, functions) {
for (var i = 0; i < functions.length; i += 2) {
var name = functions[i];
var value = functions[i + 1];
maybeDefineMethod(object, name, value);
}
}
function maybeAddConsts(object, consts) {
for (var i = 0; i < consts.length; i += 2) {
var name = consts[i];
var value = consts[i + 1];
maybeDefineConst(object, name, value);
}
}
function maybeAddIterator(object, func, Symbol) {
if (!Symbol || !Symbol.iterator || object[Symbol.iterator])
return;
if (object['@@iterator'])
func = object['@@iterator'];
Object.defineProperty(object, Symbol.iterator, {
value: func,
configurable: true,
enumerable: false,
writable: true
});
}
var polyfills = [];
function registerPolyfill(func) {
polyfills.push(func);
}
function polyfillAll(global) {
polyfills.forEach((function(f) {
return f(global);
}));
}
return {
get toObject() {
return toObject;
},
get toUint32() {
return toUint32;
},
get isObject() {
return isObject;
},
get isCallable() {
return isCallable;
},
get isNumber() {
return isNumber;
},
get toInteger() {
return toInteger;
},
get toLength() {
return toLength;
},
get checkIterable() {
return checkIterable;
},
get isConstructor() {
return isConstructor;
},
get createIteratorResultObject() {
return createIteratorResultObject;
},
get maybeDefine() {
return maybeDefine;
},
get maybeDefineMethod() {
return maybeDefineMethod;
},
get maybeDefineConst() {
return maybeDefineConst;
},
get maybeAddFunctions() {
return maybeAddFunctions;
},
get maybeAddConsts() {
return maybeAddConsts;
},
get maybeAddIterator() {
return maybeAddIterator;
},
get registerPolyfill() {
return registerPolyfill;
},
get polyfillAll() {
return polyfillAll;
}
};
});
System.register("[email protected]/src/runtime/polyfills/Map", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/Map";
var $__3 = System.get("[email protected]/src/runtime/polyfills/utils"),
isObject = $__3.isObject,
maybeAddIterator = $__3.maybeAddIterator,
registerPolyfill = $__3.registerPolyfill;
var getOwnHashObject = $traceurRuntime.getOwnHashObject;
var $hasOwnProperty = Object.prototype.hasOwnProperty;
var deletedSentinel = {};
function lookupIndex(map, key) {
if (isObject(key)) {
var hashObject = getOwnHashObject(key);
return hashObject && map.objectIndex_[hashObject.hash];
}
if (typeof key === 'string')
return map.stringIndex_[key];
return map.primitiveIndex_[key];
}
function initMap(map) {
map.entries_ = [];
map.objectIndex_ = Object.create(null);
map.stringIndex_ = Object.create(null);
map.primitiveIndex_ = Object.create(null);
map.deletedCount_ = 0;
}
var Map = function Map() {
var iterable = arguments[0];
if (!isObject(this))
throw new TypeError('Map called on incompatible type');
if ($hasOwnProperty.call(this, 'entries_')) {
throw new TypeError('Map can not be reentrantly initialised');
}
initMap(this);
if (iterable !== null && iterable !== undefined) {
for (var $__5 = iterable[Symbol.iterator](),
$__6; !($__6 = $__5.next()).done; ) {
var $__7 = $__6.value,
key = $__7[0],
value = $__7[1];
{
this.set(key, value);
}
}
}
};
($traceurRuntime.createClass)(Map, {
get size() {
return this.entries_.length / 2 - this.deletedCount_;
},
get: function(key) {
var index = lookupIndex(this, key);
if (index !== undefined)
return this.entries_[index + 1];
},
set: function(key, value) {
var objectMode = isObject(key);
var stringMode = typeof key === 'string';
var index = lookupIndex(this, key);
if (index !== undefined) {
this.entries_[index + 1] = value;
} else {
index = this.entries_.length;
this.entries_[index] = key;
this.entries_[index + 1] = value;
if (objectMode) {
var hashObject = getOwnHashObject(key);
var hash = hashObject.hash;
this.objectIndex_[hash] = index;
} else if (stringMode) {
this.stringIndex_[key] = index;
} else {
this.primitiveIndex_[key] = index;
}
}
return this;
},
has: function(key) {
return lookupIndex(this, key) !== undefined;
},
delete: function(key) {
var objectMode = isObject(key);
var stringMode = typeof key === 'string';
var index;
var hash;
if (objectMode) {
var hashObject = getOwnHashObject(key);
if (hashObject) {
index = this.objectIndex_[hash = hashObject.hash];
delete this.objectIndex_[hash];
}
} else if (stringMode) {
index = this.stringIndex_[key];
delete this.stringIndex_[key];
} else {
index = this.primitiveIndex_[key];
delete this.primitiveIndex_[key];
}
if (index !== undefined) {
this.entries_[index] = deletedSentinel;
this.entries_[index + 1] = undefined;
this.deletedCount_++;
return true;
}
return false;
},
clear: function() {
initMap(this);
},
forEach: function(callbackFn) {
var thisArg = arguments[1];
for (var i = 0; i < this.entries_.length; i += 2) {
var key = this.entries_[i];
var value = this.entries_[i + 1];
if (key === deletedSentinel)
continue;
callbackFn.call(thisArg, value, key, this);
}
},
entries: $traceurRuntime.initGeneratorFunction(function $__8() {
var i,
key,
value;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
i = 0;
$ctx.state = 12;
break;
case 12:
$ctx.state = (i < this.entries_.length) ? 8 : -2;
break;
case 4:
i += 2;
$ctx.state = 12;
break;
case 8:
key = this.entries_[i];
value = this.entries_[i + 1];
$ctx.state = 9;
break;
case 9:
$ctx.state = (key === deletedSentinel) ? 4 : 6;
break;
case 6:
$ctx.state = 2;
return [key, value];
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__8, this);
}),
keys: $traceurRuntime.initGeneratorFunction(function $__9() {
var i,
key,
value;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
i = 0;
$ctx.state = 12;
break;
case 12:
$ctx.state = (i < this.entries_.length) ? 8 : -2;
break;
case 4:
i += 2;
$ctx.state = 12;
break;
case 8:
key = this.entries_[i];
value = this.entries_[i + 1];
$ctx.state = 9;
break;
case 9:
$ctx.state = (key === deletedSentinel) ? 4 : 6;
break;
case 6:
$ctx.state = 2;
return key;
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__9, this);
}),
values: $traceurRuntime.initGeneratorFunction(function $__10() {
var i,
key,
value;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
i = 0;
$ctx.state = 12;
break;
case 12:
$ctx.state = (i < this.entries_.length) ? 8 : -2;
break;
case 4:
i += 2;
$ctx.state = 12;
break;
case 8:
key = this.entries_[i];
value = this.entries_[i + 1];
$ctx.state = 9;
break;
case 9:
$ctx.state = (key === deletedSentinel) ? 4 : 6;
break;
case 6:
$ctx.state = 2;
return value;
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__10, this);
})
}, {});
Object.defineProperty(Map.prototype, Symbol.iterator, {
configurable: true,
writable: true,
value: Map.prototype.entries
});
function polyfillMap(global) {
var $__7 = global,
Object = $__7.Object,
Symbol = $__7.Symbol;
if (!global.Map)
global.Map = Map;
var mapPrototype = global.Map.prototype;
if (mapPrototype.entries) {
maybeAddIterator(mapPrototype, mapPrototype.entries, Symbol);
maybeAddIterator(Object.getPrototypeOf(new global.Map().entries()), function() {
return this;
}, Symbol);
}
}
registerPolyfill(polyfillMap);
return {
get Map() {
return Map;
},
get polyfillMap() {
return polyfillMap;
}
};
});
System.get("[email protected]/src/runtime/polyfills/Map" + '');
System.register("[email protected]/src/runtime/polyfills/Set", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/Set";
var $__11 = System.get("[email protected]/src/runtime/polyfills/utils"),
isObject = $__11.isObject,
maybeAddIterator = $__11.maybeAddIterator,
registerPolyfill = $__11.registerPolyfill;
var Map = System.get("[email protected]/src/runtime/polyfills/Map").Map;
var getOwnHashObject = $traceurRuntime.getOwnHashObject;
var $hasOwnProperty = Object.prototype.hasOwnProperty;
function initSet(set) {
set.map_ = new Map();
}
var Set = function Set() {
var iterable = arguments[0];
if (!isObject(this))
throw new TypeError('Set called on incompatible type');
if ($hasOwnProperty.call(this, 'map_')) {
throw new TypeError('Set can not be reentrantly initialised');
}
initSet(this);
if (iterable !== null && iterable !== undefined) {
for (var $__15 = iterable[Symbol.iterator](),
$__16; !($__16 = $__15.next()).done; ) {
var item = $__16.value;
{
this.add(item);
}
}
}
};
($traceurRuntime.createClass)(Set, {
get size() {
return this.map_.size;
},
has: function(key) {
return this.map_.has(key);
},
add: function(key) {
this.map_.set(key, key);
return this;
},
delete: function(key) {
return this.map_.delete(key);
},
clear: function() {
return this.map_.clear();
},
forEach: function(callbackFn) {
var thisArg = arguments[1];
var $__13 = this;
return this.map_.forEach((function(value, key) {
callbackFn.call(thisArg, key, key, $__13);
}));
},
values: $traceurRuntime.initGeneratorFunction(function $__18() {
var $__19,
$__20;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
$__19 = this.map_.keys()[Symbol.iterator]();
$ctx.sent = void 0;
$ctx.action = 'next';
$ctx.state = 12;
break;
case 12:
$__20 = $__19[$ctx.action]($ctx.sentIgnoreThrow);
$ctx.state = 9;
break;
case 9:
$ctx.state = ($__20.done) ? 3 : 2;
break;
case 3:
$ctx.sent = $__20.value;
$ctx.state = -2;
break;
case 2:
$ctx.state = 12;
return $__20.value;
default:
return $ctx.end();
}
}, $__18, this);
}),
entries: $traceurRuntime.initGeneratorFunction(function $__21() {
var $__22,
$__23;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
$__22 = this.map_.entries()[Symbol.iterator]();
$ctx.sent = void 0;
$ctx.action = 'next';
$ctx.state = 12;
break;
case 12:
$__23 = $__22[$ctx.action]($ctx.sentIgnoreThrow);
$ctx.state = 9;
break;
case 9:
$ctx.state = ($__23.done) ? 3 : 2;
break;
case 3:
$ctx.sent = $__23.value;
$ctx.state = -2;
break;
case 2:
$ctx.state = 12;
return $__23.value;
default:
return $ctx.end();
}
}, $__21, this);
})
}, {});
Object.defineProperty(Set.prototype, Symbol.iterator, {
configurable: true,
writable: true,
value: Set.prototype.values
});
Object.defineProperty(Set.prototype, 'keys', {
configurable: true,
writable: true,
value: Set.prototype.values
});
function polyfillSet(global) {
var $__17 = global,
Object = $__17.Object,
Symbol = $__17.Symbol;
if (!global.Set)
global.Set = Set;
var setPrototype = global.Set.prototype;
if (setPrototype.values) {
maybeAddIterator(setPrototype, setPrototype.values, Symbol);
maybeAddIterator(Object.getPrototypeOf(new global.Set().values()), function() {
return this;
}, Symbol);
}
}
registerPolyfill(polyfillSet);
return {
get Set() {
return Set;
},
get polyfillSet() {
return polyfillSet;
}
};
});
System.get("[email protected]/src/runtime/polyfills/Set" + '');
System.register("[email protected]/node_modules/rsvp/lib/rsvp/asap", [], function() {
"use strict";
var __moduleName = "[email protected]/node_modules/rsvp/lib/rsvp/asap";
var len = 0;
function asap(callback, arg) {
queue[len] = callback;
queue[len + 1] = arg;
len += 2;
if (len === 2) {
scheduleFlush();
}
}
var $__default = asap;
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
function useNextTick() {
return function() {
process.nextTick(flush);
};
}
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);
};
}
function useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = flush;
return function() {
channel.port2.postMessage(0);
};
}
function useSetTimeout() {
return function() {
setTimeout(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;
}
var scheduleFlush;
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
} else {
scheduleFlush = useSetTimeout();
}
return {get default() {
return $__default;
}};
});
System.register("[email protected]/src/runtime/polyfills/Promise", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/Promise";
var async = System.get("[email protected]/node_modules/rsvp/lib/rsvp/asap").default;
var registerPolyfill = System.get("[email protected]/src/runtime/polyfills/utils").registerPolyfill;
var promiseRaw = {};
function isPromise(x) {
return x && typeof x === 'object' && x.status_ !== undefined;
}
function idResolveHandler(x) {
return x;
}
function idRejectHandler(x) {
throw x;
}
function chain(promise) {
var onResolve = arguments[1] !== (void 0) ? arguments[1] : idResolveHandler;
var onReject = arguments[2] !== (void 0) ? arguments[2] : idRejectHandler;
var deferred = getDeferred(promise.constructor);
switch (promise.status_) {
case undefined:
throw TypeError;
case 0:
promise.onResolve_.push(onResolve, deferred);
promise.onReject_.push(onReject, deferred);
break;
case +1:
promiseEnqueue(promise.value_, [onResolve, deferred]);
break;
case -1:
promiseEnqueue(promise.value_, [onReject, deferred]);
break;
}
return deferred.promise;
}
function getDeferred(C) {
if (this === $Promise) {
var promise = promiseInit(new $Promise(promiseRaw));
return {
promise: promise,
resolve: (function(x) {
promiseResolve(promise, x);
}),
reject: (function(r) {
promiseReject(promise, r);
})
};
} else {
var result = {};
result.promise = new C((function(resolve, reject) {
result.resolve = resolve;
result.reject = reject;
}));
return result;
}
}
function promiseSet(promise, status, value, onResolve, onReject) {
promise.status_ = status;
promise.value_ = value;
promise.onResolve_ = onResolve;
promise.onReject_ = onReject;
return promise;
}
function promiseInit(promise) {
return promiseSet(promise, 0, undefined, [], []);
}
var Promise = function Promise(resolver) {
if (resolver === promiseRaw)
return;
if (typeof resolver !== 'function')
throw new TypeError;
var promise = promiseInit(this);
try {
resolver((function(x) {
promiseResolve(promise, x);
}), (function(r) {
promiseReject(promise, r);
}));
} catch (e) {
promiseReject(promise, e);
}
};
($traceurRuntime.createClass)(Promise, {
catch: function(onReject) {
return this.then(undefined, onReject);
},
then: function(onResolve, onReject) {
if (typeof onResolve !== 'function')
onResolve = idResolveHandler;
if (typeof onReject !== 'function')
onReject = idRejectHandler;
var that = this;
var constructor = this.constructor;
return chain(this, function(x) {
x = promiseCoerce(constructor, x);
return x === that ? onReject(new TypeError) : isPromise(x) ? x.then(onResolve, onReject) : onResolve(x);
}, onReject);
}
}, {
resolve: function(x) {
if (this === $Promise) {
if (isPromise(x)) {
return x;
}
return promiseSet(new $Promise(promiseRaw), +1, x);
} else {
return new this(function(resolve, reject) {
resolve(x);
});
}
},
reject: function(r) {
if (this === $Promise) {
return promiseSet(new $Promise(promiseRaw), -1, r);
} else {
return new this((function(resolve, reject) {
reject(r);
}));
}
},
all: function(values) {
var deferred = getDeferred(this);
var resolutions = [];
try {
var count = values.length;
if (count === 0) {
deferred.resolve(resolutions);
} else {
for (var i = 0; i < values.length; i++) {
this.resolve(values[i]).then(function(i, x) {
resolutions[i] = x;
if (--count === 0)
deferred.resolve(resolutions);
}.bind(undefined, i), (function(r) {
deferred.reject(r);
}));
}
}
} catch (e) {
deferred.reject(e);
}
return deferred.promise;
},
race: function(values) {
var deferred = getDeferred(this);
try {
for (var i = 0; i < values.length; i++) {
this.resolve(values[i]).then((function(x) {
deferred.resolve(x);
}), (function(r) {
deferred.reject(r);
}));
}
} catch (e) {
deferred.reject(e);
}
return deferred.promise;
}
});
var $Promise = Promise;
var $PromiseReject = $Promise.reject;
function promiseResolve(promise, x) {
promiseDone(promise, +1, x, promise.onResolve_);
}
function promiseReject(promise, r) {
promiseDone(promise, -1, r, promise.onReject_);
}
function promiseDone(promise, status, value, reactions) {
if (promise.status_ !== 0)
return;
promiseEnqueue(value, reactions);
promiseSet(promise, status, value);
}
function promiseEnqueue(value, tasks) {
async((function() {
for (var i = 0; i < tasks.length; i += 2) {
promiseHandle(value, tasks[i], tasks[i + 1]);
}
}));
}
function promiseHandle(value, handler, deferred) {
try {
var result = handler(value);
if (result === deferred.promise)
throw new TypeError;
else if (isPromise(result))
chain(result, deferred.resolve, deferred.reject);
else
deferred.resolve(result);
} catch (e) {
try {
deferred.reject(e);
} catch (e) {}
}
}
var thenableSymbol = '@@thenable';
function isObject(x) {
return x && (typeof x === 'object' || typeof x === 'function');
}
function promiseCoerce(constructor, x) {
if (!isPromise(x) && isObject(x)) {
var then;
try {
then = x.then;
} catch (r) {
var promise = $PromiseReject.call(constructor, r);
x[thenableSymbol] = promise;
return promise;
}
if (typeof then === 'function') {
var p = x[thenableSymbol];
if (p) {
return p;
} else {
var deferred = getDeferred(constructor);
x[thenableSymbol] = deferred.promise;
try {
then.call(x, deferred.resolve, deferred.reject);
} catch (r) {
deferred.reject(r);
}
return deferred.promise;
}
}
}
return x;
}
function polyfillPromise(global) {
if (!global.Promise)
global.Promise = Promise;
}
registerPolyfill(polyfillPromise);
return {
get Promise() {
return Promise;
},
get polyfillPromise() {
return polyfillPromise;
}
};
});
System.get("[email protected]/src/runtime/polyfills/Promise" + '');
System.register("[email protected]/src/runtime/polyfills/StringIterator", [], function() {
"use strict";
var $__29;
var __moduleName = "[email protected]/src/runtime/polyfills/StringIterator";
var $__27 = System.get("[email protected]/src/runtime/polyfills/utils"),
createIteratorResultObject = $__27.createIteratorResultObject,
isObject = $__27.isObject;
var $__30 = $traceurRuntime,
hasOwnProperty = $__30.hasOwnProperty,
toProperty = $__30.toProperty;
var iteratedString = Symbol('iteratedString');
var stringIteratorNextIndex = Symbol('stringIteratorNextIndex');
var StringIterator = function StringIterator() {};
($traceurRuntime.createClass)(StringIterator, ($__29 = {}, Object.defineProperty($__29, "next", {
value: function() {
var o = this;
if (!isObject(o) || !hasOwnProperty(o, iteratedString)) {
throw new TypeError('this must be a StringIterator object');
}
var s = o[toProperty(iteratedString)];
if (s === undefined) {
return createIteratorResultObject(undefined, true);
}
var position = o[toProperty(stringIteratorNextIndex)];
var len = s.length;
if (position >= len) {
o[toProperty(iteratedString)] = undefined;
return createIteratorResultObject(undefined, true);
}
var first = s.charCodeAt(position);
var resultString;
if (first < 0xD800 || first > 0xDBFF || position + 1 === len) {
resultString = String.fromCharCode(first);
} else {
var second = s.charCodeAt(position + 1);
if (second < 0xDC00 || second > 0xDFFF) {
resultString = String.fromCharCode(first);
} else {
resultString = String.fromCharCode(first) + String.fromCharCode(second);
}
}
o[toProperty(stringIteratorNextIndex)] = position + resultString.length;
return createIteratorResultObject(resultString, false);
},
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__29, Symbol.iterator, {
value: function() {
return this;
},
configurable: true,
enumerable: true,
writable: true
}), $__29), {});
function createStringIterator(string) {
var s = String(string);
var iterator = Object.create(StringIterator.prototype);
iterator[toProperty(iteratedString)] = s;
iterator[toProperty(stringIteratorNextIndex)] = 0;
return iterator;
}
return {get createStringIterator() {
return createStringIterator;
}};
});
System.register("[email protected]/src/runtime/polyfills/String", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/String";
var createStringIterator = System.get("[email protected]/src/runtime/polyfills/StringIterator").createStringIterator;
var $__32 = System.get("[email protected]/src/runtime/polyfills/utils"),
maybeAddFunctions = $__32.maybeAddFunctions,
maybeAddIterator = $__32.maybeAddIterator,
registerPolyfill = $__32.registerPolyfill;
var $toString = Object.prototype.toString;
var $indexOf = String.prototype.indexOf;
var $lastIndexOf = String.prototype.lastIndexOf;
function startsWith(search) {
var string = String(this);
if (this == null || $toString.call(search) == '[object RegExp]') {
throw TypeError();
}
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var position = arguments.length > 1 ? arguments[1] : undefined;
var pos = position ? Number(position) : 0;
if (isNaN(pos)) {
pos = 0;
}
var start = Math.min(Math.max(pos, 0), stringLength);
return $indexOf.call(string, searchString, pos) == start;
}
function endsWith(search) {
var string = String(this);
if (this == null || $toString.call(search) == '[object RegExp]') {
throw TypeError();
}
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var pos = stringLength;
if (arguments.length > 1) {
var position = arguments[1];
if (position !== undefined) {
pos = position ? Number(position) : 0;
if (isNaN(pos)) {
pos = 0;
}
}
}
var end = Math.min(Math.max(pos, 0), stringLength);
var start = end - searchLength;
if (start < 0) {
return false;
}
return $lastIndexOf.call(string, searchString, start) == start;
}
function contains(search) {
if (this == null) {
throw TypeError();
}
var string = String(this);
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var position = arguments.length > 1 ? arguments[1] : undefined;
var pos = position ? Number(position) : 0;
if (isNaN(pos)) {
pos = 0;
}
var start = Math.min(Math.max(pos, 0), stringLength);
return $indexOf.call(string, searchString, pos) != -1;
}
function repeat(count) {
if (this == null) {
throw TypeError();
}
var string = String(this);
var n = count ? Number(count) : 0;
if (isNaN(n)) {
n = 0;
}
if (n < 0 || n == Infinity) {
throw RangeError();
}
if (n == 0) {
return '';
}
var result = '';
while (n--) {
result += string;
}
return result;
}
function codePointAt(position) {
if (this == null) {
throw TypeError();
}
var string = String(this);
var size = string.length;
var index = position ? Number(position) : 0;
if (isNaN(index)) {
index = 0;
}
if (index < 0 || index >= size) {
return undefined;
}
var first = string.charCodeAt(index);
var second;
if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) {
second = string.charCodeAt(index + 1);
if (second >= 0xDC00 && second <= 0xDFFF) {
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
}
}
return first;
}
function raw(callsite) {
var raw = callsite.raw;
var len = raw.length >>> 0;
if (len === 0)
return '';
var s = '';
var i = 0;
while (true) {
s += raw[i];
if (i + 1 === len)
return s;
s += arguments[++i];
}
}
function fromCodePoint() {
var codeUnits = [];
var floor = Math.floor;
var highSurrogate;
var lowSurrogate;
var index = -1;
var length = arguments.length;
if (!length) {
return '';
}
while (++index < length) {
var codePoint = Number(arguments[index]);
if (!isFinite(codePoint) || codePoint < 0 || codePoint > 0x10FFFF || floor(codePoint) != codePoint) {
throw RangeError('Invalid code point: ' + codePoint);
}
if (codePoint <= 0xFFFF) {
codeUnits.push(codePoint);
} else {
codePoint -= 0x10000;
highSurrogate = (codePoint >> 10) + 0xD800;
lowSurrogate = (codePoint % 0x400) + 0xDC00;
codeUnits.push(highSurrogate, lowSurrogate);
}
}
return String.fromCharCode.apply(null, codeUnits);
}
function stringPrototypeIterator() {
var o = $traceurRuntime.checkObjectCoercible(this);
var s = String(o);
return createStringIterator(s);
}
function polyfillString(global) {
var String = global.String;
maybeAddFunctions(String.prototype, ['codePointAt', codePointAt, 'contains', contains, 'endsWith', endsWith, 'startsWith', startsWith, 'repeat', repeat]);
maybeAddFunctions(String, ['fromCodePoint', fromCodePoint, 'raw', raw]);
maybeAddIterator(String.prototype, stringPrototypeIterator, Symbol);
}
registerPolyfill(polyfillString);
return {
get startsWith() {
return startsWith;
},
get endsWith() {
return endsWith;
},
get contains() {
return contains;
},
get repeat() {
return repeat;
},
get codePointAt() {
return codePointAt;
},
get raw() {
return raw;
},
get fromCodePoint() {
return fromCodePoint;
},
get stringPrototypeIterator() {
return stringPrototypeIterator;
},
get polyfillString() {
return polyfillString;
}
};
});
System.get("[email protected]/src/runtime/polyfills/String" + '');
System.register("[email protected]/src/runtime/polyfills/ArrayIterator", [], function() {
"use strict";
var $__36;
var __moduleName = "[email protected]/src/runtime/polyfills/ArrayIterator";
var $__34 = System.get("[email protected]/src/runtime/polyfills/utils"),
toObject = $__34.toObject,
toUint32 = $__34.toUint32,
createIteratorResultObject = $__34.createIteratorResultObject;
var ARRAY_ITERATOR_KIND_KEYS = 1;
var ARRAY_ITERATOR_KIND_VALUES = 2;
var ARRAY_ITERATOR_KIND_ENTRIES = 3;
var ArrayIterator = function ArrayIterator() {};
($traceurRuntime.createClass)(ArrayIterator, ($__36 = {}, Object.defineProperty($__36, "next", {
value: function() {
var iterator = toObject(this);
var array = iterator.iteratorObject_;
if (!array) {
throw new TypeError('Object is not an ArrayIterator');
}
var index = iterator.arrayIteratorNextIndex_;
var itemKind = iterator.arrayIterationKind_;
var length = toUint32(array.length);
if (index >= length) {
iterator.arrayIteratorNextIndex_ = Infinity;
return createIteratorResultObject(undefined, true);
}
iterator.arrayIteratorNextIndex_ = index + 1;
if (itemKind == ARRAY_ITERATOR_KIND_VALUES)
return createIteratorResultObject(array[index], false);
if (itemKind == ARRAY_ITERATOR_KIND_ENTRIES)
return createIteratorResultObject([index, array[index]], false);
return createIteratorResultObject(index, false);
},
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__36, Symbol.iterator, {
value: function() {
return this;
},
configurable: true,
enumerable: true,
writable: true
}), $__36), {});
function createArrayIterator(array, kind) {
var object = toObject(array);
var iterator = new ArrayIterator;
iterator.iteratorObject_ = object;
iterator.arrayIteratorNextIndex_ = 0;
iterator.arrayIterationKind_ = kind;
return iterator;
}
function entries() {
return createArrayIterator(this, ARRAY_ITERATOR_KIND_ENTRIES);
}
function keys() {
return createArrayIterator(this, ARRAY_ITERATOR_KIND_KEYS);
}
function values() {
return createArrayIterator(this, ARRAY_ITERATOR_KIND_VALUES);
}
return {
get entries() {
return entries;
},
get keys() {
return keys;
},
get values() {
return values;
}
};
});
System.register("[email protected]/src/runtime/polyfills/Array", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/Array";
var $__37 = System.get("[email protected]/src/runtime/polyfills/ArrayIterator"),
entries = $__37.entries,
keys = $__37.keys,
values = $__37.values;
var $__38 = System.get("[email protected]/src/runtime/polyfills/utils"),
checkIterable = $__38.checkIterable,
isCallable = $__38.isCallable,
isConstructor = $__38.isConstructor,
maybeAddFunctions = $__38.maybeAddFunctions,
maybeAddIterator = $__38.maybeAddIterator,
registerPolyfill = $__38.registerPolyfill,
toInteger = $__38.toInteger,
toLength = $__38.toLength,
toObject = $__38.toObject;
function from(arrLike) {
var mapFn = arguments[1];
var thisArg = arguments[2];
var C = this;
var items = toObject(arrLike);
var mapping = mapFn !== undefined;
var k = 0;
var arr,
len;
if (mapping && !isCallable(mapFn)) {
throw TypeError();
}
if (checkIterable(items)) {
arr = isConstructor(C) ? new C() : [];
for (var $__39 = items[Symbol.iterator](),
$__40; !($__40 = $__39.next()).done; ) {
var item = $__40.value;
{
if (mapping) {
arr[k] = mapFn.call(thisArg, item, k);
} else {
arr[k] = item;
}
k++;
}
}
arr.length = k;
return arr;
}
len = toLength(items.length);
arr = isConstructor(C) ? new C(len) : new Array(len);
for (; k < len; k++) {
if (mapping) {
arr[k] = typeof thisArg === 'undefined' ? mapFn(items[k], k) : mapFn.call(thisArg, items[k], k);
} else {
arr[k] = items[k];
}
}
arr.length = len;
return arr;
}
function of() {
for (var items = [],
$__41 = 0; $__41 < arguments.length; $__41++)
items[$__41] = arguments[$__41];
var C = this;
var len = items.length;
var arr = isConstructor(C) ? new C(len) : new Array(len);
for (var k = 0; k < len; k++) {
arr[k] = items[k];
}
arr.length = len;
return arr;
}
function fill(value) {
var start = arguments[1] !== (void 0) ? arguments[1] : 0;
var end = arguments[2];
var object = toObject(this);
var len = toLength(object.length);
var fillStart = toInteger(start);
var fillEnd = end !== undefined ? toInteger(end) : len;
fillStart = fillStart < 0 ? Math.max(len + fillStart, 0) : Math.min(fillStart, len);
fillEnd = fillEnd < 0 ? Math.max(len + fillEnd, 0) : Math.min(fillEnd, len);
while (fillStart < fillEnd) {
object[fillStart] = value;
fillStart++;
}
return object;
}
function find(predicate) {
var thisArg = arguments[1];
return findHelper(this, predicate, thisArg);
}
function findIndex(predicate) {
var thisArg = arguments[1];
return findHelper(this, predicate, thisArg, true);
}
function findHelper(self, predicate) {
var thisArg = arguments[2];
var returnIndex = arguments[3] !== (void 0) ? arguments[3] : false;
var object = toObject(self);
var len = toLength(object.length);
if (!isCallable(predicate)) {
throw TypeError();
}
for (var i = 0; i < len; i++) {
if (i in object) {
var value = object[i];
if (predicate.call(thisArg, value, i, object)) {
return returnIndex ? i : value;
}
}
}
return returnIndex ? -1 : undefined;
}
function polyfillArray(global) {
var $__42 = global,
Array = $__42.Array,
Object = $__42.Object,
Symbol = $__42.Symbol;
maybeAddFunctions(Array.prototype, ['entries', entries, 'keys', keys, 'values', values, 'fill', fill, 'find', find, 'findIndex', findIndex]);
maybeAddFunctions(Array, ['from', from, 'of', of]);
maybeAddIterator(Array.prototype, values, Symbol);
maybeAddIterator(Object.getPrototypeOf([].values()), function() {
return this;
}, Symbol);
}
registerPolyfill(polyfillArray);
return {
get from() {
return from;
},
get of() {
return of;
},
get fill() {
return fill;
},
get find() {
return find;
},
get findIndex() {
return findIndex;
},
get polyfillArray() {
return polyfillArray;
}
};
});
System.get("[email protected]/src/runtime/polyfills/Array" + '');
System.register("[email protected]/src/runtime/polyfills/Object", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/Object";
var $__43 = System.get("[email protected]/src/runtime/polyfills/utils"),
maybeAddFunctions = $__43.maybeAddFunctions,
registerPolyfill = $__43.registerPolyfill;
var $__44 = $traceurRuntime,
defineProperty = $__44.defineProperty,
getOwnPropertyDescriptor = $__44.getOwnPropertyDescriptor,
getOwnPropertyNames = $__44.getOwnPropertyNames,
keys = $__44.keys,
privateNames = $__44.privateNames;
function is(left, right) {
if (left === right)
return left !== 0 || 1 / left === 1 / right;
return left !== left && right !== right;
}
function assign(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
var props = keys(source);
var p,
length = props.length;
for (p = 0; p < length; p++) {
var name = props[p];
if (privateNames[name])
continue;
target[name] = source[name];
}
}
return target;
}
function mixin(target, source) {
var props = getOwnPropertyNames(source);
var p,
descriptor,
length = props.length;
for (p = 0; p < length; p++) {
var name = props[p];
if (privateNames[name])
continue;
descriptor = getOwnPropertyDescriptor(source, props[p]);
defineProperty(target, props[p], descriptor);
}
return target;
}
function polyfillObject(global) {
var Object = global.Object;
maybeAddFunctions(Object, ['assign', assign, 'is', is, 'mixin', mixin]);
}
registerPolyfill(polyfillObject);
return {
get is() {
return is;
},
get assign() {
return assign;
},
get mixin() {
return mixin;
},
get polyfillObject() {
return polyfillObject;
}
};
});
System.get("[email protected]/src/runtime/polyfills/Object" + '');
System.register("[email protected]/src/runtime/polyfills/Number", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/Number";
var $__46 = System.get("[email protected]/src/runtime/polyfills/utils"),
isNumber = $__46.isNumber,
maybeAddConsts = $__46.maybeAddConsts,
maybeAddFunctions = $__46.maybeAddFunctions,
registerPolyfill = $__46.registerPolyfill,
toInteger = $__46.toInteger;
var $abs = Math.abs;
var $isFinite = isFinite;
var $isNaN = isNaN;
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
var MIN_SAFE_INTEGER = -Math.pow(2, 53) + 1;
var EPSILON = Math.pow(2, -52);
function NumberIsFinite(number) {
return isNumber(number) && $isFinite(number);
}
;
function isInteger(number) {
return NumberIsFinite(number) && toInteger(number) === number;
}
function NumberIsNaN(number) {
return isNumber(number) && $isNaN(number);
}
;
function isSafeInteger(number) {
if (NumberIsFinite(number)) {
var integral = toInteger(number);
if (integral === number)
return $abs(integral) <= MAX_SAFE_INTEGER;
}
return false;
}
function polyfillNumber(global) {
var Number = global.Number;
maybeAddConsts(Number, ['MAX_SAFE_INTEGER', MAX_SAFE_INTEGER, 'MIN_SAFE_INTEGER', MIN_SAFE_INTEGER, 'EPSILON', EPSILON]);
maybeAddFunctions(Number, ['isFinite', NumberIsFinite, 'isInteger', isInteger, 'isNaN', NumberIsNaN, 'isSafeInteger', isSafeInteger]);
}
registerPolyfill(polyfillNumber);
return {
get MAX_SAFE_INTEGER() {
return MAX_SAFE_INTEGER;
},
get MIN_SAFE_INTEGER() {
return MIN_SAFE_INTEGER;
},
get EPSILON() {
return EPSILON;
},
get isFinite() {
return NumberIsFinite;
},
get isInteger() {
return isInteger;
},
get isNaN() {
return NumberIsNaN;
},
get isSafeInteger() {
return isSafeInteger;
},
get polyfillNumber() {
return polyfillNumber;
}
};
});
System.get("[email protected]/src/runtime/polyfills/Number" + '');
System.register("[email protected]/src/runtime/polyfills/polyfills", [], function() {
"use strict";
var __moduleName = "[email protected]/src/runtime/polyfills/polyfills";
var polyfillAll = System.get("[email protected]/src/runtime/polyfills/utils").polyfillAll;
polyfillAll(this);
var setupGlobals = $traceurRuntime.setupGlobals;
$traceurRuntime.setupGlobals = function(global) {
setupGlobals(global);
polyfillAll(global);
};
return {};
});
System.get("[email protected]/src/runtime/polyfills/polyfills" + '');
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":2}],4:[function(require,module,exports){
/*global define:false */
/**
* Copyright 2013 Craig Campbell
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Mousetrap is a simple keyboard shortcut library for Javascript with
* no external dependencies
*
* @version 1.4.6
* @url craig.is/killing/mice
*/
(function(window, document, undefined) {
/**
* mapping of special keycodes to their corresponding keys
*
* everything in this dictionary cannot use keypress events
* so it has to be here to map to the correct keycodes for
* keyup/keydown events
*
* @type {Object}
*/
var _MAP = {
8: 'backspace',
9: 'tab',
13: 'enter',
16: 'shift',
17: 'ctrl',
18: 'alt',
20: 'capslock',
27: 'esc',
32: 'space',
33: 'pageup',
34: 'pagedown',
35: 'end',
36: 'home',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
45: 'ins',
46: 'del',
91: 'meta',
93: 'meta',
224: 'meta'
},
/**
* mapping for special characters so they can support
*
* this dictionary is only used incase you want to bind a
* keyup or keydown event to one of these keys
*
* @type {Object}
*/
_KEYCODE_MAP = {
106: '*',
107: '+',
109: '-',
110: '.',
111 : '/',
186: ';',
187: '=',
188: ',',
189: '-',
190: '.',
191: '/',
192: '`',
219: '[',
220: '\\',
221: ']',
222: '\''
},
/**
* this is a mapping of keys that require shift on a US keypad
* back to the non shift equivelents
*
* this is so you can use keyup events with these keys
*
* note that this will only work reliably on US keyboards
*
* @type {Object}
*/
_SHIFT_MAP = {
'~': '`',
'!': '1',
'@': '2',
'#': '3',
'$': '4',
'%': '5',
'^': '6',
'&': '7',
'*': '8',
'(': '9',
')': '0',
'_': '-',
'+': '=',
':': ';',
'\"': '\'',
'<': ',',
'>': '.',
'?': '/',
'|': '\\'
},
/**
* this is a list of special strings you can use to map
* to modifier keys when you specify your keyboard shortcuts
*
* @type {Object}
*/
_SPECIAL_ALIASES = {
'option': 'alt',
'command': 'meta',
'return': 'enter',
'escape': 'esc',
'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
},
/**
* variable to store the flipped version of _MAP from above
* needed to check if we should use keypress or not when no action
* is specified
*
* @type {Object|undefined}
*/
_REVERSE_MAP,
/**
* a list of all the callbacks setup via Mousetrap.bind()
*
* @type {Object}
*/
_callbacks = {},
/**
* direct map of string combinations to callbacks used for trigger()
*
* @type {Object}
*/
_directMap = {},
/**
* keeps track of what level each sequence is at since multiple
* sequences can start out with the same sequence
*
* @type {Object}
*/
_sequenceLevels = {},
/**
* variable to store the setTimeout call
*
* @type {null|number}
*/
_resetTimer,
/**
* temporary state where we will ignore the next keyup
*
* @type {boolean|string}
*/
_ignoreNextKeyup = false,
/**
* temporary state where we will ignore the next keypress
*
* @type {boolean}
*/
_ignoreNextKeypress = false,
/**
* are we currently inside of a sequence?
* type of action ("keyup" or "keydown" or "keypress") or false
*
* @type {boolean|string}
*/
_nextExpectedAction = false;
/**
* loop through the f keys, f1 to f19 and add them to the map
* programatically
*/
for (var i = 1; i < 20; ++i) {
_MAP[111 + i] = 'f' + i;
}
/**
* loop through to map numbers on the numeric keypad
*/
for (i = 0; i <= 9; ++i) {
_MAP[i + 96] = i;
}
/**
* cross browser add event method
*
* @param {Element|HTMLDocument} object
* @param {string} type
* @param {Function} callback
* @returns void
*/
function _addEvent(object, type, callback) {
if (object.addEventListener) {
object.addEventListener(type, callback, false);
return;
}
object.attachEvent('on' + type, callback);
}
/**
* takes the event and returns the key character
*
* @param {Event} e
* @return {string}
*/
function _characterFromEvent(e) {
// for keypress events we should return the character as is
if (e.type == 'keypress') {
var character = String.fromCharCode(e.which);
// if the shift key is not pressed then it is safe to assume
// that we want the character to be lowercase. this means if
// you accidentally have caps lock on then your key bindings
// will continue to work
//
// the only side effect that might not be desired is if you
// bind something like 'A' cause you want to trigger an
// event when capital A is pressed caps lock will no longer
// trigger the event. shift+a will though.
if (!e.shiftKey) {
character = character.toLowerCase();
}
return character;
}
// for non keypress events the special maps are needed
if (_MAP[e.which]) {
return _MAP[e.which];
}
if (_KEYCODE_MAP[e.which]) {
return _KEYCODE_MAP[e.which];
}
// if it is not in the special map
// with keydown and keyup events the character seems to always
// come in as an uppercase character whether you are pressing shift
// or not. we should make sure it is always lowercase for comparisons
return String.fromCharCode(e.which).toLowerCase();
}
/**
* checks if two arrays are equal
*
* @param {Array} modifiers1
* @param {Array} modifiers2
* @returns {boolean}
*/
function _modifiersMatch(modifiers1, modifiers2) {
return modifiers1.sort().join(',') === modifiers2.sort().join(',');
}
/**
* resets all sequence counters except for the ones passed in
*
* @param {Object} doNotReset
* @returns void
*/
function _resetSequences(doNotReset) {
doNotReset = doNotReset || {};
var activeSequences = false,
key;
for (key in _sequenceLevels) {
if (doNotReset[key]) {
activeSequences = true;
continue;
}
_sequenceLevels[key] = 0;
}
if (!activeSequences) {
_nextExpectedAction = false;
}
}
/**
* finds all callbacks that match based on the keycode, modifiers,
* and action
*
* @param {string} character
* @param {Array} modifiers
* @param {Event|Object} e
* @param {string=} sequenceName - name of the sequence we are looking for
* @param {string=} combination
* @param {number=} level
* @returns {Array}
*/
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
var i,
callback,
matches = [],
action = e.type;
// if there are no events related to this keycode
if (!_callbacks[character]) {
return [];
}
// if a modifier key is coming up on its own we should allow it
if (action == 'keyup' && _isModifier(character)) {
modifiers = [character];
}
// loop through all callbacks for the key that was pressed
// and see if any of them match
for (i = 0; i < _callbacks[character].length; ++i) {
callback = _callbacks[character][i];
// if a sequence name is not specified, but this is a sequence at
// the wrong level then move onto the next match
if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
continue;
}
// if the action we are looking for doesn't match the action we got
// then we should keep going
if (action != callback.action) {
continue;
}
// if this is a keypress event and the meta key and control key
// are not pressed that means that we need to only look at the
// character, otherwise check the modifiers as well
//
// chrome will not fire a keypress if meta or control is down
// safari will fire a keypress if meta or meta+shift is down
// firefox will fire a keypress if meta or control is down
if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
// when you bind a combination or sequence a second time it
// should overwrite the first one. if a sequenceName or
// combination is specified in this call it does just that
//
// @todo make deleting its own method?
var deleteCombo = !sequenceName && callback.combo == combination;
var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
if (deleteCombo || deleteSequence) {
_callbacks[character].splice(i, 1);
}
matches.push(callback);
}
}
return matches;
}
/**
* takes a key event and figures out what the modifiers are
*
* @param {Event} e
* @returns {Array}
*/
function _eventModifiers(e) {
var modifiers = [];
if (e.shiftKey) {
modifiers.push('shift');
}
if (e.altKey) {
modifiers.push('alt');
}
if (e.ctrlKey) {
modifiers.push('ctrl');
}
if (e.metaKey) {
modifiers.push('meta');
}
return modifiers;
}
/**
* prevents default for this event
*
* @param {Event} e
* @returns void
*/
function _preventDefault(e) {
if (e.preventDefault) {
e.preventDefault();
return;
}
e.returnValue = false;
}
/**
* stops propogation for this event
*
* @param {Event} e
* @returns void
*/
function _stopPropagation(e) {
if (e.stopPropagation) {
e.stopPropagation();
return;
}
e.cancelBubble = true;
}
/**
* actually calls the callback function
*
* if your callback function returns false this will use the jquery
* convention - prevent default and stop propogation on the event
*
* @param {Function} callback
* @param {Event} e
* @returns void
*/
function _fireCallback(callback, e, combo, sequence) {
// if this event should not happen stop here
if (Mousetrap.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
return;
}
if (callback(e, combo) === false) {
_preventDefault(e);
_stopPropagation(e);
}
}
/**
* handles a character key event
*
* @param {string} character
* @param {Array} modifiers
* @param {Event} e
* @returns void
*/
function _handleKey(character, modifiers, e) {
var callbacks = _getMatches(character, modifiers, e),
i,
doNotReset = {},
maxLevel = 0,
processedSequenceCallback = false;
// Calculate the maxLevel for sequences so we can only execute the longest callback sequence
for (i = 0; i < callbacks.length; ++i) {
if (callbacks[i].seq) {
maxLevel = Math.max(maxLevel, callbacks[i].level);
}
}
// loop through matching callbacks for this key event
for (i = 0; i < callbacks.length; ++i) {
// fire for all sequence callbacks
// this is because if for example you have multiple sequences
// bound such as "g i" and "g t" they both need to fire the
// callback for matching g cause otherwise you can only ever
// match the first one
if (callbacks[i].seq) {
// only fire callbacks for the maxLevel to prevent
// subsequences from also firing
//
// for example 'a option b' should not cause 'option b' to fire
// even though 'option b' is part of the other sequence
//
// any sequences that do not match here will be discarded
// below by the _resetSequences call
if (callbacks[i].level != maxLevel) {
continue;
}
processedSequenceCallback = true;
// keep a list of which sequences were matches for later
doNotReset[callbacks[i].seq] = 1;
_fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
continue;
}
// if there were no sequence matches but we are still here
// that means this is a regular match so we should fire that
if (!processedSequenceCallback) {
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
}
}
// if the key you pressed matches the type of sequence without
// being a modifier (ie "keyup" or "keypress") then we should
// reset all sequences that were not matched by this event
//
// this is so, for example, if you have the sequence "h a t" and you
// type "h e a r t" it does not match. in this case the "e" will
// cause the sequence to reset
//
// modifier keys are ignored because you can have a sequence
// that contains modifiers such as "enter ctrl+space" and in most
// cases the modifier key will be pressed before the next key
//
// also if you have a sequence such as "ctrl+b a" then pressing the
// "b" key will trigger a "keypress" and a "keydown"
//
// the "keydown" is expected when there is a modifier, but the
// "keypress" ends up matching the _nextExpectedAction since it occurs
// after and that causes the sequence to reset
//
// we ignore keypresses in a sequence that directly follow a keydown
// for the same character
var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
_resetSequences(doNotReset);
}
_ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
}
/**
* handles a keydown event
*
* @param {Event} e
* @returns void
*/
function _handleKeyEvent(e) {
// normalize e.which for key events
// @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
if (typeof e.which !== 'number') {
e.which = e.keyCode;
}
var character = _characterFromEvent(e);
// no character found then stop
if (!character) {
return;
}
// need to use === for the character check because the character can be 0
if (e.type == 'keyup' && _ignoreNextKeyup === character) {
_ignoreNextKeyup = false;
return;
}
Mousetrap.handleKey(character, _eventModifiers(e), e);
}
/**
* determines if the keycode specified is a modifier key or not
*
* @param {string} key
* @returns {boolean}
*/
function _isModifier(key) {
return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
}
/**
* called to set a 1 second timeout on the specified sequence
*
* this is so after each key press in the sequence you have 1 second
* to press the next key before you have to start over
*
* @returns void
*/
function _resetSequenceTimer() {
clearTimeout(_resetTimer);
_resetTimer = setTimeout(_resetSequences, 1000);
}
/**
* reverses the map lookup so that we can look for specific keys
* to see what can and can't use keypress
*
* @return {Object}
*/
function _getReverseMap() {
if (!_REVERSE_MAP) {
_REVERSE_MAP = {};
for (var key in _MAP) {
// pull out the numeric keypad from here cause keypress should
// be able to detect the keys from the character
if (key > 95 && key < 112) {
continue;
}
if (_MAP.hasOwnProperty(key)) {
_REVERSE_MAP[_MAP[key]] = key;
}
}
}
return _REVERSE_MAP;
}
/**
* picks the best action based on the key combination
*
* @param {string} key - character for key
* @param {Array} modifiers
* @param {string=} action passed in
*/
function _pickBestAction(key, modifiers, action) {
// if no action was picked in we should try to pick the one
// that we think would work best for this key
if (!action) {
action = _getReverseMap()[key] ? 'keydown' : 'keypress';
}
// modifier keys don't work as expected with keypress,
// switch to keydown
if (action == 'keypress' && modifiers.length) {
action = 'keydown';
}
return action;
}
/**
* binds a key sequence to an event
*
* @param {string} combo - combo specified in bind call
* @param {Array} keys
* @param {Function} callback
* @param {string=} action
* @returns void
*/
function _bindSequence(combo, keys, callback, action) {
// start off by adding a sequence level record for this combination
// and setting the level to 0
_sequenceLevels[combo] = 0;
/**
* callback to increase the sequence level for this sequence and reset
* all other sequences that were active
*
* @param {string} nextAction
* @returns {Function}
*/
function _increaseSequence(nextAction) {
return function() {
_nextExpectedAction = nextAction;
++_sequenceLevels[combo];
_resetSequenceTimer();
};
}
/**
* wraps the specified callback inside of another function in order
* to reset all sequence counters as soon as this sequence is done
*
* @param {Event} e
* @returns void
*/
function _callbackAndReset(e) {
_fireCallback(callback, e, combo);
// we should ignore the next key up if the action is key down
// or keypress. this is so if you finish a sequence and
// release the key the final key will not trigger a keyup
if (action !== 'keyup') {
_ignoreNextKeyup = _characterFromEvent(e);
}
// weird race condition if a sequence ends with the key
// another sequence begins with
setTimeout(_resetSequences, 10);
}
// loop through keys one at a time and bind the appropriate callback
// function. for any key leading up to the final one it should
// increase the sequence. after the final, it should reset all sequences
//
// if an action is specified in the original bind call then that will
// be used throughout. otherwise we will pass the action that the
// next key in the sequence should match. this allows a sequence
// to mix and match keypress and keydown events depending on which
// ones are better suited to the key provided
for (var i = 0; i < keys.length; ++i) {
var isFinal = i + 1 === keys.length;
var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
_bindSingle(keys[i], wrappedCallback, action, combo, i);
}
}
/**
* Converts from a string key combination to an array
*
* @param {string} combination like "command+shift+l"
* @return {Array}
*/
function _keysFromString(combination) {
if (combination === '+') {
return ['+'];
}
return combination.split('+');
}
/**
* Gets info for a specific key combination
*
* @param {string} combination key combination ("command+s" or "a" or "*")
* @param {string=} action
* @returns {Object}
*/
function _getKeyInfo(combination, action) {
var keys,
key,
i,
modifiers = [];
// take the keys from this pattern and figure out what the actual
// pattern is all about
keys = _keysFromString(combination);
for (i = 0; i < keys.length; ++i) {
key = keys[i];
// normalize key names
if (_SPECIAL_ALIASES[key]) {
key = _SPECIAL_ALIASES[key];
}
// if this is not a keypress event then we should
// be smart about using shift keys
// this will only work for US keyboards however
if (action && action != 'keypress' && _SHIFT_MAP[key]) {
key = _SHIFT_MAP[key];
modifiers.push('shift');
}
// if this key is a modifier then add it to the list of modifiers
if (_isModifier(key)) {
modifiers.push(key);
}
}
// depending on what the key combination is
// we will try to pick the best event for it
action = _pickBestAction(key, modifiers, action);
return {
key: key,
modifiers: modifiers,
action: action
};
}
/**
* binds a single keyboard combination
*
* @param {string} combination
* @param {Function} callback
* @param {string=} action
* @param {string=} sequenceName - name of sequence if part of sequence
* @param {number=} level - what part of the sequence the command is
* @returns void
*/
function _bindSingle(combination, callback, action, sequenceName, level) {
// store a direct mapped reference for use with Mousetrap.trigger
_directMap[combination + ':' + action] = callback;
// make sure multiple spaces in a row become a single space
combination = combination.replace(/\s+/g, ' ');
var sequence = combination.split(' '),
info;
// if this pattern is a sequence of keys then run through this method
// to reprocess each pattern one key at a time
if (sequence.length > 1) {
_bindSequence(combination, sequence, callback, action);
return;
}
info = _getKeyInfo(combination, action);
// make sure to initialize array if this is the first time
// a callback is added for this key
_callbacks[info.key] = _callbacks[info.key] || [];
// remove an existing match if there is one
_getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
// add this call back to the array
// if it is a sequence put it at the beginning
// if not put it at the end
//
// this is important because the way these are processed expects
// the sequence ones to come first
_callbacks[info.key][sequenceName ? 'unshift' : 'push']({
callback: callback,
modifiers: info.modifiers,
action: info.action,
seq: sequenceName,
level: level,
combo: combination
});
}
/**
* binds multiple combinations to the same callback
*
* @param {Array} combinations
* @param {Function} callback
* @param {string|undefined} action
* @returns void
*/
function _bindMultiple(combinations, callback, action) {
for (var i = 0; i < combinations.length; ++i) {
_bindSingle(combinations[i], callback, action);
}
}
// start!
_addEvent(document, 'keypress', _handleKeyEvent);
_addEvent(document, 'keydown', _handleKeyEvent);
_addEvent(document, 'keyup', _handleKeyEvent);
var Mousetrap = {
/**
* binds an event to mousetrap
*
* can be a single key, a combination of keys separated with +,
* an array of keys, or a sequence of keys separated by spaces
*
* be sure to list the modifier keys first to make sure that the
* correct key ends up getting bound (the last key in the pattern)
*
* @param {string|Array} keys
* @param {Function} callback
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
* @returns void
*/
bind: function(keys, callback, action) {
keys = keys instanceof Array ? keys : [keys];
_bindMultiple(keys, callback, action);
return this;
},
/**
* unbinds an event to mousetrap
*
* the unbinding sets the callback function of the specified key combo
* to an empty function and deletes the corresponding key in the
* _directMap dict.
*
* TODO: actually remove this from the _callbacks dictionary instead
* of binding an empty function
*
* the keycombo+action has to be exactly the same as
* it was defined in the bind method
*
* @param {string|Array} keys
* @param {string} action
* @returns void
*/
unbind: function(keys, action) {
return Mousetrap.bind(keys, function() {}, action);
},
/**
* triggers an event that has already been bound
*
* @param {string} keys
* @param {string=} action
* @returns void
*/
trigger: function(keys, action) {
if (_directMap[keys + ':' + action]) {
_directMap[keys + ':' + action]({}, keys);
}
return this;
},
/**
* resets the library back to its initial state. this is useful
* if you want to clear out the current keyboard shortcuts and bind
* new ones - for example if you switch to another page
*
* @returns void
*/
reset: function() {
_callbacks = {};
_directMap = {};
return this;
},
/**
* should we stop this event before firing off callbacks
*
* @param {Event} e
* @param {Element} element
* @return {boolean}
*/
stopCallback: function(e, element) {
// if the element has the class "mousetrap" then no need to stop
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
return false;
}
// stop for input, select, and textarea
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
},
/**
* exposes _handleKey publicly so it can be overwritten by extensions
*/
handleKey: _handleKey
};
// expose mousetrap to the global object
window.Mousetrap = Mousetrap;
// expose mousetrap as an AMD module
if (typeof define === 'function' && define.amd) {
define(Mousetrap);
}
}) (window, document);
},{}],5:[function(require,module,exports){
(function( factory ) {
if (typeof define !== 'undefined' && define.amd) {
define([], factory);
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = factory();
} else {
window.scrollMonitor = factory();
}
})(function() {
var scrollTop = function() {
return window.pageYOffset ||
(document.documentElement && document.documentElement.scrollTop) ||
document.body.scrollTop;
};
var exports = {};
var watchers = [];
var VISIBILITYCHANGE = 'visibilityChange';
var ENTERVIEWPORT = 'enterViewport';
var FULLYENTERVIEWPORT = 'fullyEnterViewport';
var EXITVIEWPORT = 'exitViewport';
var PARTIALLYEXITVIEWPORT = 'partiallyExitViewport';
var LOCATIONCHANGE = 'locationChange';
var STATECHANGE = 'stateChange';
var eventTypes = [
VISIBILITYCHANGE,
ENTERVIEWPORT,
FULLYENTERVIEWPORT,
EXITVIEWPORT,
PARTIALLYEXITVIEWPORT,
LOCATIONCHANGE,
STATECHANGE
];
var defaultOffsets = {top: 0, bottom: 0};
var getViewportHeight = function() {
return window.innerHeight || document.documentElement.clientHeight;
};
var getDocumentHeight = function() {
// jQuery approach
// whichever is greatest
return Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.documentElement.clientHeight
);
};
exports.viewportTop = null;
exports.viewportBottom = null;
exports.documentHeight = null;
exports.viewportHeight = getViewportHeight();
var previousDocumentHeight;
var latestEvent;
var calculateViewportI;
function calculateViewport() {
exports.viewportTop = scrollTop();
exports.viewportBottom = exports.viewportTop + exports.viewportHeight;
exports.documentHeight = getDocumentHeight();
if (exports.documentHeight !== previousDocumentHeight) {
calculateViewportI = watchers.length;
while( calculateViewportI-- ) {
watchers[calculateViewportI].recalculateLocation();
}
previousDocumentHeight = exports.documentHeight;
}
}
function recalculateWatchLocationsAndTrigger() {
exports.viewportHeight = getViewportHeight();
calculateViewport();
updateAndTriggerWatchers();
}
var recalculateAndTriggerTimer;
function debouncedRecalcuateAndTrigger() {
clearTimeout(recalculateAndTriggerTimer);
recalculateAndTriggerTimer = setTimeout( recalculateWatchLocationsAndTrigger, 100 );
}
var updateAndTriggerWatchersI;
function updateAndTriggerWatchers() {
// update all watchers then trigger the events so one can rely on another being up to date.
updateAndTriggerWatchersI = watchers.length;
while( updateAndTriggerWatchersI-- ) {
watchers[updateAndTriggerWatchersI].update();
}
updateAndTriggerWatchersI = watchers.length;
while( updateAndTriggerWatchersI-- ) {
watchers[updateAndTriggerWatchersI].triggerCallbacks();
}
}
function ElementWatcher( watchItem, offsets ) {
var self = this;
this.watchItem = watchItem;
if (!offsets) {
this.offsets = defaultOffsets;
} else if (offsets === +offsets) {
this.offsets = {top: offsets, bottom: offsets};
} else {
this.offsets = {
top: offsets.top || defaultOffsets.top,
bottom: offsets.bottom || defaultOffsets.bottom
};
}
this.callbacks = {}; // {callback: function, isOne: true }
for (var i = 0, j = eventTypes.length; i < j; i++) {
self.callbacks[eventTypes[i]] = [];
}
this.locked = false;
var wasInViewport;
var wasFullyInViewport;
var wasAboveViewport;
var wasBelowViewport;
var listenerToTriggerListI;
var listener;
function triggerCallbackArray( listeners ) {
if (listeners.length === 0) {
return;
}
listenerToTriggerListI = listeners.length;
while( listenerToTriggerListI-- ) {
listener = listeners[listenerToTriggerListI];
listener.callback.call( self, latestEvent );
if (listener.isOne) {
listeners.splice(listenerToTriggerListI, 1);
}
}
}
this.triggerCallbacks = function triggerCallbacks() {
if (this.isInViewport && !wasInViewport) {
triggerCallbackArray( this.callbacks[ENTERVIEWPORT] );
}
if (this.isFullyInViewport && !wasFullyInViewport) {
triggerCallbackArray( this.callbacks[FULLYENTERVIEWPORT] );
}
if (this.isAboveViewport !== wasAboveViewport &&
this.isBelowViewport !== wasBelowViewport) {
triggerCallbackArray( this.callbacks[VISIBILITYCHANGE] );
// if you skip completely past this element
if (!wasFullyInViewport && !this.isFullyInViewport) {
triggerCallbackArray( this.callbacks[FULLYENTERVIEWPORT] );
triggerCallbackArray( this.callbacks[PARTIALLYEXITVIEWPORT] );
}
if (!wasInViewport && !this.isInViewport) {
triggerCallbackArray( this.callbacks[ENTERVIEWPORT] );
triggerCallbackArray( this.callbacks[EXITVIEWPORT] );
}
}
if (!this.isFullyInViewport && wasFullyInViewport) {
triggerCallbackArray( this.callbacks[PARTIALLYEXITVIEWPORT] );
}
if (!this.isInViewport && wasInViewport) {
triggerCallbackArray( this.callbacks[EXITVIEWPORT] );
}
if (this.isInViewport !== wasInViewport) {
triggerCallbackArray( this.callbacks[VISIBILITYCHANGE] );
}
switch( true ) {
case wasInViewport !== this.isInViewport:
case wasFullyInViewport !== this.isFullyInViewport:
case wasAboveViewport !== this.isAboveViewport:
case wasBelowViewport !== this.isBelowViewport:
triggerCallbackArray( this.callbacks[STATECHANGE] );
}
wasInViewport = this.isInViewport;
wasFullyInViewport = this.isFullyInViewport;
wasAboveViewport = this.isAboveViewport;
wasBelowViewport = this.isBelowViewport;
};
this.recalculateLocation = function() {
if (this.locked) {
return;
}
var previousTop = this.top;
var previousBottom = this.bottom;
if (this.watchItem.nodeName) { // a dom element
var cachedDisplay = this.watchItem.style.display;
if (cachedDisplay === 'none') {
this.watchItem.style.display = '';
}
var boundingRect = this.watchItem.getBoundingClientRect();
this.top = boundingRect.top + exports.viewportTop;
this.bottom = boundingRect.bottom + exports.viewportTop;
if (cachedDisplay === 'none') {
this.watchItem.style.display = cachedDisplay;
}
} else if (this.watchItem === +this.watchItem) { // number
if (this.watchItem > 0) {
this.top = this.bottom = this.watchItem;
} else {
this.top = this.bottom = exports.documentHeight - this.watchItem;
}
} else { // an object with a top and bottom property
this.top = this.watchItem.top;
this.bottom = this.watchItem.bottom;
}
this.top -= this.offsets.top;
this.bottom += this.offsets.bottom;
this.height = this.bottom - this.top;
if ( (previousTop !== undefined || previousBottom !== undefined) && (this.top !== previousTop || this.bottom !== previousBottom) ) {
triggerCallbackArray( this.callbacks[LOCATIONCHANGE] );
}
};
this.recalculateLocation();
this.update();
wasInViewport = this.isInViewport;
wasFullyInViewport = this.isFullyInViewport;
wasAboveViewport = this.isAboveViewport;
wasBelowViewport = this.isBelowViewport;
}
ElementWatcher.prototype = {
on: function( event, callback, isOne ) {
// trigger the event if it applies to the element right now.
switch( true ) {
case event === VISIBILITYCHANGE && !this.isInViewport && this.isAboveViewport:
case event === ENTERVIEWPORT && this.isInViewport:
case event === FULLYENTERVIEWPORT && this.isFullyInViewport:
case event === EXITVIEWPORT && this.isAboveViewport && !this.isInViewport:
case event === PARTIALLYEXITVIEWPORT && this.isAboveViewport:
callback.call( this, latestEvent );
if (isOne) {
return;
}
}
if (this.callbacks[event]) {
this.callbacks[event].push({callback: callback, isOne: isOne||false});
} else {
throw new Error('Tried to add a scroll monitor listener of type '+event+'. Your options are: '+eventTypes.join(', '));
}
},
off: function( event, callback ) {
if (this.callbacks[event]) {
for (var i = 0, item; item = this.callbacks[event][i]; i++) {
if (item.callback === callback) {
this.callbacks[event].splice(i, 1);
break;
}
}
} else {
throw new Error('Tried to remove a scroll monitor listener of type '+event+'. Your options are: '+eventTypes.join(', '));
}
},
one: function( event, callback ) {
this.on( event, callback, true);
},
recalculateSize: function() {
this.height = this.watchItem.offsetHeight + this.offsets.top + this.offsets.bottom;
this.bottom = this.top + this.height;
},
update: function() {
this.isAboveViewport = this.top < exports.viewportTop;
this.isBelowViewport = this.bottom > exports.viewportBottom;
this.isInViewport = (this.top <= exports.viewportBottom && this.bottom >= exports.viewportTop);
this.isFullyInViewport = (this.top >= exports.viewportTop && this.bottom <= exports.viewportBottom) ||
(this.isAboveViewport && this.isBelowViewport);
},
destroy: function() {
var index = watchers.indexOf(this),
self = this;
watchers.splice(index, 1);
for (var i = 0, j = eventTypes.length; i < j; i++) {
self.callbacks[eventTypes[i]].length = 0;
}
},
// prevent recalculating the element location
lock: function() {
this.locked = true;
},
unlock: function() {
this.locked = false;
}
};
var eventHandlerFactory = function (type) {
return function( callback, isOne ) {
this.on.call(this, type, callback, isOne);
};
};
for (var i = 0, j = eventTypes.length; i < j; i++) {
var type = eventTypes[i];
ElementWatcher.prototype[type] = eventHandlerFactory(type);
}
try {
calculateViewport();
} catch (e) {
try {
window.$(calculateViewport);
} catch (e) {
throw new Error('If you must put scrollMonitor in the <head>, you must use jQuery.');
}
}
function scrollMonitorListener(event) {
latestEvent = event;
calculateViewport();
updateAndTriggerWatchers();
}
if (window.addEventListener) {
window.addEventListener('scroll', scrollMonitorListener);
window.addEventListener('resize', debouncedRecalcuateAndTrigger);
} else {
// Old IE support
window.attachEvent('onscroll', scrollMonitorListener);
window.attachEvent('onresize', debouncedRecalcuateAndTrigger);
}
exports.beget = exports.create = function( element, offsets ) {
if (typeof element === 'string') {
element = document.querySelector(element);
} else if (element && element.length > 0) {
element = element[0];
}
var watcher = new ElementWatcher( element, offsets );
watchers.push(watcher);
watcher.update();
return watcher;
};
exports.update = function() {
latestEvent = null;
calculateViewport();
updateAndTriggerWatchers();
};
exports.recalculateLocations = function() {
exports.documentHeight = 0;
exports.update();
};
return exports;
});
},{}],6:[function(require,module,exports){
module.exports={
"name": "clappr",
"version": "0.0.86",
"description": "An extensible media player for the web",
"main": "dist/clappr.min.js",
"scripts": {
"test": "./node_modules/.bin/gulp release && ./node_modules/.bin/karma start --single-run --browsers Firefox"
},
"repository": {
"type": "git",
"url": "[email protected]:globocom/clappr.git"
},
"author": "Globo.com",
"license": "BSD",
"bugs": {
"url": "https://github.com/globocom/clappr/issues"
},
"browser": {
"zepto": "clappr-zepto"
},
"homepage": "https://github.com/globocom/clappr",
"devDependencies": {
"browserify": "^8.0.3",
"chai": "1.10.0",
"compass-mixins": "0.12.3",
"dotenv": "^0.4.0",
"es6ify": "~1.4.0",
"exorcist": "^0.1.6",
"express": "^4.6.1",
"express-alias": "0.4.0",
"glob": "^4.0.2",
"gulp": "^3.8.1",
"clappr-zepto": "0.0.3",
"gulp-compressor": "^0.1.0",
"gulp-jshint": "1.9.0",
"gulp-livereload": "^2.1.0",
"gulp-minify-css": "~0.3.5",
"gulp-rename": "^1.2.0",
"gulp-sass": "1.0.0",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^1.0.1",
"gulp-util": "3.0.1",
"karma": "^0.12.17",
"karma-browserify": "^1.0.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.1.4",
"karma-cli": "0.0.4",
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "^0.2.2",
"karma-jquery": "^0.1.0",
"karma-mocha": "^0.1.4",
"karma-safari-launcher": "^0.1.1",
"karma-sinon": "^1.0.3",
"karma-sinon-chai": "^0.2.0",
"mkdirp": "^0.5.0",
"s3": "^4.1.1",
"scp": "0.0.3",
"sinon": "^1.10.2",
"traceur": "0.0.72",
"vinyl-source-stream": "^1.0.0",
"vinyl-transform": "0.0.1",
"watchify": "^2.0.0",
"yargs": "1.3.3"
},
"dependencies": {
"underscore": "1.7.0",
"mousetrap": "^1.4.6",
"scrollmonitor": "^1.0.8"
}
}
},{}],7:[function(require,module,exports){
"use strict";
var _ = require('underscore');
module.exports = {
'media_control': _.template('<div class="media-control-background" data-background></div><div class="media-control-layer" data-controls><% var renderBar=function(name) { %><div class="bar-container" data-<%= name %>><div class="bar-background" data-<%= name %>><div class="bar-fill-1" data-<%= name %>></div><div class="bar-fill-2" data-<%= name %>></div><div class="bar-hover" data-<%= name %>></div></div><div class="bar-scrubber" data-<%= name %>><div class="bar-scrubber-icon" data-<%= name %>></div></div></div><% }; %><% var renderSegmentedBar=function(name, segments) { segments=segments || 10; %><div class="bar-container" data-<%= name %>><% for (var i = 0; i < segments; i++) { %><div class="segmented-bar-element" data-<%= name %>></div><% } %></div><% }; %><% var renderDrawer=function(name, renderContent) { %><div class="drawer-container" data-<%= name %>><div class="drawer-icon-container" data-<%= name %>><div class="drawer-icon media-control-icon" data-<%= name %>></div><span class="drawer-text" data-<%= name %>></span></div><% renderContent(name); %></div><% }; %><% var renderIndicator=function(name) { %><div class="media-control-indicator" data-<%= name %>></div><% }; %><% var renderButton=function(name) { %><button class="media-control-button media-control-icon" data-<%= name %>></button><% }; %><% var templates={ bar: renderBar, segmentedBar: renderSegmentedBar, }; var render=function(settingsList) { _.each(settingsList, function(setting) { if(setting === "seekbar") { renderBar(setting); } else if (setting === "volume") { renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); }); } else if (setting === "duration" || setting=== "position") { renderIndicator(setting); } else { renderButton(setting); } }); }; %><% if (settings.default && settings.default.length) { %><div class="media-control-center-panel" data-media-control><% render(settings.default); %></div><% } %><% if (settings.left && settings.left.length) { %><div class="media-control-left-panel" data-media-control><% render(settings.left); %></div><% } %><% if (settings.right && settings.right.length) { %><div class="media-control-right-panel" data-media-control><% render(settings.right); %></div><% } %></div>'),
'seek_time': _.template('<span data-seek-time></span>'),
'flash': _.template('<param name="movie" value="<%= swfPath %>"><param name="quality" value="autohigh"><param name="swliveconnect" value="true"><param name="allowScriptAccess" value="always"><param name="bgcolor" value="#001122"><param name="allowFullScreen" value="false"><param name="wmode" value="transparent"><param name="tabindex" value="1"><param name=FlashVars value="playbackId=<%= playbackId %>" /><embed type="application/x-shockwave-flash" disabled tabindex="-1" enablecontextmenu="false" allowScriptAccess="always" quality="autohight" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" swliveconnect="true" type="application/x-shockwave-flash" allowfullscreen="false" bgcolor="#000000" FlashVars="playbackId=<%= playbackId %>" src="<%= swfPath %>"></embed>'),
'hls': _.template('<param name="movie" value="<%= swfPath %>?inline=1"><param name="quality" value="autohigh"><param name="swliveconnect" value="true"><param name="allowScriptAccess" value="always"><param name="bgcolor" value="#001122"><param name="allowFullScreen" value="false"><param name="wmode" value="transparent"><param name="tabindex" value="1"><param name=FlashVars value="playbackId=<%= playbackId %>" /><embed type="application/x-shockwave-flash" tabindex="1" enablecontextmenu="false" allowScriptAccess="always" quality="autohigh" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" swliveconnect="true" type="application/x-shockwave-flash" allowfullscreen="false" bgcolor="#000000" FlashVars="playbackId=<%= playbackId %>" src="<%= swfPath %>" width="100%" height="100%"></embed>'),
'html5_video': _.template('<source src="<%=src%>" type="<%=type%>">'),
'no_op': _.template('<p data-no-op-msg>Something went wrong :(</p>'),
'background_button': _.template('<div class="background-button-wrapper" data-background-button><button class="background-button-icon" data-background-button></button></div>'),
'dvr_controls': _.template('<div class="live-info">LIVE</div><button class="live-button">BACK TO LIVE</button>'),
'poster': _.template('<div class="play-wrapper" data-poster><span class="poster-icon play" data-poster/></div>'),
'spinner_three_bounce': _.template('<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div>'),
'watermark': _.template('<div data-watermark data-watermark-<%=position %>><img src="<%= imageUrl %>"></div>'),
CSS: {
'container': '.container[data-container]{position:absolute;background-color:#000;height:100%;width:100%}.container[data-container].pointer-enabled{cursor:pointer}',
'core': '[data-player]{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);position:relative;margin:0;padding:0;border:0;font-style:normal;font-weight:400;text-align:center;overflow:hidden;font-size:100%;font-family:"lucida grande",tahoma,verdana,arial,sans-serif;text-shadow:0 0 0;box-sizing:border-box}[data-player] a,[data-player] abbr,[data-player] acronym,[data-player] address,[data-player] applet,[data-player] article,[data-player] aside,[data-player] audio,[data-player] b,[data-player] big,[data-player] blockquote,[data-player] canvas,[data-player] caption,[data-player] center,[data-player] cite,[data-player] code,[data-player] dd,[data-player] del,[data-player] details,[data-player] dfn,[data-player] div,[data-player] dl,[data-player] dt,[data-player] em,[data-player] embed,[data-player] fieldset,[data-player] figcaption,[data-player] figure,[data-player] footer,[data-player] form,[data-player] h1,[data-player] h2,[data-player] h3,[data-player] h4,[data-player] h5,[data-player] h6,[data-player] header,[data-player] hgroup,[data-player] i,[data-player] iframe,[data-player] img,[data-player] ins,[data-player] kbd,[data-player] label,[data-player] legend,[data-player] li,[data-player] mark,[data-player] menu,[data-player] nav,[data-player] object,[data-player] ol,[data-player] output,[data-player] p,[data-player] pre,[data-player] q,[data-player] ruby,[data-player] s,[data-player] samp,[data-player] section,[data-player] small,[data-player] span,[data-player] strike,[data-player] strong,[data-player] sub,[data-player] summary,[data-player] sup,[data-player] table,[data-player] tbody,[data-player] td,[data-player] tfoot,[data-player] th,[data-player] thead,[data-player] time,[data-player] tr,[data-player] tt,[data-player] u,[data-player] ul,[data-player] var,[data-player] video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}[data-player] table{border-collapse:collapse;border-spacing:0}[data-player] caption,[data-player] td,[data-player] th{text-align:left;font-weight:400;vertical-align:middle}[data-player] blockquote,[data-player] q{quotes:none}[data-player] blockquote:after,[data-player] blockquote:before,[data-player] q:after,[data-player] q:before{content:"";content:none}[data-player] a img{border:none}[data-player] *{max-width:initial;box-sizing:inherit;float:initial}[data-player].fullscreen{width:100%;height:100%}[data-player].nocursor{cursor:none}[data-player] .clappr-style{display:none!important}@media screen{[data-player]{opacity:.99}}',
'media_control': '@font-face{font-family:Player;src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot);src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot?#iefix) format("embedded-opentype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.ttf) format("truetype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.svg#player) format("svg")}.media-control-notransition{-webkit-transition:none!important;-webkit-transition-delay:0s;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.media-control[data-media-control]{position:absolute;width:100%;height:100%;z-index:9999;pointer-events:none}.media-control[data-media-control].dragging{pointer-events:auto;cursor:-webkit-grabbing!important;cursor:grabbing!important}.media-control[data-media-control].dragging *{cursor:-webkit-grabbing!important;cursor:grabbing!important}.media-control[data-media-control] .media-control-background[data-background]{position:absolute;height:40%;width:100%;bottom:0;background-image:-owg(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:-webkit(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:-moz(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:-o(linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9)));background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.9));-webkit-transition:opacity .6s;-webkit-transition-delay:ease-out;-moz-transition:opacity .6s ease-out;-o-transition:opacity .6s ease-out;transition:opacity .6s ease-out}.media-control[data-media-control] .media-control-icon{font-family:Player;font-weight:400;font-style:normal;font-size:26px;line-height:32px;letter-spacing:0;speak:none;color:#fff;opacity:.5;vertical-align:middle;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transition:all .1s;-webkit-transition-delay:ease;-moz-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.media-control[data-media-control] .media-control-icon:hover{color:#fff;opacity:.75;text-shadow:rgba(255,255,255,.8) 0 0 5px}.media-control[data-media-control].media-control-hide .media-control-background[data-background]{opacity:0}.media-control[data-media-control].media-control-hide .media-control-layer[data-controls]{bottom:-50px}.media-control[data-media-control].media-control-hide .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{opacity:0}.media-control[data-media-control] .media-control-layer[data-controls]{position:absolute;bottom:7px;width:100%;height:32px;vertical-align:middle;pointer-events:auto;-webkit-transition:bottom .4s;-webkit-transition-delay:ease-out;-moz-transition:bottom .4s ease-out;-o-transition:bottom .4s ease-out;transition:bottom .4s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-left-panel[data-media-control]{position:absolute;top:0;left:4px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-center-panel[data-media-control]{height:100%;text-align:center;line-height:32px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-right-panel[data-media-control]{position:absolute;top:0;right:4px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button{background-color:transparent;border:0;margin:0 6px;padding:0;cursor:pointer;display:inline-block}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button:focus{outline:0}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play]:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause]:before{content:"\\e002"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop]:before{content:"\\e003"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen]{float:right;background-color:transparent;border:0;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen]:before{content:"\\e006"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen].shrink:before{content:"\\e007"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator]{cursor:default;float:right;background-color:transparent;border:0;height:100%;opacity:0}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator]:before{content:"\\e008"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled:hover{opacity:1;text-shadow:none}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause]:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause].playing:before{content:"\\e002"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause].paused:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop]{float:left;height:100%;font-size:20px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop]:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop].playing:before{content:"\\e003"}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop].stopped:before{content:"\\e001"}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration],.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position]{display:inline-block;font-size:10px;color:#fff;cursor:default;line-height:32px;position:relative}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position]{margin-left:6px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]{color:rgba(255,255,255,.5);margin-right:6px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]:before{content:"|";margin:0 3px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]{position:absolute;top:-20px;left:0;display:inline-block;vertical-align:middle;width:100%;height:25px;cursor:pointer}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar]{width:100%;height:1px;position:relative;top:12px;background-color:#666}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-1[data-seekbar]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#c2c2c2;-webkit-transition:all .1s;-webkit-transition-delay:ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#005aff;-webkit-transition:all .1s;-webkit-transition-delay:ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:0;position:absolute;top:-3px;width:5px;height:7px;background-color:rgba(255,255,255,.5);-webkit-transition:opacity .1s;-webkit-transition-delay:ease;-moz-transition:opacity .1s ease;-o-transition:opacity .1s ease;transition:opacity .1s ease}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]:hover .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled{cursor:default}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled:hover .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:0}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{position:absolute;top:2px;left:0;width:20px;height:20px;opacity:1;-webkit-transition:all .1s;-webkit-transition-delay:ease-out;-moz-transition:all .1s ease-out;-o-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] .bar-scrubber-icon[data-seekbar]{position:absolute;left:6px;top:6px;width:8px;height:8px;border-radius:10px;box-shadow:0 0 0 6px rgba(255,255,255,.2);background-color:#fff}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume]{float:right;display:inline-block;height:32px;cursor:pointer;margin:0 6px;box-sizing:border-box}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume]{float:left;bottom:0}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]{background-color:transparent;border:0;box-sizing:content-box;width:16px;height:32px;margin-right:6px;opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:hover{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:before{content:"\\e004"}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted{opacity:.5}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted:hover{opacity:.7}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted:before{content:"\\e005"}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume]{float:left;position:relative;top:6px;width:42px;height:18px;padding:3px 0;overflow:hidden;-webkit-transition:width .2s;-webkit-transition-delay:ease-out;-moz-transition:width .2s ease-out;-o-transition:width .2s ease-out;transition:width .2s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]{float:left;width:4px;padding-left:2px;height:12px;opacity:.5;-webkit-box-shadow:inset 2px 0 0 #fff;-moz-box-shadow:inset 2px 0 0 #fff;-ms-box-shadow:inset 2px 0 0 #fff;-o-box-shadow:inset 2px 0 0 #fff;box-shadow:inset 2px 0 0 #fff;-webkit-transition:-webkit-transform .2s;-webkit-transition-delay:ease-out;-moz-transition:-moz-transform .2s ease-out;-o-transition:-o-transform .2s ease-out;transition:transform .2s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume].fill{-webkit-box-shadow:inset 2px 0 0 #fff;-moz-box-shadow:inset 2px 0 0 #fff;-ms-box-shadow:inset 2px 0 0 #fff;-o-box-shadow:inset 2px 0 0 #fff;box-shadow:inset 2px 0 0 #fff;opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:nth-of-type(1){padding-left:0}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:hover{-webkit-transform:scaleY(1.5);-moz-transform:scaleY(1.5);-ms-transform:scaleY(1.5);-o-transform:scaleY(1.5);transform:scaleY(1.5)}.media-control[data-media-control].w320 .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume].volume-bar-hide{height:12px;top:9px;padding:0;width:0}',
'seek_time': '.seek-time[data-seek-time]{position:absolute;width:auto;height:20px;line-height:20px;bottom:55px;background-color:rgba(2,2,2,.5);z-index:9999;-webkit-transition:opacity .1s;-webkit-transition-delay:ease;-moz-transition:opacity .1s ease;-o-transition:opacity .1s ease;transition:opacity .1s ease}.seek-time[data-seek-time].hidden[data-seek-time]{opacity:0}.seek-time[data-seek-time] span[data-seek-time]{position:relative;color:#fff;font-size:10px;padding-left:7px;padding-right:7px}',
'flash': '[data-flash]{position:absolute;height:100%;width:100%;background-color:#000;display:block;pointer-events:none}',
'hls': '[data-hls]{position:absolute;height:100%;width:100%;background-color:#000;display:block;pointer-events:none;top:0}',
'html5_video': '[data-html5-video]{position:absolute;height:100%;width:100%;display:block}',
'html_img': '[data-html-img]{max-width:100%;max-height:100%}',
'no_op': '[data-no-op]{z-index:1000;position:absolute;background-color:#222;height:100%;width:100%}[data-no-op] p[data-no-op-msg]{position:relative;font-size:25px;top:50%;color:#fff}',
'background_button': '.background-button[data-background-button]{font-family:Player;position:absolute;height:100%;width:100%;background-color:rgba(0,0,0,.2);pointer-events:none;-webkit-transition:all .4s;-webkit-transition-delay:ease-out;-moz-transition:all .4s ease-out;-o-transition:all .4s ease-out;transition:all .4s ease-out}.background-button[data-background-button].hide{background-color:transparent}.background-button[data-background-button].hide .background-button-wrapper[data-background-button]{opacity:0}.background-button[data-background-button] .background-button-wrapper[data-background-button]{position:absolute;overflow:hidden;width:100%;height:25%;line-height:100%;font-size:25%;top:50%;text-align:center}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button]{cursor:pointer;pointer-events:auto;font-family:Player;font-weight:400;font-style:normal;line-height:1;letter-spacing:0;speak:none;color:#fff;opacity:.75;border:0;outline:0;background-color:transparent;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transition:all .1s;-webkit-transition-delay:ease;-moz-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button]:hover{opacity:1;text-shadow:rgba(255,255,255,.8) 0 0 15px}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].playing:before{content:"\\e002"}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].notplaying:before{content:"\\e001"}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].playstop.playing:before{content:"\\e003"}.background-button[data-background-button] .background-button-wrapper[data-background-button] .background-button-icon[data-background-button].playstop.notplaying:before{content:"\\e001"}.media-control.media-control-hide[data-media-control] .background-button[data-background-button]{opacity:0}',
'dvr_controls': '@import url(http://fonts.googleapis.com/css?family=Roboto);.dvr-controls[data-dvr-controls]{display:inline-block;float:left;color:#fff;line-height:32px;font-size:10px;font-weight:700;margin-left:6px}.dvr-controls[data-dvr-controls] .live-info{cursor:default;font-family:Roboto,"Open Sans",Arial,sans-serif}.dvr-controls[data-dvr-controls] .live-info:before{content:"";display:inline-block;position:relative;width:7px;height:7px;border-radius:3.5px;margin-right:3.5px;background-color:#ff0101}.dvr-controls[data-dvr-controls] .live-info.disabled{opacity:.3}.dvr-controls[data-dvr-controls] .live-info.disabled:before{background-color:#fff}.dvr-controls[data-dvr-controls] .live-button{cursor:pointer;outline:0;display:none;border:0;color:#fff;background-color:transparent;height:32px;padding:0;opacity:.7;font-family:Roboto,"Open Sans",Arial,sans-serif;-webkit-transition:all .1s;-webkit-transition-delay:ease;-moz-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease}.dvr-controls[data-dvr-controls] .live-button:before{content:"";display:inline-block;position:relative;width:7px;height:7px;border-radius:3.5px;margin-right:3.5px;background-color:#fff}.dvr-controls[data-dvr-controls] .live-button:hover{opacity:1;text-shadow:rgba(255,255,255,.75) 0 0 5px}.dvr .dvr-controls[data-dvr-controls] .live-info{display:none}.dvr .dvr-controls[data-dvr-controls] .live-button{display:block}.dvr.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{background-color:#005aff}.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{background-color:#ff0101}.seek-time[data-seek-time] span[data-duration]{position:relative;color:rgba(255,255,255,.5);font-size:10px;padding-right:7px}.seek-time[data-seek-time] span[data-duration]:before{content:"|";margin-right:7px}',
'poster': '@font-face{font-family:Player;src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot);src:url(http://cdn.clappr.io/latest/assets/Player-Regular.eot?#iefix) format("embedded-opentype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.ttf) format("truetype"),url(http://cdn.clappr.io/latest/assets/Player-Regular.svg#player) format("svg")}.player-poster[data-poster]{cursor:pointer;position:absolute;height:100%;width:100%;z-index:998;top:0}.player-poster[data-poster] .poster-background[data-poster]{width:100%;height:100%}.player-poster[data-poster] .play-wrapper[data-poster]{position:absolute;width:100%;height:25%;line-height:100%;font-size:25%;top:50%;text-align:center}.player-poster[data-poster] .play-wrapper[data-poster] .poster-icon[data-poster]{font-family:Player;font-weight:400;font-style:normal;line-height:1;letter-spacing:0;speak:none;color:#fff;opacity:.75;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transition:opacity text-shadow;-webkit-transition-delay:.1s;-moz-transition:opacity text-shadow .1s;-o-transition:opacity text-shadow .1s;transition:opacity text-shadow .1s ease}.player-poster[data-poster] .play-wrapper[data-poster] .poster-icon[data-poster].play[data-poster]:before{content:"\\e001"}.player-poster[data-poster] .play-wrapper[data-poster] .poster-icon[data-poster]:hover{opacity:1;text-shadow:rgba(255,255,255,.8) 0 0 15px}',
'spinner_three_bounce': '.spinner-three-bounce[data-spinner]{position:absolute;margin:0 auto;width:70px;text-align:center;z-index:999;top:47%;left:0;right:0}.spinner-three-bounce[data-spinner]>div{width:18px;height:18px;background-color:#FFF;border-radius:100%;display:inline-block;-webkit-animation:bouncedelay 1.4s infinite ease-in-out;-moz-animation:bouncedelay 1.4s infinite ease-in-out;-ms-animation:bouncedelay 1.4s infinite ease-in-out;-o-animation:bouncedelay 1.4s infinite ease-in-out;animation:bouncedelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;-moz-animation-fill-mode:both;-ms-animation-fill-mode:both;-o-animation-fill-mode:both;animation-fill-mode:both}.spinner-three-bounce[data-spinner] [data-bounce1],.spinner-three-bounce[data-spinner] [data-bounce2]{-webkit-animation-delay:-.32s;-moz-animation-delay:-.32s;-ms-animation-delay:-.32s;-o-animation-delay:-.32s;animation-delay:-.32s}@-moz-keyframes bouncedelay{0%,100%,80%{-moz-transform:scale(0);transform:scale(0)}40%{-moz-transform:scale(1);transform:scale(1)}}@-webkit-keyframes bouncedelay{0%,100%,80%{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}@-o-keyframes bouncedelay{0%,100%,80%{-o-transform:scale(0);transform:scale(0)}40%{-o-transform:scale(1);transform:scale(1)}}@-ms-keyframes bouncedelay{0%,100%,80%{-ms-transform:scale(0);transform:scale(0)}40%{-ms-transform:scale(1);transform:scale(1)}}@keyframes bouncedelay{0%,100%,80%{transform:scale(0)}40%{transform:scale(1)}}',
'watermark': '[data-watermark]{position:absolute;margin:100px auto 0;width:70px;text-align:center;z-index:10}[data-watermark-bottom-left]{bottom:10px;left:10px}[data-watermark-bottom-right]{bottom:10px;right:42px}[data-watermark-top-left]{top:-95px;left:10px}[data-watermark-top-right]{top:-95px;right:37px}'
}
};
},{"underscore":"underscore"}],8:[function(require,module,exports){
"use strict";
var $ = require('zepto');
var _ = require('underscore');
var JST = require('./jst');
var Styler = {getStyleFor: function(name, options) {
options = options || {};
return $('<style class="clappr-style"></style>').html(_.template(JST.CSS[name])(options))[0];
}};
module.exports = Styler;
},{"./jst":7,"underscore":"underscore","zepto":"zepto"}],9:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var Browser = require('browser');
var extend = function(protoProps, staticProps) {
var parent = this;
var child;
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function() {
return parent.apply(this, arguments);
};
}
_.extend(child, parent, staticProps);
var Surrogate = function() {
this.constructor = child;
};
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate();
if (protoProps)
_.extend(child.prototype, protoProps);
child.__super__ = parent.prototype;
child.super = function(name) {
return parent.prototype[name];
};
child.prototype.getClass = function() {
return child;
};
return child;
};
var formatTime = function(time) {
time = time * 1000;
time = parseInt(time / 1000);
var seconds = time % 60;
time = parseInt(time / 60);
var minutes = time % 60;
time = parseInt(time / 60);
var hours = time % 24;
var out = "";
if (hours && hours > 0)
out += ("0" + hours).slice(-2) + ":";
out += ("0" + minutes).slice(-2) + ":";
out += ("0" + seconds).slice(-2);
return out.trim();
};
var Fullscreen = {
isFullscreen: function() {
return document.webkitIsFullScreen || document.mozFullScreen || !!document.msFullscreenElement || window.iframeFullScreen;
},
requestFullscreen: function(el) {
if (el.requestFullscreen) {
el.requestFullscreen();
} else if (el.webkitRequestFullscreen) {
el.webkitRequestFullscreen();
} else if (el.mozRequestFullScreen) {
el.mozRequestFullScreen();
} else if (el.msRequestFullscreen) {
el.msRequestFullscreen();
}
},
cancelFullscreen: function() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
};
var Config = function Config() {};
($traceurRuntime.createClass)(Config, {}, {
_defaultConfig: function() {
return {volume: {
value: 100,
parse: parseInt
}};
},
_defaultValueFor: function(key) {
try {
return this._defaultConfig()[key]['parse'](this._defaultConfig()[key]['value']);
} catch (e) {
return undefined;
}
},
_create_keyspace: function(key) {
return 'clappr.' + document.domain + '.' + key;
},
restore: function(key) {
if (Browser.hasLocalstorage && localStorage[this._create_keyspace(key)]) {
return this._defaultConfig()[key]['parse'](localStorage[this._create_keyspace(key)]);
}
return this._defaultValueFor(key);
},
persist: function(key, value) {
if (Browser.hasLocalstorage) {
try {
localStorage[this._create_keyspace(key)] = value;
return true;
} catch (e) {
return false;
}
}
}
});
var seekStringToSeconds = function(url) {
var elements = _.rest(_.compact(url.match(/t=([0-9]*)h?([0-9]*)m?([0-9]*)s/))).reverse();
var seconds = 0;
var factor = 1;
_.each(elements, function(el) {
seconds += (parseInt(el) * factor);
factor = factor * 60;
}, this);
return seconds;
};
module.exports = {
extend: extend,
formatTime: formatTime,
Fullscreen: Fullscreen,
Config: Config,
seekStringToSeconds: seekStringToSeconds
};
},{"browser":"browser","underscore":"underscore"}],10:[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var Styler = require('../../base/styler');
var _ = require('underscore');
var Events = require('events');
var Container = function Container(options) {
$traceurRuntime.superCall(this, $Container.prototype, "constructor", [options]);
this.playback = options.playback;
this.settings = this.playback.settings;
this.isReady = false;
this.mediaControlDisabled = false;
this.plugins = [this.playback];
this.bindEvents();
};
var $Container = Container;
($traceurRuntime.createClass)(Container, {
get name() {
return 'Container';
},
get attributes() {
return {
class: 'container',
'data-container': ''
};
},
get events() {
return {'click': 'clicked'};
},
bindEvents: function() {
this.listenTo(this.playback, Events.PLAYBACK_PROGRESS, this.progress);
this.listenTo(this.playback, Events.PLAYBACK_TIMEUPDATE, this.timeUpdated);
this.listenTo(this.playback, Events.PLAYBACK_READY, this.ready);
this.listenTo(this.playback, Events.PLAYBACK_BUFFERING, this.buffering);
this.listenTo(this.playback, Events.PLAYBACK_BUFFERFULL, this.bufferfull);
this.listenTo(this.playback, Events.PLAYBACK_SETTINGSUPDATE, this.settingsUpdate);
this.listenTo(this.playback, Events.PLAYBACK_LOADEDMETADATA, this.loadedMetadata);
this.listenTo(this.playback, Events.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
this.listenTo(this.playback, Events.PLAYBACK_BITRATE, this.updateBitrate);
this.listenTo(this.playback, Events.PLAYBACK_PLAYBACKSTATE, this.playbackStateChanged);
this.listenTo(this.playback, Events.PLAYBACK_DVR, this.playbackDvrStateChanged);
this.listenTo(this.playback, Events.PLAYBACK_MEDIACONTROL_DISABLE, this.disableMediaControl);
this.listenTo(this.playback, Events.PLAYBACK_MEDIACONTROL_ENABLE, this.enableMediaControl);
this.listenTo(this.playback, Events.PLAYBACK_ENDED, this.ended);
this.listenTo(this.playback, Events.PLAYBACK_PLAY, this.playing);
this.listenTo(this.playback, Events.PLAYBACK_ERROR, this.error);
},
with: function(klass) {
_.extend(this, klass);
return this;
},
playbackStateChanged: function() {
this.trigger(Events.CONTAINER_PLAYBACKSTATE);
},
playbackDvrStateChanged: function(dvrInUse) {
this.settings = this.playback.settings;
this.dvrInUse = dvrInUse;
this.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, dvrInUse);
},
updateBitrate: function(newBitrate) {
this.trigger(Events.CONTAINER_BITRATE, newBitrate);
},
statsReport: function(metrics) {
this.trigger(Events.CONTAINER_STATS_REPORT, metrics);
},
getPlaybackType: function() {
return this.playback.getPlaybackType();
},
isDvrEnabled: function() {
return !!this.playback.dvrEnabled;
},
isDvrInUse: function() {
return !!this.dvrInUse;
},
destroy: function() {
this.trigger(Events.CONTAINER_DESTROYED, this, this.name);
this.playback.destroy();
_(this.plugins).each((function(plugin) {
return plugin.destroy();
}));
this.$el.remove();
},
setStyle: function(style) {
this.$el.css(style);
},
animate: function(style, duration) {
return this.$el.animate(style, duration).promise();
},
ready: function() {
this.isReady = true;
this.trigger(Events.CONTAINER_READY, this.name);
},
isPlaying: function() {
return this.playback.isPlaying();
},
getDuration: function() {
return this.playback.getDuration();
},
error: function(errorObj) {
this.$el.append(errorObj.render().el);
this.trigger(Events.CONTAINER_ERROR, {
error: errorObj,
container: this
}, this.name);
},
loadedMetadata: function(duration) {
this.trigger(Events.CONTAINER_LOADEDMETADATA, duration);
},
timeUpdated: function(position, duration) {
this.trigger(Events.CONTAINER_TIMEUPDATE, position, duration, this.name);
},
progress: function(startPosition, endPosition, duration) {
this.trigger(Events.CONTAINER_PROGRESS, startPosition, endPosition, duration, this.name);
},
playing: function() {
this.trigger(Events.CONTAINER_PLAY, this.name);
},
play: function() {
this.playback.play();
},
stop: function() {
this.trigger(Events.CONTAINER_STOP, this.name);
this.playback.stop();
},
pause: function() {
this.trigger(Events.CONTAINER_PAUSE, this.name);
this.playback.pause();
},
ended: function() {
this.trigger(Events.CONTAINER_ENDED, this, this.name);
},
clicked: function() {
this.trigger(Events.CONTAINER_CLICK, this, this.name);
},
setCurrentTime: function(time) {
this.trigger(Events.CONTAINER_SEEK, time, this.name);
this.playback.seek(time);
},
setVolume: function(value) {
this.trigger(Events.CONTAINER_VOLUME, value, this.name);
this.playback.volume(value);
},
fullscreen: function() {
this.trigger(Events.CONTAINER_FULLSCREEN, this.name);
},
buffering: function() {
this.trigger(Events.CONTAINER_STATE_BUFFERING, this.name);
},
bufferfull: function() {
this.trigger(Events.CONTAINER_STATE_BUFFERFULL, this.name);
},
addPlugin: function(plugin) {
this.plugins.push(plugin);
},
hasPlugin: function(name) {
return !!this.getPlugin(name);
},
getPlugin: function(name) {
return _(this.plugins).find(function(plugin) {
return plugin.name === name;
});
},
settingsUpdate: function() {
this.settings = this.playback.settings;
this.trigger(Events.CONTAINER_SETTINGSUPDATE);
},
highDefinitionUpdate: function() {
this.trigger(Events.CONTAINER_HIGHDEFINITIONUPDATE);
},
isHighDefinitionInUse: function() {
return this.playback.isHighDefinitionInUse();
},
disableMediaControl: function() {
this.mediaControlDisabled = true;
this.trigger(Events.CONTAINER_MEDIACONTROL_DISABLE);
},
enableMediaControl: function() {
this.mediaControlDisabled = false;
this.trigger(Events.CONTAINER_MEDIACONTROL_ENABLE);
},
render: function() {
var style = Styler.getStyleFor('container');
this.$el.append(style);
this.$el.append(this.playback.render().el);
return this;
}
}, {}, UIObject);
module.exports = Container;
},{"../../base/styler":8,"events":"events","ui_object":"ui_object","underscore":"underscore"}],11:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var BaseObject = require('base_object');
var Container = require('container');
var $ = require('zepto');
var Events = require('events');
var ContainerFactory = function ContainerFactory(options, loader) {
$traceurRuntime.superCall(this, $ContainerFactory.prototype, "constructor", [options]);
this.options = options;
this.loader = loader;
};
var $ContainerFactory = ContainerFactory;
($traceurRuntime.createClass)(ContainerFactory, {
createContainers: function() {
var $__0 = this;
return $.Deferred((function(promise) {
promise.resolve(_.map($__0.options.sources, (function(source) {
return $__0.createContainer(source);
}), $__0));
}));
},
findPlaybackPlugin: function(source) {
return _.find(this.loader.playbackPlugins, (function(p) {
return p.canPlay(source.toString());
}), this);
},
createContainer: function(source) {
var playbackPlugin = this.findPlaybackPlugin(source);
var options = _.extend({}, this.options, {
src: source,
autoPlay: !!this.options.autoPlay
});
var playback = new playbackPlugin(options);
var container = new Container({playback: playback});
var defer = $.Deferred();
defer.promise(container);
this.addContainerPlugins(container, source);
this.listenToOnce(container, Events.CONTAINER_READY, (function() {
return defer.resolve(container);
}));
return container;
},
addContainerPlugins: function(container, source) {
_.each(this.loader.containerPlugins, function(Plugin) {
var options = _.extend(this.options, {
container: container,
src: source
});
container.addPlugin(new Plugin(options));
}, this);
}
}, {}, BaseObject);
module.exports = ContainerFactory;
},{"base_object":"base_object","container":"container","events":"events","underscore":"underscore","zepto":"zepto"}],12:[function(require,module,exports){
"use strict";
module.exports = require('./container_factory');
},{"./container_factory":11}],13:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var $ = require('zepto');
var UIObject = require('ui_object');
var ContainerFactory = require('../container_factory');
var Fullscreen = require('../../base/utils').Fullscreen;
var Styler = require('../../base/styler');
var MediaControl = require('media_control');
var PlayerInfo = require('player_info');
var Mediator = require('mediator');
var Events = require('events');
var Core = function Core(options) {
var $__0 = this;
$traceurRuntime.superCall(this, $Core.prototype, "constructor", [options]);
PlayerInfo.options = options;
this.options = options;
this.plugins = [];
this.containers = [];
this.createContainers(options);
$(document).bind('fullscreenchange', (function() {
return $__0.exit();
}));
$(document).bind('MSFullscreenChange', (function() {
return $__0.exit();
}));
$(document).bind('mozfullscreenchange', (function() {
return $__0.exit();
}));
};
var $Core = Core;
($traceurRuntime.createClass)(Core, {
get events() {
return {
'webkitfullscreenchange': 'exit',
'mousemove': 'showMediaControl',
'mouseleave': 'hideMediaControl'
};
},
get attributes() {
return {'data-player': ''};
},
createContainers: function(options) {
var $__0 = this;
this.defer = $.Deferred();
this.defer.promise(this);
this.containerFactory = new ContainerFactory(options, options.loader);
this.containerFactory.createContainers().then((function(containers) {
return $__0.setupContainers(containers);
})).then((function(containers) {
return $__0.resolveOnContainersReady(containers);
}));
},
updateSize: function() {
if (Fullscreen.isFullscreen()) {
this.setFullscreen();
} else {
this.setPlayerSize();
}
Mediator.trigger(Events.PLAYER_RESIZE);
},
setFullscreen: function() {
this.$el.addClass('fullscreen');
this.$el.removeAttr('style');
PlayerInfo.previousSize = PlayerInfo.currentSize;
PlayerInfo.currentSize = {
width: $(window).width(),
height: $(window).height()
};
},
setPlayerSize: function() {
this.$el.removeClass('fullscreen');
PlayerInfo.currentSize = PlayerInfo.previousSize;
PlayerInfo.previousSize = {
width: $(window).width(),
height: $(window).height()
};
this.resize(PlayerInfo.currentSize);
},
resize: function(options) {
var size = _.pick(options, 'width', 'height');
this.el.style.height = (size.height + "px");
this.el.style.width = (size.width + "px");
PlayerInfo.previousSize = PlayerInfo.currentSize;
PlayerInfo.currentSize = size;
Mediator.trigger(Events.PLAYER_RESIZE);
},
resolveOnContainersReady: function(containers) {
var $__0 = this;
$.when.apply($, containers).done((function() {
return $__0.defer.resolve($__0);
}));
},
addPlugin: function(plugin) {
this.plugins.push(plugin);
},
hasPlugin: function(name) {
return !!this.getPlugin(name);
},
getPlugin: function(name) {
return _(this.plugins).find((function(plugin) {
return plugin.name === name;
}));
},
load: function(sources) {
var $__0 = this;
sources = _.isArray(sources) ? sources : [sources.toString()];
_(this.containers).each((function(container) {
return container.destroy();
}));
this.containerFactory.options = _(this.options).extend({sources: sources});
this.containerFactory.createContainers().then((function(containers) {
$__0.setupContainers(containers);
}));
},
destroy: function() {
_(this.containers).each((function(container) {
return container.destroy();
}));
_(this.plugins).each((function(plugin) {
return plugin.destroy();
}));
this.$el.remove();
this.mediaControl.destroy();
$(document).unbind('fullscreenchange');
$(document).unbind('MSFullscreenChange');
$(document).unbind('mozfullscreenchange');
},
exit: function() {
this.updateSize();
this.mediaControl.show();
},
setMediaControlContainer: function(container) {
this.mediaControl.setContainer(container);
this.mediaControl.render();
},
disableMediaControl: function() {
this.mediaControl.disable();
this.$el.removeClass('nocursor');
},
enableMediaControl: function() {
this.mediaControl.enable();
},
removeContainer: function(container) {
this.stopListening(container);
this.containers = _.without(this.containers, container);
},
appendContainer: function(container) {
this.listenTo(container, Events.CONTAINER_DESTROYED, this.removeContainer);
this.el.appendChild(container.render().el);
this.containers.push(container);
},
setupContainers: function(containers) {
_.map(containers, this.appendContainer, this);
this.setupMediaControl(this.getCurrentContainer());
this.render();
this.$el.appendTo(this.options.parentElement);
return containers;
},
createContainer: function(source) {
var container = this.containerFactory.createContainer(source);
this.appendContainer(container);
return container;
},
setupMediaControl: function(container) {
if (this.mediaControl) {
this.mediaControl.setContainer(container);
} else {
this.mediaControl = this.createMediaControl(_.extend({container: container}, this.options));
this.listenTo(this.mediaControl, Events.MEDIACONTROL_FULLSCREEN, this.toggleFullscreen);
this.listenTo(this.mediaControl, Events.MEDIACONTROL_SHOW, this.onMediaControlShow.bind(this, true));
this.listenTo(this.mediaControl, Events.MEDIACONTROL_HIDE, this.onMediaControlShow.bind(this, false));
}
},
createMediaControl: function(options) {
if (options.mediacontrol && options.mediacontrol.external) {
return new options.mediacontrol.external(options);
} else {
return new MediaControl(options);
}
},
getCurrentContainer: function() {
return this.containers[0];
},
toggleFullscreen: function() {
if (!Fullscreen.isFullscreen()) {
Fullscreen.requestFullscreen(this.el);
this.$el.addClass('fullscreen');
} else {
Fullscreen.cancelFullscreen();
this.$el.removeClass('fullscreen nocursor');
}
this.mediaControl.show();
},
showMediaControl: function(event) {
this.mediaControl.show(event);
},
hideMediaControl: function(event) {
this.mediaControl.hide(event);
},
onMediaControlShow: function(showing) {
if (showing)
this.$el.removeClass('nocursor');
else if (Fullscreen.isFullscreen())
this.$el.addClass('nocursor');
},
render: function() {
var style = Styler.getStyleFor('core');
this.$el.append(style);
this.$el.append(this.mediaControl.render().el);
this.options.width = this.options.width || this.$el.width();
this.options.height = this.options.height || this.$el.height();
PlayerInfo.previousSize = PlayerInfo.currentSize = _.pick(this.options, 'width', 'height');
this.updateSize();
return this;
}
}, {}, UIObject);
module.exports = Core;
},{"../../base/styler":8,"../../base/utils":9,"../container_factory":12,"events":"events","media_control":"media_control","mediator":"mediator","player_info":"player_info","ui_object":"ui_object","underscore":"underscore","zepto":"zepto"}],14:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var BaseObject = require('base_object');
var Core = require('core');
var CoreFactory = function CoreFactory(player, loader) {
this.player = player;
this.options = player.options;
this.loader = loader;
this.options.loader = this.loader;
};
($traceurRuntime.createClass)(CoreFactory, {
create: function() {
this.core = new Core(this.options);
this.core.then(this.addCorePlugins.bind(this));
return this.core;
},
addCorePlugins: function() {
_.each(this.loader.corePlugins, function(Plugin) {
var plugin = new Plugin(this.core);
this.core.addPlugin(plugin);
this.setupExternalInterface(plugin);
}, this);
return this.core;
},
setupExternalInterface: function(plugin) {
_.each(plugin.getExternalInterface(), function(value, key) {
this.player[key] = value.bind(plugin);
}, this);
}
}, {}, BaseObject);
module.exports = CoreFactory;
},{"base_object":"base_object","core":"core","underscore":"underscore"}],15:[function(require,module,exports){
"use strict";
module.exports = require('./core_factory');
},{"./core_factory":14}],16:[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var $ = require('zepto');
var Player = require('../player');
var IframePlayer = function IframePlayer(options) {
$traceurRuntime.superCall(this, $IframePlayer.prototype, "constructor", [options]);
this.options = options;
this.createIframe();
};
var $IframePlayer = IframePlayer;
($traceurRuntime.createClass)(IframePlayer, {
createIframe: function() {
this.iframe = document.createElement("iframe");
this.iframe.setAttribute("frameborder", 0);
this.iframe.setAttribute("id", this.uniqueId);
this.iframe.setAttribute("allowfullscreen", true);
this.iframe.setAttribute("scrolling", "no");
this.iframe.setAttribute("src", "http://cdn.clappr.io/latest/assets/iframe.htm" + this.buildQueryString());
this.iframe.setAttribute('width', this.options.width);
this.iframe.setAttribute('height', this.options.height);
},
attachTo: function(element) {
element.appendChild(this.iframe);
},
addEventListeners: function() {
var $__0 = this;
this.iframe.contentWindow.addEventListener("fullscreenchange", (function() {
return $__0.updateSize();
}));
this.iframe.contentWindow.addEventListener("webkitfullscreenchange", (function() {
return $__0.updateSize();
}));
this.iframe.contentWindow.addEventListener("mozfullscreenchange", (function() {
return $__0.updateSize();
}));
},
buildQueryString: function() {
var result = "";
for (var param in this.options) {
result += !!result ? "&" : "?";
result += encodeURIComponent(param) + "=" + encodeURIComponent(this.options[param]);
}
return result;
}
}, {}, BaseObject);
module.exports = IframePlayer;
},{"../player":21,"base_object":"base_object","zepto":"zepto"}],17:[function(require,module,exports){
"use strict";
module.exports = require('./iframe_player');
},{"./iframe_player":16}],18:[function(require,module,exports){
"use strict";
module.exports = require('./loader');
},{"./loader":19}],19:[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var _ = require('underscore');
var PlayerInfo = require('player_info');
var HTML5VideoPlayback = require('html5_video');
var FlashVideoPlayback = require('flash');
var HTML5AudioPlayback = require('html5_audio');
var HLSVideoPlayback = require('hls');
var HTMLImgPlayback = require('html_img');
var NoOp = require('../../playbacks/no_op');
var SpinnerThreeBouncePlugin = require('../../plugins/spinner_three_bounce');
var StatsPlugin = require('../../plugins/stats');
var WaterMarkPlugin = require('../../plugins/watermark');
var PosterPlugin = require('poster');
var GoogleAnalyticsPlugin = require('../../plugins/google_analytics');
var ClickToPausePlugin = require('../../plugins/click_to_pause');
var BackgroundButton = require('../../plugins/background_button');
var DVRControls = require('../../plugins/dvr_controls');
var Loader = function Loader(externalPlugins) {
$traceurRuntime.superCall(this, $Loader.prototype, "constructor", []);
this.playbackPlugins = [FlashVideoPlayback, HTML5VideoPlayback, HTML5AudioPlayback, HLSVideoPlayback, HTMLImgPlayback, NoOp];
this.containerPlugins = [SpinnerThreeBouncePlugin, WaterMarkPlugin, PosterPlugin, StatsPlugin, GoogleAnalyticsPlugin, ClickToPausePlugin];
this.corePlugins = [BackgroundButton, DVRControls];
if (externalPlugins) {
this.addExternalPlugins(externalPlugins);
}
};
var $Loader = Loader;
($traceurRuntime.createClass)(Loader, {
addExternalPlugins: function(plugins) {
var pluginName = function(plugin) {
return plugin.prototype.name;
};
if (plugins.playback) {
this.playbackPlugins = _.uniq(plugins.playback.concat(this.playbackPlugins), pluginName);
}
if (plugins.container) {
this.containerPlugins = _.uniq(plugins.container.concat(this.containerPlugins), pluginName);
}
if (plugins.core) {
this.corePlugins = _.uniq(plugins.core.concat(this.corePlugins), pluginName);
}
PlayerInfo.playbackPlugins = this.playbackPlugins;
},
getPlugin: function(name) {
var allPlugins = _.union(this.containerPlugins, this.playbackPlugins, this.corePlugins);
return _.find(allPlugins, function(plugin) {
return plugin.prototype.name === name;
});
}
}, {}, BaseObject);
module.exports = Loader;
},{"../../playbacks/no_op":29,"../../plugins/background_button":32,"../../plugins/click_to_pause":34,"../../plugins/dvr_controls":36,"../../plugins/google_analytics":38,"../../plugins/spinner_three_bounce":42,"../../plugins/stats":44,"../../plugins/watermark":46,"base_object":"base_object","flash":"flash","hls":"hls","html5_audio":"html5_audio","html5_video":"html5_video","html_img":"html_img","player_info":"player_info","poster":"poster","underscore":"underscore"}],20:[function(require,module,exports){
"use strict";
var _ = require('underscore');
var $ = require('zepto');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var UIObject = require('ui_object');
var Utils = require('../../base/utils');
var SeekTime = require('../seek_time');
var Mediator = require('mediator');
var PlayerInfo = require('player_info');
var Events = require('events');
require('mousetrap');
var MediaControl = function MediaControl(options) {
var $__0 = this;
$traceurRuntime.superCall(this, $MediaControl.prototype, "constructor", [options]);
this.seekTime = new SeekTime(this);
this.options = options;
this.mute = this.options.mute;
this.persistConfig = this.options.persistConfig;
this.container = options.container;
var initialVolume = (this.persistConfig) ? Utils.Config.restore("volume") : 100;
this.setVolume(this.mute ? 0 : initialVolume);
this.keepVisible = false;
this.addEventListeners();
this.settings = {
left: ['play', 'stop', 'pause'],
right: ['volume'],
default: ['position', 'seekbar', 'duration']
};
this.settings = _.isEmpty(this.container.settings) ? this.settings : this.container.settings;
this.disabled = false;
if (this.container.mediaControlDisabled || this.options.chromeless) {
this.disable();
}
$(document).bind('mouseup', (function(event) {
return $__0.stopDrag(event);
}));
$(document).bind('mousemove', (function(event) {
return $__0.updateDrag(event);
}));
Mediator.on(Events.PLAYER_RESIZE, (function() {
return $__0.playerResize();
}));
};
var $MediaControl = MediaControl;
($traceurRuntime.createClass)(MediaControl, {
get name() {
return 'MediaControl';
},
get attributes() {
return {
class: 'media-control',
'data-media-control': ''
};
},
get events() {
return {
'click [data-play]': 'play',
'click [data-pause]': 'pause',
'click [data-playpause]': 'togglePlayPause',
'click [data-stop]': 'stop',
'click [data-playstop]': 'togglePlayStop',
'click [data-fullscreen]': 'toggleFullscreen',
'click .bar-container[data-seekbar]': 'seek',
'click .bar-container[data-volume]': 'volume',
'click .drawer-icon[data-volume]': 'toggleMute',
'mouseenter .drawer-container[data-volume]': 'showVolumeBar',
'mouseleave .drawer-container[data-volume]': 'hideVolumeBar',
'mousedown .bar-scrubber[data-volume]': 'startVolumeDrag',
'mousedown .bar-scrubber[data-seekbar]': 'startSeekDrag',
'mousemove .bar-container[data-seekbar]': 'mousemoveOnSeekBar',
'mouseleave .bar-container[data-seekbar]': 'mouseleaveOnSeekBar',
'mouseenter .media-control-layer[data-controls]': 'setKeepVisible',
'mouseleave .media-control-layer[data-controls]': 'resetKeepVisible'
};
},
get template() {
return JST.media_control;
},
addEventListeners: function() {
this.listenTo(this.container, Events.CONTAINER_PLAY, this.changeTogglePlay);
this.listenTo(this.container, Events.CONTAINER_TIMEUPDATE, this.updateSeekBar);
this.listenTo(this.container, Events.CONTAINER_PROGRESS, this.updateProgressBar);
this.listenTo(this.container, Events.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.settingsUpdate);
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
this.listenTo(this.container, Events.CONTAINER_MEDIACONTROL_DISABLE, this.disable);
this.listenTo(this.container, Events.CONTAINER_MEDIACONTROL_ENABLE, this.enable);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.ended);
},
disable: function() {
this.disabled = true;
this.hide();
this.$el.hide();
},
enable: function() {
if (this.options.chromeless)
return;
this.disabled = false;
this.show();
},
play: function() {
this.container.play();
},
pause: function() {
this.container.pause();
},
stop: function() {
this.container.stop();
},
changeTogglePlay: function() {
if (this.container.isPlaying()) {
this.$playPauseToggle.removeClass('paused').addClass('playing');
this.$playStopToggle.removeClass('stopped').addClass('playing');
this.trigger(Events.MEDIACONTROL_PLAYING);
} else {
this.$playPauseToggle.removeClass('playing').addClass('paused');
this.$playStopToggle.removeClass('playing').addClass('stopped');
this.trigger(Events.MEDIACONTROL_NOTPLAYING);
}
},
mousemoveOnSeekBar: function(event) {
if (this.container.settings.seekEnabled) {
var offsetX = event.pageX - this.$seekBarContainer.offset().left - (this.$seekBarHover.width() / 2);
this.$seekBarHover.css({left: offsetX});
}
this.trigger(Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, event);
},
mouseleaveOnSeekBar: function(event) {
this.trigger(Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, event);
},
playerResize: function() {
if (Utils.Fullscreen.isFullscreen()) {
this.$fullscreenToggle.addClass('shrink');
} else {
this.$fullscreenToggle.removeClass('shrink');
}
this.$el.removeClass('w320');
if (PlayerInfo.currentSize.width <= 320) {
this.$el.addClass('w320');
}
},
togglePlayPause: function() {
if (this.container.isPlaying()) {
this.container.pause();
} else {
this.container.play();
}
this.changeTogglePlay();
},
togglePlayStop: function() {
if (this.container.isPlaying()) {
this.container.stop();
} else {
this.container.play();
}
this.changeTogglePlay();
},
startSeekDrag: function(event) {
if (!this.container.settings.seekEnabled)
return;
this.draggingSeekBar = true;
this.$el.addClass('dragging');
this.$seekBarLoaded.addClass('media-control-notransition');
this.$seekBarPosition.addClass('media-control-notransition');
this.$seekBarScrubber.addClass('media-control-notransition');
if (event) {
event.preventDefault();
}
},
startVolumeDrag: function(event) {
this.draggingVolumeBar = true;
this.$el.addClass('dragging');
if (event) {
event.preventDefault();
}
},
stopDrag: function(event) {
if (this.draggingSeekBar) {
this.seek(event);
}
this.$el.removeClass('dragging');
this.$seekBarLoaded.removeClass('media-control-notransition');
this.$seekBarPosition.removeClass('media-control-notransition');
this.$seekBarScrubber.removeClass('media-control-notransition dragging');
this.draggingSeekBar = false;
this.draggingVolumeBar = false;
},
updateDrag: function(event) {
if (event) {
event.preventDefault();
}
if (this.draggingSeekBar) {
var offsetX = event.pageX - this.$seekBarContainer.offset().left;
var pos = offsetX / this.$seekBarContainer.width() * 100;
pos = Math.min(100, Math.max(pos, 0));
this.setSeekPercentage(pos);
} else if (this.draggingVolumeBar) {
this.volume(event);
}
},
volume: function(event) {
var offsetY = event.pageX - this.$volumeBarContainer.offset().left;
var volumeFromUI = (offsetY / this.$volumeBarContainer.width()) * 100;
this.setVolume(volumeFromUI);
},
toggleMute: function() {
if (this.mute) {
if (this.currentVolume <= 0) {
this.currentVolume = 100;
}
this.setVolume(this.currentVolume);
} else {
this.setVolume(0);
}
},
setVolume: function(value) {
this.currentVolume = Math.min(100, Math.max(value, 0));
this.container.setVolume(this.currentVolume);
this.setVolumeLevel(this.currentVolume);
this.mute = this.currentVolume === 0;
this.persistConfig && Utils.Config.persist("volume", this.currentVolume);
},
toggleFullscreen: function() {
this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name);
this.container.fullscreen();
this.resetKeepVisible();
},
setContainer: function(container) {
this.stopListening(this.container);
this.container = container;
this.changeTogglePlay();
this.addEventListeners();
this.settingsUpdate();
this.container.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.container.isDvrInUse());
this.setVolume(this.currentVolume);
if (this.container.mediaControlDisabled) {
this.disable();
}
this.trigger(Events.MEDIACONTROL_CONTAINERCHANGED);
},
showVolumeBar: function() {
if (this.hideVolumeId) {
clearTimeout(this.hideVolumeId);
}
this.$volumeBarContainer.removeClass('volume-bar-hide');
},
hideVolumeBar: function() {
var $__0 = this;
var timeout = 400;
if (!this.$volumeBarContainer)
return;
if (this.draggingVolumeBar) {
this.hideVolumeId = setTimeout((function() {
return $__0.hideVolumeBar();
}), timeout);
} else {
if (this.hideVolumeId) {
clearTimeout(this.hideVolumeId);
}
this.hideVolumeId = setTimeout((function() {
return $__0.$volumeBarContainer.addClass('volume-bar-hide');
}), timeout);
}
},
ended: function() {
this.changeTogglePlay();
},
updateProgressBar: function(startPosition, endPosition, duration) {
var loadedStart = startPosition / duration * 100;
var loadedEnd = endPosition / duration * 100;
this.$seekBarLoaded.css({
left: loadedStart + '%',
width: (loadedEnd - loadedStart) + '%'
});
},
updateSeekBar: function(position, duration) {
if (this.draggingSeekBar)
return;
if (position < 0)
position = duration;
this.$seekBarPosition.removeClass('media-control-notransition');
this.$seekBarScrubber.removeClass('media-control-notransition');
var seekbarValue = (100 / duration) * position;
this.setSeekPercentage(seekbarValue);
this.$('[data-position]').html(Utils.formatTime(position));
this.$('[data-duration]').html(Utils.formatTime(duration));
},
seek: function(event) {
if (!this.container.settings.seekEnabled)
return;
var offsetX = event.pageX - this.$seekBarContainer.offset().left;
var pos = offsetX / this.$seekBarContainer.width() * 100;
pos = Math.min(100, Math.max(pos, 0));
this.container.setCurrentTime(pos);
this.setSeekPercentage(pos);
return false;
},
setKeepVisible: function() {
this.keepVisible = true;
},
resetKeepVisible: function() {
this.keepVisible = false;
},
isVisible: function() {
return !this.$el.hasClass('media-control-hide');
},
show: function(event) {
var $__0 = this;
if (this.disabled || this.container.getPlaybackType() === null)
return;
var timeout = 2000;
if (!event || (event.clientX !== this.lastMouseX && event.clientY !== this.lastMouseY) || navigator.userAgent.match(/firefox/i)) {
clearTimeout(this.hideId);
this.$el.show();
this.trigger(Events.MEDIACONTROL_SHOW, this.name);
this.$el.removeClass('media-control-hide');
this.hideId = setTimeout((function() {
return $__0.hide();
}), timeout);
if (event) {
this.lastMouseX = event.clientX;
this.lastMouseY = event.clientY;
}
}
},
hide: function() {
var $__0 = this;
var timeout = 2000;
clearTimeout(this.hideId);
if (!this.isVisible() || this.options.hideMediaControl === false)
return;
if (this.keepVisible || this.draggingSeekBar || this.draggingVolumeBar) {
this.hideId = setTimeout((function() {
return $__0.hide();
}), timeout);
} else {
this.trigger(Events.MEDIACONTROL_HIDE, this.name);
this.$el.addClass('media-control-hide');
this.hideVolumeBar();
}
},
settingsUpdate: function() {
if (this.container.getPlaybackType() !== null && !_.isEmpty(this.container.settings)) {
this.settings = this.container.settings;
this.render();
this.enable();
} else {
this.disable();
}
},
highDefinitionUpdate: function() {
if (this.container.isHighDefinitionInUse()) {
this.$el.find('button[data-hd-indicator]').addClass("enabled");
} else {
this.$el.find('button[data-hd-indicator]').removeClass("enabled");
}
},
createCachedElements: function() {
this.$playPauseToggle = this.$el.find('button.media-control-button[data-playpause]');
this.$playStopToggle = this.$el.find('button.media-control-button[data-playstop]');
this.$fullscreenToggle = this.$el.find('button.media-control-button[data-fullscreen]');
this.$seekBarContainer = this.$el.find('.bar-container[data-seekbar]');
this.$seekBarLoaded = this.$el.find('.bar-fill-1[data-seekbar]');
this.$seekBarPosition = this.$el.find('.bar-fill-2[data-seekbar]');
this.$seekBarScrubber = this.$el.find('.bar-scrubber[data-seekbar]');
this.$seekBarHover = this.$el.find('.bar-hover[data-seekbar]');
this.$volumeBarContainer = this.$el.find('.bar-container[data-volume]');
this.$volumeIcon = this.$el.find('.drawer-icon[data-volume]');
},
setVolumeLevel: function(value) {
var $__0 = this;
if (!this.container.isReady || !this.$volumeBarContainer) {
this.listenToOnce(this.container, Events.CONTAINER_READY, (function() {
return $__0.setVolumeLevel(value);
}));
} else {
this.$volumeBarContainer.find('.segmented-bar-element').removeClass('fill');
var item = Math.ceil(value / 10.0);
this.$volumeBarContainer.find('.segmented-bar-element').slice(0, item).addClass('fill');
if (value > 0) {
this.$volumeIcon.removeClass('muted');
} else {
this.$volumeIcon.addClass('muted');
}
}
},
setSeekPercentage: function(value) {
if (value > 100)
return;
var pos = this.$seekBarContainer.width() * value / 100.0 - (this.$seekBarScrubber.width() / 2.0);
this.currentSeekPercentage = value;
this.$seekBarPosition.css({width: value + '%'});
this.$seekBarScrubber.css({left: pos});
},
bindKeyEvents: function() {
var $__0 = this;
Mousetrap.bind(['space'], (function() {
return $__0.togglePlayPause();
}));
},
unbindKeyEvents: function() {
Mousetrap.unbind('space');
},
parseColors: function() {
if (this.options.mediacontrol) {
var buttonsColor = this.options.mediacontrol.buttons;
var seekbarColor = this.options.mediacontrol.seekbar;
this.$el.find('.bar-fill-2[data-seekbar]').css('background-color', seekbarColor);
this.$el.find('[data-media-control] > .media-control-icon, .drawer-icon').css('color', buttonsColor);
this.$el.find('.segmented-bar-element[data-volume]').css('boxShadow', "inset 2px 0 0 " + buttonsColor);
}
},
render: function() {
var $__0 = this;
var timeout = 1000;
var style = Styler.getStyleFor('media_control');
this.$el.html(this.template({settings: this.settings}));
this.$el.append(style);
this.createCachedElements();
this.$playPauseToggle.addClass('paused');
this.$playStopToggle.addClass('stopped');
this.changeTogglePlay();
this.hideId = setTimeout((function() {
return $__0.hide();
}), timeout);
if (this.disabled) {
this.hide();
}
this.$seekBarPosition.addClass('media-control-notransition');
this.$seekBarScrubber.addClass('media-control-notransition');
if (!this.currentSeekPercentage) {
this.currentSeekPercentage = 0;
}
this.setSeekPercentage(this.currentSeekPercentage);
this.$el.ready((function() {
if (!$__0.container.settings.seekEnabled) {
$__0.$seekBarContainer.addClass('seek-disabled');
}
$__0.setVolume($__0.currentVolume);
$__0.bindKeyEvents();
$__0.hideVolumeBar();
}));
this.parseColors();
this.seekTime.render();
this.trigger(Events.MEDIACONTROL_RENDERED);
return this;
},
destroy: function() {
$(document).unbind('mouseup');
$(document).unbind('mousemove');
this.unbindKeyEvents();
}
}, {}, UIObject);
module.exports = MediaControl;
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"../seek_time":22,"events":"events","mediator":"mediator","mousetrap":4,"player_info":"player_info","ui_object":"ui_object","underscore":"underscore","zepto":"zepto"}],21:[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var CoreFactory = require('./core_factory');
var Loader = require('./loader');
var _ = require('underscore');
var ScrollMonitor = require('scrollmonitor');
var PlayerInfo = require('player_info');
var Player = function Player(options) {
$traceurRuntime.superCall(this, $Player.prototype, "constructor", [options]);
window.p = this;
var defaultOptions = {
persistConfig: true,
width: 640,
height: 360
};
this.options = _.extend(defaultOptions, options);
this.options.sources = this.normalizeSources(options);
this.loader = new Loader(this.options.plugins || {});
this.coreFactory = new CoreFactory(this, this.loader);
PlayerInfo.currentSize = {
width: options.width,
height: options.height
};
if (this.options.parentId) {
this.setParentId(this.options.parentId);
}
};
var $Player = Player;
($traceurRuntime.createClass)(Player, {
setParentId: function(parentId) {
var el = document.querySelector(parentId);
if (el) {
this.attachTo(el);
}
},
attachTo: function(element) {
this.options.parentElement = element;
this.core = this.coreFactory.create();
if (this.options.autoPlayVisible) {
this.bindAutoPlayVisible(this.options.autoPlayVisible);
}
},
bindAutoPlayVisible: function(option) {
var $__0 = this;
this.elementWatcher = ScrollMonitor.create(this.core.$el);
if (option === 'full') {
this.elementWatcher.fullyEnterViewport((function() {
return $__0.enterViewport();
}));
} else if (option === 'partial') {
this.elementWatcher.enterViewport((function() {
return $__0.enterViewport();
}));
}
},
enterViewport: function() {
if (this.elementWatcher.top !== 0 && !this.isPlaying()) {
this.play();
}
},
normalizeSources: function(options) {
var sources = _.compact(_.flatten([options.source, options.sources]));
return _.isEmpty(sources) ? ['no.op'] : sources;
},
resize: function(size) {
this.core.resize(size);
},
load: function(sources) {
this.core.load(sources);
},
destroy: function() {
this.core.destroy();
},
play: function() {
this.core.mediaControl.container.play();
},
pause: function() {
this.core.mediaControl.container.pause();
},
stop: function() {
this.core.mediaControl.container.stop();
},
seek: function(time) {
this.core.mediaControl.container.setCurrentTime(time);
},
setVolume: function(volume) {
this.core.mediaControl.container.setVolume(volume);
},
mute: function() {
this.core.mediaControl.container.setVolume(0);
},
unmute: function() {
this.core.mediaControl.container.setVolume(100);
},
isPlaying: function() {
return this.core.mediaControl.container.isPlaying();
}
}, {}, BaseObject);
module.exports = Player;
},{"./core_factory":15,"./loader":18,"base_object":"base_object","player_info":"player_info","scrollmonitor":5,"underscore":"underscore"}],22:[function(require,module,exports){
"use strict";
module.exports = require('./seek_time');
},{"./seek_time":23}],23:[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var formatTime = require('../../base/utils').formatTime;
var Events = require('events');
var SeekTime = function SeekTime(mediaControl) {
$traceurRuntime.superCall(this, $SeekTime.prototype, "constructor", []);
this.mediaControl = mediaControl;
this.addEventListeners();
};
var $SeekTime = SeekTime;
($traceurRuntime.createClass)(SeekTime, {
get name() {
return 'seek_time';
},
get template() {
return JST.seek_time;
},
get attributes() {
return {
'class': 'seek-time hidden',
'data-seek-time': ''
};
},
addEventListeners: function() {
this.listenTo(this.mediaControl, Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this.showTime);
this.listenTo(this.mediaControl, Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, this.hideTime);
},
showTime: function(event) {
var offset = event.pageX - this.mediaControl.$seekBarContainer.offset().left;
var timePosition = Math.min(100, Math.max((offset) / this.mediaControl.$seekBarContainer.width() * 100, 0));
var pointerPosition = event.pageX - this.mediaControl.$el.offset().left - (this.$el.width() / 2);
pointerPosition = Math.min(Math.max(0, pointerPosition), this.mediaControl.$el.width() - this.$el.width());
var currentTime = timePosition * this.mediaControl.container.getDuration() / 100;
var options = {
timestamp: currentTime,
formattedTime: formatTime(currentTime),
pointerPosition: pointerPosition
};
this.update(options);
},
hideTime: function() {
this.$el.addClass('hidden');
this.$el.css('left', '-100%');
},
update: function(options) {
if (this.mediaControl.container.getPlaybackType() === 'vod' || this.mediaControl.container.isDvrInUse()) {
this.$el.find('[data-seek-time]').text(options.formattedTime);
this.$el.css('left', options.pointerPosition);
this.$el.removeClass('hidden');
}
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
this.mediaControl.$el.append(this.el);
}
}, {}, UIObject);
module.exports = SeekTime;
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"events":"events","ui_object":"ui_object"}],24:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Mediator = require('mediator');
var _ = require('underscore');
var $ = require('zepto');
var Browser = require('browser');
var seekStringToSeconds = require('../../base/utils').seekStringToSeconds;
var Events = require('events');
require('mousetrap');
var objectIE = '<object type="application/x-shockwave-flash" id="<%= cid %>" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" data-flash-vod=""><param name="movie" value="<%= swfPath %>"> <param name="quality" value="autohigh"> <param name="swliveconnect" value="true"> <param name="allowScriptAccess" value="always"> <param name="bgcolor" value="#001122"> <param name="allowFullScreen" value="false"> <param name="wmode" value="gpu"> <param name="tabindex" value="1"> <param name=FlashVars value="playbackId=<%= playbackId %>" /> </object>';
var Flash = function Flash(options) {
$traceurRuntime.superCall(this, $Flash.prototype, "constructor", [options]);
this.src = options.src;
this.defaultBaseSwfPath = "http://cdn.clappr.io/" + Clappr.version + "/assets/";
this.swfPath = (options.swfBasePath || this.defaultBaseSwfPath) + "Player.swf";
this.autoPlay = options.autoPlay;
this.settings = {default: ['seekbar']};
this.settings.left = ["playpause", "position", "duration"];
this.settings.right = ["fullscreen", "volume"];
this.settings.seekEnabled = true;
this.isReady = false;
this.addListeners();
};
var $Flash = Flash;
($traceurRuntime.createClass)(Flash, {
get name() {
return 'flash';
},
get tagName() {
return 'object';
},
get template() {
return JST.flash;
},
bootstrap: function() {
this.el.width = "100%";
this.el.height = "100%";
this.isReady = true;
if (this.currentState === 'PLAYING') {
this.firstPlay();
} else {
this.currentState = "IDLE";
this.autoPlay && this.play();
}
$('<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%" />').insertAfter(this.$el);
this.trigger(Events.PLAYBACK_READY, this.name);
},
getPlaybackType: function() {
return 'vod';
},
setupFirefox: function() {
var $el = this.$('embed');
$el.attr('data-flash', '');
this.setElement($el[0]);
},
isHighDefinitionInUse: function() {
return false;
},
updateTime: function() {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.getPosition(), this.el.getDuration(), this.name);
},
addListeners: function() {
Mediator.on(this.uniqueId + ':progress', this.progress, this);
Mediator.on(this.uniqueId + ':timeupdate', this.updateTime, this);
Mediator.on(this.uniqueId + ':statechanged', this.checkState, this);
Mediator.on(this.uniqueId + ':flashready', this.bootstrap, this);
_.each(_.range(1, 10), function(i) {
var $__0 = this;
Mousetrap.bind([i.toString()], (function() {
return $__0.seek(i * 10);
}));
}.bind(this));
},
stopListening: function() {
$traceurRuntime.superCall(this, $Flash.prototype, "stopListening", []);
Mediator.off(this.uniqueId + ':progress');
Mediator.off(this.uniqueId + ':timeupdate');
Mediator.off(this.uniqueId + ':statechanged');
Mediator.off(this.uniqueId + ':flashready');
_.each(_.range(1, 10), function(i) {
var $__0 = this;
Mousetrap.unbind([i.toString()], (function() {
return $__0.seek(i * 10);
}));
}.bind(this));
},
checkState: function() {
if (this.currentState === "PAUSED") {
return;
} else if (this.currentState !== "PLAYING_BUFFERING" && this.el.getState() === "PLAYING_BUFFERING") {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
this.currentState = "PLAYING_BUFFERING";
} else if (this.el.getState() === "PLAYING") {
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
this.currentState = "PLAYING";
} else if (this.el.getState() === "IDLE") {
this.currentState = "IDLE";
} else if (this.el.getState() === "ENDED") {
this.trigger(Events.PLAYBACK_ENDED, this.name);
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.el.getDuration(), this.name);
this.currentState = "ENDED";
}
},
progress: function() {
if (this.currentState !== "IDLE" && this.currentState !== "ENDED") {
this.trigger(Events.PLAYBACK_PROGRESS, 0, this.el.getBytesLoaded(), this.el.getBytesTotal(), this.name);
}
},
firstPlay: function() {
var $__0 = this;
if (this.el.playerPlay) {
this.el.playerPlay(this.src);
this.listenToOnce(this, Events.PLAYBACK_BUFFERFULL, (function() {
return $__0.checkInitialSeek();
}));
this.currentState = "PLAYING";
} else {
this.listenToOnce(this, Events.PLAYBACK_READY, this.firstPlay);
}
},
checkInitialSeek: function() {
var seekTime = seekStringToSeconds(window.location.href);
if (seekTime !== 0) {
this.seekSeconds(seekTime);
}
},
play: function() {
if (this.el.getState() === 'PAUSED' || this.el.getState() === 'PLAYING_BUFFERING') {
this.currentState = "PLAYING";
this.el.playerResume();
} else if (this.el.getState() !== 'PLAYING') {
this.firstPlay();
}
this.trigger(Events.PLAYBACK_PLAY, this.name);
},
volume: function(value) {
var $__0 = this;
if (this.isReady) {
this.el.playerVolume(value);
} else {
this.listenToOnce(this, Events.PLAYBACK_BUFFERFULL, (function() {
return $__0.volume(value);
}));
}
},
pause: function() {
this.currentState = "PAUSED";
this.el.playerPause();
},
stop: function() {
this.el.playerStop();
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.name);
},
isPlaying: function() {
return !!(this.isReady && this.currentState.indexOf("PLAYING") > -1);
},
getDuration: function() {
return this.el.getDuration();
},
seek: function(seekBarValue) {
var seekTo = this.el.getDuration() * (seekBarValue / 100);
this.seekSeconds(seekTo);
},
seekSeconds: function(seekTo) {
this.el.playerSeek(seekTo);
this.trigger(Events.PLAYBACK_TIMEUPDATE, seekTo, this.el.getDuration(), this.name);
if (this.currentState === "PAUSED") {
this.el.playerPause();
}
},
destroy: function() {
clearInterval(this.bootstrapId);
this.stopListening();
this.$el.remove();
},
setupIE: function() {
this.setElement($(_.template(objectIE)({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
})));
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
}));
if (Browser.isFirefox) {
this.setupFirefox();
} else if (Browser.isLegacyIE) {
this.setupIE();
}
this.$el.append(style);
return this;
}
}, {}, Playback);
Flash.canPlay = function(resource) {
if ((!Browser.isMobile && Browser.isFirefox) || Browser.isLegacyIE) {
return _.isString(resource) && !!resource.match(/(.*)\.(mp4|mov|f4v|3gpp|3gp)/);
} else {
return _.isString(resource) && !!resource.match(/(.*)\.(mov|f4v|3gpp|3gp)/);
}
};
module.exports = Flash;
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"browser":"browser","events":"events","mediator":"mediator","mousetrap":4,"playback":"playback","underscore":"underscore","zepto":"zepto"}],25:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var JST = require('../../base/jst');
var _ = require("underscore");
var Mediator = require('mediator');
var Browser = require('browser');
var Events = require('events');
var objectIE = '<object type="application/x-shockwave-flash" id="<%= cid %>" class="hls-playback" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" data-hls="" width="100%" height="100%"><param name="movie" value="<%= swfPath %>"> <param name="quality" value="autohigh"> <param name="swliveconnect" value="true"> <param name="allowScriptAccess" value="always"> <param name="bgcolor" value="#001122"> <param name="allowFullScreen" value="false"> <param name="wmode" value="transparent"> <param name="tabindex" value="1"> <param name=FlashVars value="playbackId=<%= playbackId %>" /> </object>';
var HLS = function HLS(options) {
$traceurRuntime.superCall(this, $HLS.prototype, "constructor", [options]);
this.src = options.src;
this.defaultBaseSwfPath = "http://cdn.clappr.io/" + Clappr.version + "/assets/";
this.swfPath = (options.swfBasePath || this.defaultBaseSwfPath) + "HLSPlayer.swf";
this.flushLiveURLCache = (options.flushLiveURLCache === undefined) ? true : options.flushLiveURLCache;
this.capLevelToStage = (options.capLevelToStage === undefined) ? false : options.capLevelToStage;
this.highDefinition = false;
this.autoPlay = options.autoPlay;
this.defaultSettings = {
left: ["playstop"],
default: ['seekbar'],
right: ["fullscreen", "volume", "hd-indicator"],
seekEnabled: false
};
this.settings = _.extend({}, this.defaultSettings);
this.playbackType = 'live';
this.addListeners();
};
var $HLS = HLS;
($traceurRuntime.createClass)(HLS, {
get name() {
return 'hls';
},
get tagName() {
return 'object';
},
get template() {
return JST.hls;
},
get attributes() {
return {
'class': 'hls-playback',
'data-hls': '',
'type': 'application/x-shockwave-flash',
'width': '100%',
'height': '100%'
};
},
addListeners: function() {
var $__0 = this;
Mediator.on(this.uniqueId + ':flashready', (function() {
return $__0.bootstrap();
}));
Mediator.on(this.uniqueId + ':timeupdate', (function() {
return $__0.updateTime();
}));
Mediator.on(this.uniqueId + ':playbackstate', (function(state) {
return $__0.setPlaybackState(state);
}));
Mediator.on(this.uniqueId + ':highdefinition', (function(isHD) {
return $__0.updateHighDefinition(isHD);
}));
Mediator.on(this.uniqueId + ':playbackerror', (function() {
return $__0.flashPlaybackError();
}));
},
stopListening: function() {
$traceurRuntime.superCall(this, $HLS.prototype, "stopListening", []);
Mediator.off(this.uniqueId + ':flashready');
Mediator.off(this.uniqueId + ':timeupdate');
Mediator.off(this.uniqueId + ':playbackstate');
Mediator.off(this.uniqueId + ':highdefinition');
Mediator.off(this.uniqueId + ':playbackerror');
},
bootstrap: function() {
this.el.width = "100%";
this.el.height = "100%";
this.isReady = true;
this.trigger(Events.PLAYBACK_READY, this.name);
this.currentState = "IDLE";
this.setFlashSettings();
this.autoPlay && this.play();
},
setFlashSettings: function() {
this.el.globoPlayerSetflushLiveURLCache(this.flushLiveURLCache);
this.el.globoPlayerCapLeveltoStage(this.capLevelToStage);
this.el.globoPlayerSetmaxBufferLength(0);
},
updateHighDefinition: function(isHD) {
this.highDefinition = (isHD === "true");
this.trigger(Events.PLAYBACK_HIGHDEFINITIONUPDATE);
this.trigger(Events.PLAYBACK_BITRATE, {'bitrate': this.getCurrentBitrate()});
},
updateTime: function() {
var duration = this.getDuration();
var position = Math.min(Math.max(this.el.globoGetPosition(), 0), duration);
var previousDVRStatus = this.dvrEnabled;
var livePlayback = (this.playbackType === 'live');
this.dvrEnabled = (livePlayback && duration > 240);
if (duration === 100 || livePlayback === undefined) {
return;
}
if (this.dvrEnabled !== previousDVRStatus) {
this.updateSettings();
this.trigger(Events.PLAYBACK_SETTINGSUPDATE, this.name);
}
if (livePlayback && (!this.dvrEnabled || !this.dvrInUse)) {
position = duration;
}
this.trigger(Events.PLAYBACK_TIMEUPDATE, position, duration, this.name);
},
play: function() {
if (this.currentState === 'PAUSED') {
this.el.globoPlayerResume();
} else if (this.currentState !== "PLAYING") {
this.firstPlay();
}
this.trigger(Events.PLAYBACK_PLAY, this.name);
},
getPlaybackType: function() {
return this.playbackType ? this.playbackType : null;
},
getCurrentBitrate: function() {
var currentLevel = this.getLevels()[this.el.globoGetLevel()];
return currentLevel.bitrate;
},
getLastProgramDate: function() {
var programDate = this.el.globoGetLastProgramDate();
return programDate - 1.08e+7;
},
isHighDefinitionInUse: function() {
return this.highDefinition;
},
getLevels: function() {
if (!this.levels || this.levels.length === 0) {
this.levels = this.el.globoGetLevels();
}
return this.levels;
},
setPlaybackState: function(state) {
var bufferLength = this.el.globoGetbufferLength();
if (state === "PLAYING_BUFFERING" && bufferLength < 1) {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
this.updateCurrentState(state);
} else if (state === "PLAYING") {
if (_.contains(["PLAYING_BUFFERING", "PAUSED", "IDLE"], this.currentState)) {
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
this.updateCurrentState(state);
}
} else if (state === "PAUSED") {
this.updateCurrentState(state);
} else if (state === "IDLE") {
this.trigger(Events.PLAYBACK_ENDED, this.name);
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.el.globoGetDuration(), this.name);
this.updateCurrentState(state);
}
this.lastBufferLength = bufferLength;
},
updateCurrentState: function(state) {
this.currentState = state;
this.updatePlaybackType();
},
updatePlaybackType: function() {
this.playbackType = this.el.globoGetType();
if (this.playbackType) {
this.playbackType = this.playbackType.toLowerCase();
if (this.playbackType === 'vod') {
this.startReportingProgress();
} else {
this.stopReportingProgress();
}
}
this.trigger(Events.PLAYBACK_PLAYBACKSTATE);
},
startReportingProgress: function() {
if (!this.reportingProgress) {
this.reportingProgress = true;
Mediator.on(this.uniqueId + ':fragmentloaded', this.onFragmentLoaded);
}
},
stopReportingProgress: function() {
Mediator.off(this.uniqueId + ':fragmentloaded', this.onFragmentLoaded, this);
},
onFragmentLoaded: function() {
var buffered = this.el.globoGetPosition() + this.el.globoGetbufferLength();
this.trigger(Events.PLAYBACK_PROGRESS, this.el.globoGetPosition(), buffered, this.getDuration(), this.name);
},
firstPlay: function() {
this.setFlashSettings();
this.el.globoPlayerLoad(this.src);
this.el.globoPlayerPlay();
},
volume: function(value) {
var $__0 = this;
if (this.isReady) {
this.el.globoPlayerVolume(value);
} else {
this.listenToOnce(this, Events.PLAYBACK_BUFFERFULL, (function() {
return $__0.volume(value);
}));
}
},
pause: function() {
if (this.playbackType !== 'live' || this.dvrEnabled) {
this.el.globoPlayerPause();
if (this.playbackType === 'live' && this.dvrEnabled) {
this.updateDvr(true);
}
}
},
stop: function() {
this.el.globoPlayerStop();
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.name);
},
isPlaying: function() {
if (this.currentState) {
return !!(this.currentState.match(/playing/i));
}
return false;
},
getDuration: function() {
var duration = this.el.globoGetDuration();
if (this.playbackType === 'live') {
duration = duration - 10;
}
return duration;
},
seek: function(time) {
var duration = this.getDuration();
if (time > 0) {
time = duration * time / 100;
}
if (this.playbackType === 'live') {
var dvrInUse = (time >= 0 && duration - time > 5);
if (!dvrInUse) {
time = -1;
}
this.updateDvr(dvrInUse);
}
this.el.globoPlayerSeek(time);
this.trigger(Events.PLAYBACK_TIMEUPDATE, time, duration, this.name);
},
updateDvr: function(dvrInUse) {
var previousDvrInUse = !!this.dvrInUse;
this.dvrInUse = dvrInUse;
if (this.dvrInUse !== previousDvrInUse) {
this.updateSettings();
this.trigger(Events.PLAYBACK_DVR, this.dvrInUse);
this.trigger(Events.PLAYBACK_STATS_ADD, {'dvr': this.dvrInUse});
}
},
flashPlaybackError: function() {
this.trigger(Events.PLAYBACK_STOP);
},
timeUpdate: function(time, duration) {
this.trigger(Events.PLAYBACK_TIMEUPDATE, time, duration, this.name);
},
destroy: function() {
this.stopListening();
this.$el.remove();
},
setupFirefox: function() {
var $el = this.$('embed');
$el.attr('data-hls', '');
this.setElement($el);
},
setupIE: function() {
this.setElement($(_.template(objectIE)({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
})));
},
updateSettings: function() {
this.settings = _.extend({}, this.defaultSettings);
if (this.playbackType === "vod" || this.dvrInUse) {
this.settings.left = ["playpause", "position", "duration"];
this.settings.seekEnabled = true;
} else if (this.dvrEnabled) {
this.settings.left = ["playpause"];
this.settings.seekEnabled = true;
} else {
this.settings.seekEnabled = false;
}
},
setElement: function(element) {
this.$el = element;
this.el = element[0];
},
render: function() {
if (Browser.isLegacyIE) {
this.setupIE();
} else {
this.$el.html(this.template({
cid: this.cid,
swfPath: this.swfPath,
playbackId: this.uniqueId
}));
if (Browser.isFirefox) {
this.setupFirefox();
} else if (Browser.isIE) {
this.$('embed').remove();
}
}
this.el.id = this.cid;
return this;
}
}, {}, Playback);
HLS.canPlay = function(resource) {
return !!resource.match(/^http(.*).m3u8?/);
};
module.exports = HLS;
},{"../../base/jst":7,"browser":"browser","events":"events","mediator":"mediator","playback":"playback","underscore":"underscore"}],26:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var Events = require('events');
var HTML5Audio = function HTML5Audio(params) {
$traceurRuntime.superCall(this, $HTML5Audio.prototype, "constructor", [params]);
this.el.src = params.src;
this.settings = {
left: ['playpause', 'position', 'duration'],
right: ['fullscreen', 'volume'],
default: ['seekbar']
};
this.render();
params.autoPlay && this.play();
};
var $HTML5Audio = HTML5Audio;
($traceurRuntime.createClass)(HTML5Audio, {
get name() {
return 'html5_audio';
},
get tagName() {
return 'audio';
},
get events() {
return {
'timeupdate': 'timeUpdated',
'ended': 'ended',
'canplaythrough': 'bufferFull'
};
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_PLAY, this.play);
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.pause);
this.listenTo(this.container, Events.CONTAINER_SEEK, this.seek);
this.listenTo(this.container, Events.CONTAINER_VOLUME, this.volume);
this.listenTo(this.container, Events.CONTAINER_STOP, this.stop);
},
getPlaybackType: function() {
return "aod";
},
play: function() {
this.el.play();
this.trigger(Events.PLAYBACK_PLAY);
},
pause: function() {
this.el.pause();
},
stop: function() {
this.pause();
this.el.currentTime = 0;
},
volume: function(value) {
this.el.volume = value / 100;
},
mute: function() {
this.el.volume = 0;
},
unmute: function() {
this.el.volume = 1;
},
isMuted: function() {
return !!this.el.volume;
},
ended: function() {
this.trigger(Events.CONTAINER_TIMEUPDATE, 0);
},
seek: function(seekBarValue) {
var time = this.el.duration * (seekBarValue / 100);
this.el.currentTime = time;
},
getCurrentTime: function() {
return this.el.currentTime;
},
getDuration: function() {
return this.el.duration;
},
isPlaying: function() {
return !this.el.paused && !this.el.ended;
},
timeUpdated: function() {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.currentTime, this.el.duration, this.name);
},
bufferFull: function() {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.currentTime, this.el.duration, this.name);
this.trigger(Events.PLAYBACK_BUFFERFULL);
},
render: function() {
this.trigger(Events.PLAYBACK_READY, this.name);
return this;
}
}, {}, Playback);
HTML5Audio.canPlay = function(resource) {
return !!resource.match(/(.*).mp3/);
};
module.exports = HTML5Audio;
},{"events":"events","playback":"playback"}],27:[function(require,module,exports){
(function (process){
"use strict";
var Playback = require('playback');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var Browser = require('browser');
var seekStringToSeconds = require('../../base/utils').seekStringToSeconds;
var Events = require('events');
var _ = require('underscore');
require('mousetrap');
var HTML5Video = function HTML5Video(options) {
$traceurRuntime.superCall(this, $HTML5Video.prototype, "constructor", [options]);
this.options = options;
this.src = options.src;
this.el.src = options.src;
this.el.loop = options.loop;
this.firstBuffer = true;
this.isHLS = (this.src.indexOf('m3u8') > -1);
this.settings = {default: ['seekbar']};
if (this.isHLS && Browser.isSafari) {
this.settings.left = ["playstop"];
this.settings.right = ["fullscreen", "volume"];
} else {
this.el.preload = options.preload ? options.preload : 'metadata';
this.settings.left = ["playpause", "position", "duration"];
this.settings.right = ["fullscreen", "volume"];
this.settings.seekEnabled = true;
}
this.bindEvents();
};
var $HTML5Video = HTML5Video;
($traceurRuntime.createClass)(HTML5Video, {
get name() {
return 'html5_video';
},
get tagName() {
return 'video';
},
get template() {
return JST.html5_video;
},
get attributes() {
return {'data-html5-video': ''};
},
get events() {
return {
'timeupdate': 'timeUpdated',
'progress': 'progress',
'ended': 'ended',
'stalled': 'stalled',
'waiting': 'waiting',
'canplaythrough': 'bufferFull',
'loadedmetadata': 'loadedMetadata'
};
},
bindEvents: function() {
_.each(_.range(1, 10), function(i) {
var $__0 = this;
Mousetrap.bind([i.toString()], (function() {
return $__0.seek(i * 10);
}));
}.bind(this));
},
loadedMetadata: function(e) {
this.trigger(Events.PLAYBACK_LOADEDMETADATA, e.target.duration);
this.trigger(Events.PLAYBACK_SETTINGSUPDATE);
this.checkInitialSeek();
},
getPlaybackType: function() {
return this.isHLS && _.contains([0, undefined, Infinity], this.el.duration) ? 'live' : 'vod';
},
isHighDefinitionInUse: function() {
return false;
},
play: function() {
this.el.play();
this.trigger(Events.PLAYBACK_PLAY);
if (this.isHLS) {
this.trigger(Events.PLAYBACK_TIMEUPDATE, 1, 1, this.name);
}
},
pause: function() {
this.el.pause();
},
stop: function() {
this.pause();
if (this.el.readyState !== 0) {
this.el.currentTime = 0;
}
},
volume: function(value) {
this.el.volume = value / 100;
},
mute: function() {
this.el.volume = 0;
},
unmute: function() {
this.el.volume = 1;
},
isMuted: function() {
return !!this.el.volume;
},
isPlaying: function() {
return !this.el.paused && !this.el.ended;
},
ended: function() {
this.trigger(Events.PLAYBACK_ENDED, this.name);
this.trigger(Events.PLAYBACK_TIMEUPDATE, 0, this.el.duration, this.name);
},
stalled: function() {
if (this.getPlaybackType() === 'vod' && this.el.readyState < this.el.HAVE_FUTURE_DATA) {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
}
},
waiting: function() {
if (this.el.readyState < this.el.HAVE_FUTURE_DATA) {
this.trigger(Events.PLAYBACK_BUFFERING, this.name);
}
},
bufferFull: function() {
if (this.options.poster && this.firstBuffer) {
this.firstBuffer = false;
if (!this.isPlaying()) {
this.el.poster = this.options.poster;
}
} else {
this.el.poster = '';
}
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
},
destroy: function() {
this.stop();
this.el.src = '';
this.$el.remove();
},
seek: function(seekBarValue) {
var time = this.el.duration * (seekBarValue / 100);
this.seekSeconds(time);
},
seekSeconds: function(time) {
this.el.currentTime = time;
},
checkInitialSeek: function() {
var seekTime = seekStringToSeconds(window.location.href);
this.seekSeconds(seekTime);
},
getCurrentTime: function() {
return this.el.currentTime;
},
getDuration: function() {
return this.el.duration;
},
timeUpdated: function() {
if (this.getPlaybackType() !== 'live') {
this.trigger(Events.PLAYBACK_TIMEUPDATE, this.el.currentTime, this.el.duration, this.name);
}
},
progress: function() {
if (!this.el.buffered.length)
return;
var bufferedPos = 0;
for (var i = 0; i < this.el.buffered.length; i++) {
if (this.el.currentTime >= this.el.buffered.start(i) && this.el.currentTime <= this.el.buffered.end(i)) {
bufferedPos = i;
break;
}
}
this.trigger(Events.PLAYBACK_PROGRESS, this.el.buffered.start(bufferedPos), this.el.buffered.end(bufferedPos), this.el.duration, this.name);
},
typeFor: function(src) {
return (src.indexOf('.m3u8') > 0) ? 'application/vnd.apple.mpegurl' : 'video/mp4';
},
render: function() {
var $__0 = this;
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template({
src: this.src,
type: this.typeFor(this.src)
}));
this.$el.append(style);
this.trigger(Events.PLAYBACK_READY, this.name);
process.nextTick((function() {
return $__0.options.autoPlay && $__0.play();
}));
return this;
}
}, {}, Playback);
HTML5Video.canPlay = function(resource) {
var mimetypes = {
'mp4': _.map(["avc1.42E01E", "avc1.58A01E", "avc1.4D401E", "avc1.64001E", "mp4v.20.8", "mp4v.20.240"], function(codec) {
return 'video/mp4; codecs=' + codec + ', mp4a.40.2';
}),
'ogg': ['video/ogg; codecs="theora, vorbis"', 'video/ogg; codecs="dirac"', 'video/ogg; codecs="theora, speex"'],
'3gpp': ['video/3gpp; codecs="mp4v.20.8, samr"'],
'webm': ['video/webm; codecs="vp8, vorbis"'],
'mkv': ['video/x-matroska; codecs="theora, vorbis"'],
'm3u8': ['application/x-mpegURL']
};
mimetypes['ogv'] = mimetypes['ogg'];
mimetypes['3gp'] = mimetypes['3gpp'];
var extension = resource.split('?')[0].match(/.*\.(.*)$/)[1];
if (_.has(mimetypes, extension)) {
var v = document.createElement('video');
return !!_.find(mimetypes[extension], function(ext) {
return !!v.canPlayType(ext).replace(/no/, '');
});
}
return false;
};
module.exports = HTML5Video;
}).call(this,require('_process'))
},{"../../base/jst":7,"../../base/styler":8,"../../base/utils":9,"_process":2,"browser":"browser","events":"events","mousetrap":4,"playback":"playback","underscore":"underscore"}],28:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var HTMLImg = function HTMLImg(params) {
$traceurRuntime.superCall(this, $HTMLImg.prototype, "constructor", [params]);
this.el.src = params.src;
setTimeout(function() {
this.trigger(Events.PLAYBACK_BUFFERFULL, this.name);
}.bind(this), 1);
};
var $HTMLImg = HTMLImg;
($traceurRuntime.createClass)(HTMLImg, {
get name() {
return 'html_img';
},
get tagName() {
return 'img';
},
get attributes() {
return {'data-html-img': ''};
},
getPlaybackType: function() {
return null;
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.append(style);
return this;
}
}, {}, Playback);
HTMLImg.canPlay = function(resource) {
return !!resource.match(/(.*).(png|jpg|jpeg|gif|bmp)/);
};
module.exports = HTMLImg;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","playback":"playback"}],29:[function(require,module,exports){
"use strict";
module.exports = require('./no_op');
},{"./no_op":30}],30:[function(require,module,exports){
"use strict";
var Playback = require('playback');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var NoOp = function NoOp(options) {
$traceurRuntime.superCall(this, $NoOp.prototype, "constructor", [options]);
};
var $NoOp = NoOp;
($traceurRuntime.createClass)(NoOp, {
get name() {
return 'no_op';
},
get template() {
return JST.no_op;
},
get attributes() {
return {'data-no-op': ''};
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
return this;
}
}, {}, Playback);
NoOp.canPlay = (function(source) {
return true;
});
module.exports = NoOp;
},{"../../base/jst":7,"../../base/styler":8,"playback":"playback"}],31:[function(require,module,exports){
(function (process){
"use strict";
var UICorePlugin = require('ui_core_plugin');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var Events = require('events');
var Browser = require('browser');
var Mediator = require('mediator');
var PlayerInfo = require('player_info');
var BackgroundButton = function BackgroundButton(core) {
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "constructor", [core]);
this.core = core;
this.settingsUpdate();
};
var $BackgroundButton = BackgroundButton;
($traceurRuntime.createClass)(BackgroundButton, {
get template() {
return JST.background_button;
},
get name() {
return 'background_button';
},
get attributes() {
return {
'class': 'background-button',
'data-background-button': ''
};
},
get events() {
return {'click .background-button-icon': 'click'};
},
bindEvents: function() {
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_STATE_BUFFERING, this.hide);
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_STATE_BUFFERFULL, this.show);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.settingsUpdate);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_SHOW, this.updateSize);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_PLAYING, this.playing);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_NOTPLAYING, this.notplaying);
Mediator.on(Events.PLAYER_RESIZE, this.updateSize, this);
},
stopListening: function() {
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "stopListening", []);
Mediator.off(Events.PLAYER_RESIZE, this.updateSize, this);
},
settingsUpdate: function() {
this.stopListening();
if (this.shouldRender()) {
this.render();
this.bindEvents();
if (this.core.mediaControl.container.isPlaying()) {
this.playing();
} else {
this.notplaying();
}
} else {
this.$el.remove();
this.$playPauseButton.show();
this.$playStopButton.show();
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.settingsUpdate);
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.settingsUpdate);
}
},
shouldRender: function() {
var useBackgroundButton = (this.core.options.useBackgroundButton === undefined && Browser.isMobile) || !!this.core.options.useBackgroundButton;
return useBackgroundButton && (this.core.mediaControl.$el.find('[data-playstop]').length > 0 || this.core.mediaControl.$el.find('[data-playpause]').length > 0);
},
click: function() {
this.core.mediaControl.show();
if (this.shouldStop) {
this.core.mediaControl.togglePlayStop();
} else {
this.core.mediaControl.togglePlayPause();
}
},
show: function() {
this.$el.removeClass('hide');
},
hide: function() {
this.$el.addClass('hide');
},
enable: function() {
this.stopListening();
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "enable", []);
this.settingsUpdate();
},
disable: function() {
$traceurRuntime.superCall(this, $BackgroundButton.prototype, "disable", []);
this.$playPauseButton.show();
this.$playStopButton.show();
},
playing: function() {
this.$buttonIcon.removeClass('notplaying').addClass('playing');
},
notplaying: function() {
this.$buttonIcon.removeClass('playing').addClass('notplaying');
},
getExternalInterface: function() {},
updateSize: function() {
if (!this.$el)
return;
var height = PlayerInfo.currentSize ? PlayerInfo.currentSize.height : this.$el.height();
this.$el.css({fontSize: height});
this.$buttonWrapper.css({marginTop: -(this.$buttonWrapper.height() / 2)});
},
render: function() {
var $__0 = this;
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
this.$playPauseButton = this.core.mediaControl.$el.find('[data-playpause]');
this.$playStopButton = this.core.mediaControl.$el.find('[data-playstop]');
this.$buttonWrapper = this.$el.find('.background-button-wrapper[data-background-button]');
this.$buttonIcon = this.$el.find('.background-button-icon[data-background-button]');
this.shouldStop = this.$playStopButton.length > 0;
this.$el.insertBefore(this.core.mediaControl.$el.find('.media-control-layer[data-controls]'));
this.$el.click((function() {
return $__0.click($__0.$el);
}));
process.nextTick((function() {
return $__0.updateSize();
}));
if (this.core.options.useBackgroundButton) {
this.$playPauseButton.hide();
this.$playStopButton.hide();
}
if (this.shouldStop) {
this.$buttonIcon.addClass('playstop');
}
if (this.core.mediaControl.isVisible()) {
this.show();
}
return this;
}
}, {}, UICorePlugin);
module.exports = BackgroundButton;
}).call(this,require('_process'))
},{"../../base/jst":7,"../../base/styler":8,"_process":2,"browser":"browser","events":"events","mediator":"mediator","player_info":"player_info","ui_core_plugin":"ui_core_plugin"}],32:[function(require,module,exports){
"use strict";
module.exports = require('./background_button');
},{"./background_button":31}],33:[function(require,module,exports){
"use strict";
var ContainerPlugin = require('container_plugin');
var Events = require('events');
var ClickToPausePlugin = function ClickToPausePlugin() {
$traceurRuntime.defaultSuperCall(this, $ClickToPausePlugin.prototype, arguments);
};
var $ClickToPausePlugin = ClickToPausePlugin;
($traceurRuntime.createClass)(ClickToPausePlugin, {
get name() {
return 'click_to_pause';
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_CLICK, this.click);
this.listenTo(this.container, Events.CONTAINER_SETTINGSUPDATE, this.settingsUpdate);
},
click: function() {
if (this.container.getPlaybackType() !== 'live' || this.container.isDvrEnabled()) {
if (this.container.isPlaying()) {
this.container.pause();
} else {
this.container.play();
}
}
},
settingsUpdate: function() {
this.container.$el.removeClass('pointer-enabled');
if (this.container.getPlaybackType() !== 'live' || this.container.isDvrEnabled()) {
this.container.$el.addClass('pointer-enabled');
}
}
}, {}, ContainerPlugin);
module.exports = ClickToPausePlugin;
},{"container_plugin":"container_plugin","events":"events"}],34:[function(require,module,exports){
"use strict";
module.exports = require('./click_to_pause');
},{"./click_to_pause":33}],35:[function(require,module,exports){
"use strict";
var UICorePlugin = require('ui_core_plugin');
var JST = require('../../base/jst');
var Styler = require('../../base/styler');
var Events = require('events');
var DVRControls = function DVRControls(core) {
$traceurRuntime.superCall(this, $DVRControls.prototype, "constructor", [core]);
this.core = core;
this.settingsUpdate();
};
var $DVRControls = DVRControls;
($traceurRuntime.createClass)(DVRControls, {
get template() {
return JST.dvr_controls;
},
get name() {
return 'dvr_controls';
},
get events() {
return {'click .live-button': 'click'};
},
get attributes() {
return {
'class': 'dvr-controls',
'data-dvr-controls': ''
};
},
bindEvents: function() {
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.settingsUpdate);
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
},
dvrChanged: function(dvrEnabled) {
this.settingsUpdate();
this.core.mediaControl.$el.addClass('live');
if (dvrEnabled) {
this.core.mediaControl.$el.addClass('dvr');
this.core.mediaControl.$el.find('.media-control-indicator[data-position], .media-control-indicator[data-duration]').hide();
} else {
this.core.mediaControl.$el.removeClass('dvr');
}
},
click: function() {
if (!this.core.mediaControl.container.isPlaying()) {
this.core.mediaControl.container.play();
}
if (this.core.mediaControl.$el.hasClass('dvr')) {
this.core.mediaControl.container.setCurrentTime(-1);
}
},
settingsUpdate: function() {
var $__0 = this;
this.stopListening();
if (this.shouldRender()) {
this.render();
this.$el.click((function() {
return $__0.click();
}));
}
this.bindEvents();
},
shouldRender: function() {
var useDvrControls = this.core.options.useDvrControls === undefined || !!this.core.options.useDvrControls;
return useDvrControls && this.core.mediaControl.container.getPlaybackType() === 'live';
},
render: function() {
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
if (this.shouldRender()) {
this.core.mediaControl.$el.addClass('live');
this.core.mediaControl.$('.media-control-left-panel[data-media-control]').append(this.$el);
if (this.$duration) {
this.$duration.remove();
}
this.$duration = $('<span data-duration></span>');
this.core.mediaControl.seekTime.$el.append(this.$duration);
}
return this;
}
}, {}, UICorePlugin);
module.exports = DVRControls;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","ui_core_plugin":"ui_core_plugin"}],36:[function(require,module,exports){
"use strict";
module.exports = require('./dvr_controls');
},{"./dvr_controls":35}],37:[function(require,module,exports){
"use strict";
var ContainerPlugin = require('container_plugin');
var Events = require('events');
var GoogleAnalytics = function GoogleAnalytics(options) {
$traceurRuntime.superCall(this, $GoogleAnalytics.prototype, "constructor", [options]);
if (options.gaAccount) {
this.embedScript();
this.account = options.gaAccount;
this.trackerName = options.gaTrackerName + "." || 'Clappr.';
this.currentHDState = undefined;
}
};
var $GoogleAnalytics = GoogleAnalytics;
($traceurRuntime.createClass)(GoogleAnalytics, {
get name() {
return 'google_analytics';
},
embedScript: function() {
var $__0 = this;
if (!window._gat) {
var script = document.createElement('script');
script.setAttribute("type", "text/javascript");
script.setAttribute("async", "async");
script.setAttribute("src", "http://www.google-analytics.com/ga.js");
script.onload = (function() {
return $__0.addEventListeners();
});
document.body.appendChild(script);
} else {
this.addEventListeners();
}
},
addEventListeners: function() {
var $__0 = this;
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onEnded);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onEnded);
this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError);
this.listenTo(this.container, Events.CONTAINER_PLAYBACKSTATE, this.onPlaybackChanged);
this.listenTo(this.container, Events.CONTAINER_VOLUME, (function(event) {
return $__0.onVolumeChanged(event);
}));
this.listenTo(this.container, Events.CONTAINER_SEEK, (function(event) {
return $__0.onSeek(event);
}));
this.listenTo(this.container, Events.CONTAINER_FULL_SCREEN, this.onFullscreen);
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.onHD);
this.listenTo(this.container.playback, Events.PLAYBACK_DVR, this.onDVR);
_gaq.push([this.trackerName + '_setAccount', this.account]);
},
onPlay: function() {
this.push(["Video", "Play", this.container.playback.src]);
},
onStop: function() {
this.push(["Video", "Stop", this.container.playback.src]);
},
onEnded: function() {
this.push(["Video", "Ended", this.container.playback.src]);
},
onBuffering: function() {
this.push(["Video", "Buffering", this.container.playback.src]);
},
onBufferFull: function() {
this.push(["Video", "Bufferfull", this.container.playback.src]);
},
onError: function() {
this.push(["Video", "Error", this.container.playback.src]);
},
onHD: function() {
var status = this.container.isHighDefinitionInUse() ? "ON" : "OFF";
if (status !== this.currentHDState) {
this.currentHDState = status;
this.push(["Video", "HD - " + status, this.container.playback.src]);
}
},
onPlaybackChanged: function() {
var type = this.container.getPlaybackType();
if (type !== null) {
this.push(["Video", "Playback Type - " + type, this.container.playback.src]);
}
},
onDVR: function() {
var status = this.container.isHighDefinitionInUse();
this.push(["Interaction", "DVR - " + status, this.container.playback.src]);
},
onPause: function() {
this.push(["Video", "Pause", this.container.playback.src]);
},
onSeek: function() {
this.push(["Video", "Seek", this.container.playback.src]);
},
onVolumeChanged: function() {
this.push(["Interaction", "Volume", this.container.playback.src]);
},
onFullscreen: function() {
this.push(["Interaction", "Fullscreen", this.container.playback.src]);
},
push: function(array) {
var res = [this.trackerName + "_trackEvent"].concat(array);
_gaq.push(res);
}
}, {}, ContainerPlugin);
module.exports = GoogleAnalytics;
},{"container_plugin":"container_plugin","events":"events"}],38:[function(require,module,exports){
"use strict";
module.exports = require('./google_analytics');
},{"./google_analytics":37}],39:[function(require,module,exports){
"use strict";
module.exports = require('./log');
},{"./log":40}],40:[function(require,module,exports){
"use strict";
var _ = require('underscore');
require('mousetrap');
var Log = function Log() {
var $__0 = this;
Mousetrap.bind(['ctrl+shift+d'], (function() {
return $__0.onOff();
}));
this.BLACKLIST = ['playback:timeupdate', 'playback:progress', 'container:hover', 'container:timeupdate', 'container:progress'];
};
($traceurRuntime.createClass)(Log, {
info: function(klass, message) {
this.log(klass, 'info', message);
},
warn: function(klass, message) {
this.log(klass, 'warn', message);
},
debug: function(klass, message) {
this.log(klass, 'debug', message);
},
onOff: function() {
window.DEBUG = !window.DEBUG;
if (window.DEBUG) {
console.log('log enabled');
} else {
console.log('log disabled');
}
},
log: function(klass, level, message) {
if (!window.DEBUG || _.contains(this.BLACKLIST, message))
return;
var color;
if (level === 'warn') {
color = '#FF8000';
} else if (level === 'info') {
color = '#006600';
} else if (level === 'error') {
color = '#FF0000';
}
console.log("%c [" + klass + "] [" + level + "] " + message, 'color: ' + color);
}
}, {});
Log.getInstance = function() {
if (this._instance === undefined) {
this._instance = new this();
}
return this._instance;
};
module.exports = Log;
},{"mousetrap":4,"underscore":"underscore"}],41:[function(require,module,exports){
(function (process){
"use strict";
var UIContainerPlugin = require('ui_container_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var Mediator = require('mediator');
var PlayerInfo = require('player_info');
var $ = require('zepto');
var _ = require('underscore');
var PosterPlugin = function PosterPlugin(options) {
$traceurRuntime.superCall(this, $PosterPlugin.prototype, "constructor", [options]);
this.options = options;
_.defaults(this.options, {disableControlsOnPoster: true});
if (this.options.disableControlsOnPoster) {
this.container.disableMediaControl();
}
this.render();
};
var $PosterPlugin = PosterPlugin;
($traceurRuntime.createClass)(PosterPlugin, {
get name() {
return 'poster';
},
get template() {
return JST.poster;
},
get attributes() {
return {
'class': 'player-poster',
'data-poster': ''
};
},
get events() {
return {'click': 'clicked'};
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferfull);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onStop);
Mediator.on(Events.PLAYER_RESIZE, this.updateSize, this);
},
stopListening: function() {
$traceurRuntime.superCall(this, $PosterPlugin.prototype, "stopListening", []);
Mediator.off(Events.PLAYER_RESIZE, this.updateSize, this);
},
onBuffering: function() {
this.hidePlayButton();
},
onBufferfull: function() {
this.$el.hide();
if (this.options.disableControlsOnPoster) {
this.container.enableMediaControl();
}
},
onStop: function() {
this.$el.show();
if (this.options.disableControlsOnPoster) {
this.container.disableMediaControl();
}
if (!this.options.hidePlayButton) {
this.showPlayButton();
}
},
hidePlayButton: function() {
this.$playButton.hide();
},
showPlayButton: function() {
this.$playButton.show();
this.updateSize();
},
clicked: function() {
this.container.play();
return false;
},
updateSize: function() {
if (!this.$el)
return;
var height = PlayerInfo.currentSize ? PlayerInfo.currentSize.height : this.$el.height();
this.$el.css({fontSize: height});
if (this.$playWrapper.is(':visible')) {
this.$playWrapper.css({marginTop: -(this.$playWrapper.height() / 2)});
if (!this.options.hidePlayButton) {
this.$playButton.show();
}
} else {
this.$playButton.hide();
}
},
render: function() {
var $__0 = this;
var style = Styler.getStyleFor(this.name);
this.$el.html(this.template());
this.$el.append(style);
this.$playButton = this.$el.find('.poster-icon');
this.$playWrapper = this.$el.find('.play-wrapper');
if (this.options.poster !== undefined) {
var imgEl = $('<img data-poster class="poster-background"></img>');
imgEl.attr('src', this.options.poster);
this.$el.prepend(imgEl);
}
this.container.$el.append(this.el);
if (!!this.options.hidePlayButton) {
this.hidePlayButton();
}
process.nextTick((function() {
return $__0.updateSize();
}));
return this;
}
}, {}, UIContainerPlugin);
module.exports = PosterPlugin;
}).call(this,require('_process'))
},{"../../base/jst":7,"../../base/styler":8,"_process":2,"events":"events","mediator":"mediator","player_info":"player_info","ui_container_plugin":"ui_container_plugin","underscore":"underscore","zepto":"zepto"}],42:[function(require,module,exports){
"use strict";
module.exports = require('./spinner_three_bounce');
},{"./spinner_three_bounce":43}],43:[function(require,module,exports){
"use strict";
var UIContainerPlugin = require('ui_container_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var SpinnerThreeBouncePlugin = function SpinnerThreeBouncePlugin(options) {
$traceurRuntime.superCall(this, $SpinnerThreeBouncePlugin.prototype, "constructor", [options]);
this.template = JST.spinner_three_bounce;
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.render();
};
var $SpinnerThreeBouncePlugin = SpinnerThreeBouncePlugin;
($traceurRuntime.createClass)(SpinnerThreeBouncePlugin, {
get name() {
return 'spinner';
},
get attributes() {
return {
'data-spinner': '',
'class': 'spinner-three-bounce'
};
},
onBuffering: function() {
this.$el.show();
},
onBufferFull: function() {
this.$el.hide();
},
onStop: function() {
this.$el.hide();
},
render: function() {
this.$el.html(this.template());
var style = Styler.getStyleFor('spinner_three_bounce');
this.container.$el.append(style);
this.container.$el.append(this.$el);
this.$el.hide();
return this;
}
}, {}, UIContainerPlugin);
module.exports = SpinnerThreeBouncePlugin;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","ui_container_plugin":"ui_container_plugin"}],44:[function(require,module,exports){
"use strict";
module.exports = require('./stats');
},{"./stats":45}],45:[function(require,module,exports){
"use strict";
var ContainerPlugin = require('container_plugin');
var $ = require("zepto");
var Events = require('events');
var StatsPlugin = function StatsPlugin(options) {
$traceurRuntime.superCall(this, $StatsPlugin.prototype, "constructor", [options]);
this.setInitialAttrs();
this.reportInterval = options.reportInterval || 5000;
this.state = "IDLE";
};
var $StatsPlugin = StatsPlugin;
($traceurRuntime.createClass)(StatsPlugin, {
get name() {
return 'stats';
},
bindEvents: function() {
this.listenTo(this.container.playback, Events.PLAYBACK_PLAY, this.onPlay);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
this.listenTo(this.container, Events.CONTAINER_DESTROYED, this.onStop);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
this.listenTo(this.container, Events.CONTAINER_STATS_ADD, this.onStatsAdd);
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onStatsAdd);
this.listenTo(this.container.playback, Events.PLAYBACK_STATS_ADD, this.onStatsAdd);
},
setInitialAttrs: function() {
this.firstPlay = true;
this.startupTime = 0;
this.rebufferingTime = 0;
this.watchingTime = 0;
this.rebuffers = 0;
this.externalMetrics = {};
},
onPlay: function() {
this.state = "PLAYING";
this.watchingTimeInit = Date.now();
if (!this.intervalId) {
this.intervalId = setInterval(this.report.bind(this), this.reportInterval);
}
},
onStop: function() {
clearInterval(this.intervalId);
this.intervalId = undefined;
this.state = "STOPPED";
},
onBuffering: function() {
if (this.firstPlay) {
this.startupTimeInit = Date.now();
} else {
this.rebufferingTimeInit = Date.now();
}
this.state = "BUFFERING";
this.rebuffers++;
},
onBufferFull: function() {
if (this.firstPlay && !!this.startupTimeInit) {
this.firstPlay = false;
this.startupTime = Date.now() - this.startupTimeInit;
this.watchingTimeInit = Date.now();
} else if (!!this.rebufferingTimeInit) {
this.rebufferingTime += this.getRebufferingTime();
}
this.rebufferingTimeInit = undefined;
this.state = "PLAYING";
},
getRebufferingTime: function() {
return Date.now() - this.rebufferingTimeInit;
},
getWatchingTime: function() {
var totalTime = (Date.now() - this.watchingTimeInit);
return totalTime - this.rebufferingTime;
},
isRebuffering: function() {
return !!this.rebufferingTimeInit;
},
onStatsAdd: function(metric) {
$.extend(this.externalMetrics, metric);
},
getStats: function() {
var metrics = {
startupTime: this.startupTime,
rebuffers: this.rebuffers,
rebufferingTime: this.isRebuffering() ? this.rebufferingTime + this.getRebufferingTime() : this.rebufferingTime,
watchingTime: this.isRebuffering() ? this.getWatchingTime() - this.getRebufferingTime() : this.getWatchingTime()
};
$.extend(metrics, this.externalMetrics);
return metrics;
},
report: function() {
this.container.statsReport(this.getStats());
}
}, {}, ContainerPlugin);
module.exports = StatsPlugin;
},{"container_plugin":"container_plugin","events":"events","zepto":"zepto"}],46:[function(require,module,exports){
"use strict";
module.exports = require('./watermark');
},{"./watermark":47}],47:[function(require,module,exports){
"use strict";
var UIContainerPlugin = require('ui_container_plugin');
var Styler = require('../../base/styler');
var JST = require('../../base/jst');
var Events = require('events');
var WaterMarkPlugin = function WaterMarkPlugin(options) {
$traceurRuntime.superCall(this, $WaterMarkPlugin.prototype, "constructor", [options]);
this.template = JST[this.name];
this.position = options.position || "bottom-right";
if (options.watermark) {
this.imageUrl = options.watermark;
this.render();
} else {
this.$el.remove();
}
};
var $WaterMarkPlugin = WaterMarkPlugin;
($traceurRuntime.createClass)(WaterMarkPlugin, {
get name() {
return 'watermark';
},
bindEvents: function() {
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
},
onPlay: function() {
if (!this.hidden)
this.$el.show();
},
onStop: function() {
this.$el.hide();
},
render: function() {
this.$el.hide();
var templateOptions = {
position: this.position,
imageUrl: this.imageUrl
};
this.$el.html(this.template(templateOptions));
var style = Styler.getStyleFor(this.name);
this.container.$el.append(style);
this.container.$el.append(this.$el);
return this;
}
}, {}, UIContainerPlugin);
module.exports = WaterMarkPlugin;
},{"../../base/jst":7,"../../base/styler":8,"events":"events","ui_container_plugin":"ui_container_plugin"}],"base_object":[function(require,module,exports){
"use strict";
var _ = require('underscore');
var extend = require('./utils').extend;
var Events = require('events');
var pluginOptions = ['container'];
var BaseObject = function BaseObject(options) {
this.uniqueId = _.uniqueId('o');
options || (options = {});
_.extend(this, _.pick(options, pluginOptions));
};
($traceurRuntime.createClass)(BaseObject, {}, {}, Events);
BaseObject.extend = extend;
module.exports = BaseObject;
},{"./utils":9,"events":"events","underscore":"underscore"}],"browser":[function(require,module,exports){
"use strict";
var Browser = function Browser() {};
($traceurRuntime.createClass)(Browser, {}, {});
var hasLocalstorage = function() {
try {
localStorage.setItem('clappr', 'clappr');
localStorage.removeItem('clappr');
return true;
} catch (e) {
return false;
}
};
Browser.isSafari = (!!navigator.userAgent.match(/safari/i) && navigator.userAgent.indexOf('Chrome') === -1);
Browser.isChrome = !!(navigator.userAgent.match(/chrome/i));
Browser.isFirefox = !!(navigator.userAgent.match(/firefox/i));
Browser.isLegacyIE = !!(window.ActiveXObject);
Browser.isIE = Browser.isLegacyIE || !!(navigator.userAgent.match(/trident.*rv:1\d/i));
Browser.isIE11 = !!(navigator.userAgent.match(/trident.*rv:11/i));
Browser.isMobile = !!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Opera Mini/i.test(navigator.userAgent));
Browser.isWin8App = !!(/MSAppHost/i.test(navigator.userAgent));
Browser.isWiiU = !!(/WiiU/i.test(navigator.userAgent));
Browser.isPS4 = !!(/PlayStation 4/i.test(navigator.userAgent));
Browser.hasLocalstorage = hasLocalstorage();
module.exports = Browser;
},{}],"container_plugin":[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var ContainerPlugin = function ContainerPlugin(options) {
$traceurRuntime.superCall(this, $ContainerPlugin.prototype, "constructor", [options]);
this.bindEvents();
};
var $ContainerPlugin = ContainerPlugin;
($traceurRuntime.createClass)(ContainerPlugin, {
enable: function() {
this.bindEvents();
},
disable: function() {
this.stopListening();
},
bindEvents: function() {},
destroy: function() {
this.stopListening();
}
}, {}, BaseObject);
module.exports = ContainerPlugin;
},{"base_object":"base_object"}],"container":[function(require,module,exports){
"use strict";
module.exports = require('./container');
},{"./container":10}],"core_plugin":[function(require,module,exports){
"use strict";
var BaseObject = require('base_object');
var CorePlugin = function CorePlugin(core) {
$traceurRuntime.superCall(this, $CorePlugin.prototype, "constructor", [core]);
this.core = core;
};
var $CorePlugin = CorePlugin;
($traceurRuntime.createClass)(CorePlugin, {
getExternalInterface: function() {
return {};
},
destroy: function() {}
}, {}, BaseObject);
module.exports = CorePlugin;
},{"base_object":"base_object"}],"core":[function(require,module,exports){
"use strict";
module.exports = require('./core');
},{"./core":13}],"events":[function(require,module,exports){
"use strict";
var _ = require('underscore');
var Log = require('../plugins/log').getInstance();
var slice = Array.prototype.slice;
var Events = function Events() {};
($traceurRuntime.createClass)(Events, {
on: function(name, callback, context) {
if (!eventsApi(this, 'on', name, [callback, context]) || !callback)
return this;
this._events || (this._events = {});
var events = this._events[name] || (this._events[name] = []);
events.push({
callback: callback,
context: context,
ctx: context || this
});
return this;
},
once: function(name, callback, context) {
if (!eventsApi(this, 'once', name, [callback, context]) || !callback)
return this;
var self = this;
var once = _.once(function() {
self.off(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
return this.on(name, once, context);
},
off: function(name, callback, context) {
var retain,
ev,
events,
names,
i,
l,
j,
k;
if (!this._events || !eventsApi(this, 'off', name, [callback, context]))
return this;
if (!name && !callback && !context) {
this._events = void 0;
return this;
}
names = name ? [name] : _.keys(this._events);
for (i = 0, l = names.length; i < l; i++) {
name = names[i];
events = this._events[name];
if (events) {
this._events[name] = retain = [];
if (callback || context) {
for (j = 0, k = events.length; j < k; j++) {
ev = events[j];
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) || (context && context !== ev.context)) {
retain.push(ev);
}
}
}
if (!retain.length)
delete this._events[name];
}
}
return this;
},
trigger: function(name) {
var klass = arguments[arguments.length - 1];
Log.info(klass, name);
if (!this._events)
return this;
var args = slice.call(arguments, 1);
if (!eventsApi(this, 'trigger', name, args))
return this;
var events = this._events[name];
var allEvents = this._events.all;
if (events)
triggerEvents(events, args);
if (allEvents)
triggerEvents(allEvents, arguments);
return this;
},
stopListening: function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo)
return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object')
callback = this;
if (obj)
(listeningTo = {})[obj._listenId] = obj;
for (var id in listeningTo) {
obj = listeningTo[id];
obj.off(name, callback, this);
if (remove || _.isEmpty(obj._events))
delete this._listeningTo[id];
}
return this;
}
}, {});
var eventSplitter = /\s+/;
var eventsApi = function(obj, action, name, rest) {
if (!name)
return true;
if (typeof name === 'object') {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
if (eventSplitter.test(name)) {
var names = name.split(eventSplitter);
for (var i = 0,
l = names.length; i < l; i++) {
obj[action].apply(obj, [names[i]].concat(rest));
}
return false;
}
return true;
};
var triggerEvents = function(events, args) {
var ev,
i = -1,
l = events.length,
a1 = args[0],
a2 = args[1],
a3 = args[2];
switch (args.length) {
case 0:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx);
return;
case 1:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx, a1);
return;
case 2:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx, a1, a2);
return;
case 3:
while (++i < l)
(ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
return;
default:
while (++i < l)
(ev = events[i]).callback.apply(ev.ctx, args);
return;
}
};
var listenMethods = {
listenTo: 'on',
listenToOnce: 'once'
};
_.each(listenMethods, function(implementation, method) {
Events.prototype[method] = function(obj, name, callback) {
var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
listeningTo[id] = obj;
if (!callback && typeof name === 'object')
callback = this;
obj[implementation](name, callback, this);
return this;
};
});
Events.PLAYER_RESIZE = 'player:resize';
Events.PLAYBACK_PROGRESS = 'playback:progress';
Events.PLAYBACK_TIMEUPDATE = 'playback:timeupdate';
Events.PLAYBACK_READY = 'playback:ready';
Events.PLAYBACK_BUFFERING = 'playback:buffering';
Events.PLAYBACK_BUFFERFULL = 'playback:bufferfull';
Events.PLAYBACK_SETTINGSUPDATE = 'playback:settingsupdate';
Events.PLAYBACK_LOADEDMETADATA = 'playback:loadedmetadata';
Events.PLAYBACK_HIGHDEFINITIONUPDATE = 'playback:highdefinitionupdate';
Events.PLAYBACK_BITRATE = 'playback:bitrate';
Events.PLAYBACK_PLAYBACKSTATE = 'playback:playbackstate';
Events.PLAYBACK_DVR = 'playback:dvr';
Events.PLAYBACK_MEDIACONTROL_DISABLE = 'playback:mediacontrol:disable';
Events.PLAYBACK_MEDIACONTROL_ENABLE = 'playback:mediacontrol:enable';
Events.PLAYBACK_ENDED = 'playback:ended';
Events.PLAYBACK_PLAY = 'playback:play';
Events.PLAYBACK_ERROR = 'playback:error';
Events.PLAYBACK_STATS_ADD = 'playback:stats:add';
Events.CONTAINER_PLAYBACKSTATE = 'container:playbackstate';
Events.CONTAINER_PLAYBACKDVRSTATECHANGED = 'container:dvr';
Events.CONTAINER_BITRATE = 'container:bitrate';
Events.CONTAINER_STATS_REPORT = 'container:stats:report';
Events.CONTAINER_DESTROYED = 'container:destroyed';
Events.CONTAINER_READY = 'container:ready';
Events.CONTAINER_ERROR = 'container:error';
Events.CONTAINER_LOADEDMETADATA = 'container:loadedmetadata';
Events.CONTAINER_TIMEUPDATE = 'container:timeupdate';
Events.CONTAINER_PROGRESS = 'container:progress';
Events.CONTAINER_PLAY = 'container:play';
Events.CONTAINER_STOP = 'container:stop';
Events.CONTAINER_PAUSE = 'container:pause';
Events.CONTAINER_ENDED = 'container:ended';
Events.CONTAINER_CLICK = 'container:click';
Events.CONTAINER_SEEK = 'container:seek';
Events.CONTAINER_VOLUME = 'container:volume';
Events.CONTAINER_FULLSCREEN = 'container:fullscreen';
Events.CONTAINER_STATE_BUFFERING = 'container:state:buffering';
Events.CONTAINER_STATE_BUFFERFULL = 'container:state:bufferfull';
Events.CONTAINER_SETTINGSUPDATE = 'container:settingsupdate';
Events.CONTAINER_HIGHDEFINITIONUPDATE = 'container:highdefinitionupdate';
Events.CONTAINER_MEDIACONTROL_DISABLE = 'container:mediacontrol:disable';
Events.CONTAINER_MEDIACONTROL_ENABLE = 'container:mediacontrol:enable';
Events.CONTAINER_STATS_ADD = 'container:stats:add';
Events.MEDIACONTROL_RENDERED = 'mediacontrol:rendered';
Events.MEDIACONTROL_FULLSCREEN = 'mediacontrol:fullscreen';
Events.MEDIACONTROL_SHOW = 'mediacontrol:show';
Events.MEDIACONTROL_HIDE = 'mediacontrol:hide';
Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR = 'mediacontrol:mousemove:seekbar';
Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR = 'mediacontrol:mouseleave:seekbar';
Events.MEDIACONTROL_PLAYING = 'mediacontrol:playing';
Events.MEDIACONTROL_NOTPLAYING = 'mediacontrol:notplaying';
Events.MEDIACONTROL_CONTAINERCHANGED = 'mediacontrol:containerchanged';
module.exports = Events;
},{"../plugins/log":39,"underscore":"underscore"}],"flash":[function(require,module,exports){
"use strict";
module.exports = require('./flash');
},{"./flash":24}],"hls":[function(require,module,exports){
"use strict";
module.exports = require('./hls');
},{"./hls":25}],"html5_audio":[function(require,module,exports){
"use strict";
module.exports = require('./html5_audio');
},{"./html5_audio":26}],"html5_video":[function(require,module,exports){
"use strict";
module.exports = require('./html5_video');
},{"./html5_video":27}],"html_img":[function(require,module,exports){
"use strict";
module.exports = require('./html_img');
},{"./html_img":28}],"media_control":[function(require,module,exports){
"use strict";
module.exports = require('./media_control');
},{"./media_control":20}],"mediator":[function(require,module,exports){
"use strict";
var Events = require('events');
var events = new Events();
var Mediator = function Mediator() {};
($traceurRuntime.createClass)(Mediator, {}, {});
Mediator.on = function(name, callback, context) {
events.on(name, callback, context);
return;
};
Mediator.once = function(name, callback, context) {
events.once(name, callback, context);
return;
};
Mediator.off = function(name, callback, context) {
events.off(name, callback, context);
return;
};
Mediator.trigger = function(name, opts) {
events.trigger(name, opts);
return;
};
Mediator.stopListening = function(obj, name, callback) {
events.stopListening(obj, name, callback);
return;
};
module.exports = Mediator;
},{"events":"events"}],"playback":[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var Playback = function Playback(options) {
$traceurRuntime.superCall(this, $Playback.prototype, "constructor", [options]);
this.settings = {};
};
var $Playback = Playback;
($traceurRuntime.createClass)(Playback, {
play: function() {},
pause: function() {},
stop: function() {},
seek: function(time) {},
getDuration: function() {
return 0;
},
isPlaying: function() {
return false;
},
getPlaybackType: function() {
return 'no_op';
},
isHighDefinitionInUse: function() {
return false;
},
volume: function(value) {},
destroy: function() {
this.$el.remove();
}
}, {}, UIObject);
Playback.canPlay = (function(source) {
return false;
});
module.exports = Playback;
},{"ui_object":"ui_object"}],"player_info":[function(require,module,exports){
"use strict";
var PlayerInfo = {
options: {},
playbackPlugins: [],
currentSize: {
width: 0,
height: 0
}
};
module.exports = PlayerInfo;
},{}],"poster":[function(require,module,exports){
"use strict";
module.exports = require('./poster');
},{"./poster":41}],"ui_container_plugin":[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var UIContainerPlugin = function UIContainerPlugin(options) {
$traceurRuntime.superCall(this, $UIContainerPlugin.prototype, "constructor", [options]);
this.enabled = true;
this.bindEvents();
};
var $UIContainerPlugin = UIContainerPlugin;
($traceurRuntime.createClass)(UIContainerPlugin, {
enable: function() {
this.bindEvents();
this.$el.show();
this.enabled = true;
},
disable: function() {
this.stopListening();
this.$el.hide();
this.enabled = false;
},
bindEvents: function() {},
destroy: function() {
this.remove();
}
}, {}, UIObject);
module.exports = UIContainerPlugin;
},{"ui_object":"ui_object"}],"ui_core_plugin":[function(require,module,exports){
"use strict";
var UIObject = require('ui_object');
var UICorePlugin = function UICorePlugin(core) {
$traceurRuntime.superCall(this, $UICorePlugin.prototype, "constructor", [core]);
this.core = core;
this.enabled = true;
this.bindEvents();
this.render();
};
var $UICorePlugin = UICorePlugin;
($traceurRuntime.createClass)(UICorePlugin, {
bindEvents: function() {},
getExternalInterface: function() {
return {};
},
enable: function() {
this.bindEvents();
this.$el.show();
this.enabled = true;
},
disable: function() {
this.stopListening();
this.$el.hide();
this.enabled = false;
},
destroy: function() {
this.remove();
},
render: function() {
this.$el.html(this.template());
this.$el.append(this.styler.getStyleFor(this.name));
this.core.$el.append(this.el);
return this;
}
}, {}, UIObject);
module.exports = UICorePlugin;
},{"ui_object":"ui_object"}],"ui_object":[function(require,module,exports){
"use strict";
var $ = require('zepto');
var _ = require('underscore');
var extend = require('./utils').extend;
var BaseObject = require('base_object');
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
var UIObject = function UIObject(options) {
$traceurRuntime.superCall(this, $UIObject.prototype, "constructor", [options]);
this.cid = _.uniqueId('c');
this._ensureElement();
this.delegateEvents();
};
var $UIObject = UIObject;
($traceurRuntime.createClass)(UIObject, {
get tagName() {
return 'div';
},
$: function(selector) {
return this.$el.find(selector);
},
render: function() {
return this;
},
remove: function() {
this.$el.remove();
this.stopListening();
return this;
},
setElement: function(element, delegate) {
if (this.$el)
this.undelegateEvents();
this.$el = element instanceof $ ? element : $(element);
this.el = this.$el[0];
if (delegate !== false)
this.delegateEvents();
return this;
},
delegateEvents: function(events) {
if (!(events || (events = _.result(this, 'events'))))
return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (!_.isFunction(method))
method = this[events[key]];
if (!method)
continue;
var match = key.match(delegateEventSplitter);
var eventName = match[1],
selector = match[2];
method = _.bind(method, this);
eventName += '.delegateEvents' + this.cid;
if (selector === '') {
this.$el.on(eventName, method);
} else {
this.$el.on(eventName, selector, method);
}
}
return this;
},
undelegateEvents: function() {
this.$el.off('.delegateEvents' + this.cid);
return this;
},
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id)
attrs.id = _.result(this, 'id');
if (this.className)
attrs['class'] = _.result(this, 'className');
var $el = $('<' + _.result(this, 'tagName') + '>').attr(attrs);
this.setElement($el, false);
} else {
this.setElement(_.result(this, 'el'), false);
}
}
}, {}, BaseObject);
UIObject.extend = extend;
module.exports = UIObject;
},{"./utils":9,"base_object":"base_object","underscore":"underscore","zepto":"zepto"}],"underscore":[function(require,module,exports){
// Underscore.js 1.7.0
// http://underscorejs.org
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `exports` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var
push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root._ = _;
}
// Current version.
_.VERSION = '1.7.0';
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
var createCallback = function(func, context, argCount) {
if (context === void 0) return func;
switch (argCount == null ? 3 : argCount) {
case 1: return function(value) {
return func.call(context, value);
};
case 2: return function(value, other) {
return func.call(context, value, other);
};
case 3: return function(value, index, collection) {
return func.call(context, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
return function() {
return func.apply(context, arguments);
};
};
// A mostly-internal function to generate callbacks that can be applied
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
_.iteratee = function(value, context, argCount) {
if (value == null) return _.identity;
if (_.isFunction(value)) return createCallback(value, context, argCount);
if (_.isObject(value)) return _.matches(value);
return _.property(value);
};
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles raw objects in addition to array-likes. Treats all
// sparse array-likes as if they were dense.
_.each = _.forEach = function(obj, iteratee, context) {
if (obj == null) return obj;
iteratee = createCallback(iteratee, context);
var i, length = obj.length;
if (length === +length) {
for (i = 0; i < length; i++) {
iteratee(obj[i], i, obj);
}
} else {
var keys = _.keys(obj);
for (i = 0, length = keys.length; i < length; i++) {
iteratee(obj[keys[i]], keys[i], obj);
}
}
return obj;
};
// Return the results of applying the iteratee to each element.
_.map = _.collect = function(obj, iteratee, context) {
if (obj == null) return [];
iteratee = _.iteratee(iteratee, context);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
results = Array(length),
currentKey;
for (var index = 0; index < length; index++) {
currentKey = keys ? keys[index] : index;
results[index] = iteratee(obj[currentKey], currentKey, obj);
}
return results;
};
var reduceError = 'Reduce of empty array with no initial value';
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`.
_.reduce = _.foldl = _.inject = function(obj, iteratee, memo, context) {
if (obj == null) obj = [];
iteratee = createCallback(iteratee, context, 4);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
index = 0, currentKey;
if (arguments.length < 3) {
if (!length) throw new TypeError(reduceError);
memo = obj[keys ? keys[index++] : index++];
}
for (; index < length; index++) {
currentKey = keys ? keys[index] : index;
memo = iteratee(memo, obj[currentKey], currentKey, obj);
}
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
_.reduceRight = _.foldr = function(obj, iteratee, memo, context) {
if (obj == null) obj = [];
iteratee = createCallback(iteratee, context, 4);
var keys = obj.length !== + obj.length && _.keys(obj),
index = (keys || obj).length,
currentKey;
if (arguments.length < 3) {
if (!index) throw new TypeError(reduceError);
memo = obj[keys ? keys[--index] : --index];
}
while (index--) {
currentKey = keys ? keys[index] : index;
memo = iteratee(memo, obj[currentKey], currentKey, obj);
}
return memo;
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, predicate, context) {
var result;
predicate = _.iteratee(predicate, context);
_.some(obj, function(value, index, list) {
if (predicate(value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Aliased as `select`.
_.filter = _.select = function(obj, predicate, context) {
var results = [];
if (obj == null) return results;
predicate = _.iteratee(predicate, context);
_.each(obj, function(value, index, list) {
if (predicate(value, index, list)) results.push(value);
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, predicate, context) {
return _.filter(obj, _.negate(_.iteratee(predicate)), context);
};
// Determine whether all of the elements match a truth test.
// Aliased as `all`.
_.every = _.all = function(obj, predicate, context) {
if (obj == null) return true;
predicate = _.iteratee(predicate, context);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
index, currentKey;
for (index = 0; index < length; index++) {
currentKey = keys ? keys[index] : index;
if (!predicate(obj[currentKey], currentKey, obj)) return false;
}
return true;
};
// Determine if at least one element in the object matches a truth test.
// Aliased as `any`.
_.some = _.any = function(obj, predicate, context) {
if (obj == null) return false;
predicate = _.iteratee(predicate, context);
var keys = obj.length !== +obj.length && _.keys(obj),
length = (keys || obj).length,
index, currentKey;
for (index = 0; index < length; index++) {
currentKey = keys ? keys[index] : index;
if (predicate(obj[currentKey], currentKey, obj)) return true;
}
return false;
};
// Determine if the array or object contains a given value (using `===`).
// Aliased as `include`.
_.contains = _.include = function(obj, target) {
if (obj == null) return false;
if (obj.length !== +obj.length) obj = _.values(obj);
return _.indexOf(obj, target) >= 0;
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
var isFunc = _.isFunction(method);
return _.map(obj, function(value) {
return (isFunc ? method : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, _.property(key));
};
// Convenience version of a common use case of `filter`: selecting only objects
// containing specific `key:value` pairs.
_.where = function(obj, attrs) {
return _.filter(obj, _.matches(attrs));
};
// Convenience version of a common use case of `find`: getting the first object
// containing specific `key:value` pairs.
_.findWhere = function(obj, attrs) {
return _.find(obj, _.matches(attrs));
};
// Return the maximum element (or element-based computation).
_.max = function(obj, iteratee, context) {
var result = -Infinity, lastComputed = -Infinity,
value, computed;
if (iteratee == null && obj != null) {
obj = obj.length === +obj.length ? obj : _.values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value > result) {
result = value;
}
}
} else {
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index, list) {
computed = iteratee(value, index, list);
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
result = value;
lastComputed = computed;
}
});
}
return result;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iteratee, context) {
var result = Infinity, lastComputed = Infinity,
value, computed;
if (iteratee == null && obj != null) {
obj = obj.length === +obj.length ? obj : _.values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value < result) {
result = value;
}
}
} else {
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index, list) {
computed = iteratee(value, index, list);
if (computed < lastComputed || computed === Infinity && result === Infinity) {
result = value;
lastComputed = computed;
}
});
}
return result;
};
// Shuffle a collection, using the modern version of the
// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
_.shuffle = function(obj) {
var set = obj && obj.length === +obj.length ? obj : _.values(obj);
var length = set.length;
var shuffled = Array(length);
for (var index = 0, rand; index < length; index++) {
rand = _.random(0, index);
if (rand !== index) shuffled[index] = shuffled[rand];
shuffled[rand] = set[index];
}
return shuffled;
};
// Sample **n** random values from a collection.
// If **n** is not specified, returns a single random element.
// The internal `guard` argument allows it to work with `map`.
_.sample = function(obj, n, guard) {
if (n == null || guard) {
if (obj.length !== +obj.length) obj = _.values(obj);
return obj[_.random(obj.length - 1)];
}
return _.shuffle(obj).slice(0, Math.max(0, n));
};
// Sort the object's values by a criterion produced by an iteratee.
_.sortBy = function(obj, iteratee, context) {
iteratee = _.iteratee(iteratee, context);
return _.pluck(_.map(obj, function(value, index, list) {
return {
value: value,
index: index,
criteria: iteratee(value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
}), 'value');
};
// An internal function used for aggregate "group by" operations.
var group = function(behavior) {
return function(obj, iteratee, context) {
var result = {};
iteratee = _.iteratee(iteratee, context);
_.each(obj, function(value, index) {
var key = iteratee(value, index, obj);
behavior(result, value, key);
});
return result;
};
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = group(function(result, value, key) {
if (_.has(result, key)) result[key].push(value); else result[key] = [value];
});
// Indexes the object's values by a criterion, similar to `groupBy`, but for
// when you know that your index values will be unique.
_.indexBy = group(function(result, value, key) {
result[key] = value;
});
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
_.countBy = group(function(result, value, key) {
if (_.has(result, key)) result[key]++; else result[key] = 1;
});
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iteratee, context) {
iteratee = _.iteratee(iteratee, context, 1);
var value = iteratee(obj);
var low = 0, high = array.length;
while (low < high) {
var mid = low + high >>> 1;
if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
}
return low;
};
// Safely create a real, live array from anything iterable.
_.toArray = function(obj) {
if (!obj) return [];
if (_.isArray(obj)) return slice.call(obj);
if (obj.length === +obj.length) return _.map(obj, _.identity);
return _.values(obj);
};
// Return the number of elements in an object.
_.size = function(obj) {
if (obj == null) return 0;
return obj.length === +obj.length ? obj.length : _.keys(obj).length;
};
// Split a collection into two arrays: one whose elements all satisfy the given
// predicate, and one whose elements all do not satisfy the predicate.
_.partition = function(obj, predicate, context) {
predicate = _.iteratee(predicate, context);
var pass = [], fail = [];
_.each(obj, function(value, key, obj) {
(predicate(value, key, obj) ? pass : fail).push(value);
});
return [pass, fail];
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
_.first = _.head = _.take = function(array, n, guard) {
if (array == null) return void 0;
if (n == null || guard) return array[0];
if (n < 0) return [];
return slice.call(array, 0, n);
};
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
_.initial = function(array, n, guard) {
return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
_.last = function(array, n, guard) {
if (array == null) return void 0;
if (n == null || guard) return array[array.length - 1];
return slice.call(array, Math.max(array.length - n, 0));
};
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
// Especially useful on the arguments object. Passing an **n** will return
// the rest N values in the array. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = _.drop = function(array, n, guard) {
return slice.call(array, n == null || guard ? 1 : n);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, _.identity);
};
// Internal implementation of a recursive `flatten` function.
var flatten = function(input, shallow, strict, output) {
if (shallow && _.every(input, _.isArray)) {
return concat.apply(output, input);
}
for (var i = 0, length = input.length; i < length; i++) {
var value = input[i];
if (!_.isArray(value) && !_.isArguments(value)) {
if (!strict) output.push(value);
} else if (shallow) {
push.apply(output, value);
} else {
flatten(value, shallow, strict, output);
}
}
return output;
};
// Flatten out an array, either recursively (by default), or just one level.
_.flatten = function(array, shallow) {
return flatten(array, shallow, false, []);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iteratee, context) {
if (array == null) return [];
if (!_.isBoolean(isSorted)) {
context = iteratee;
iteratee = isSorted;
isSorted = false;
}
if (iteratee != null) iteratee = _.iteratee(iteratee, context);
var result = [];
var seen = [];
for (var i = 0, length = array.length; i < length; i++) {
var value = array[i];
if (isSorted) {
if (!i || seen !== value) result.push(value);
seen = value;
} else if (iteratee) {
var computed = iteratee(value, i, array);
if (_.indexOf(seen, computed) < 0) {
seen.push(computed);
result.push(value);
}
} else if (_.indexOf(result, value) < 0) {
result.push(value);
}
}
return result;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(flatten(arguments, true, true, []));
};
// Produce an array that contains every item shared between all the
// passed-in arrays.
_.intersection = function(array) {
if (array == null) return [];
var result = [];
var argsLength = arguments.length;
for (var i = 0, length = array.length; i < length; i++) {
var item = array[i];
if (_.contains(result, item)) continue;
for (var j = 1; j < argsLength; j++) {
if (!_.contains(arguments[j], item)) break;
}
if (j === argsLength) result.push(item);
}
return result;
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = flatten(slice.call(arguments, 1), true, true, []);
return _.filter(array, function(value){
return !_.contains(rest, value);
});
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function(array) {
if (array == null) return [];
var length = _.max(arguments, 'length').length;
var results = Array(length);
for (var i = 0; i < length; i++) {
results[i] = _.pluck(arguments, i);
}
return results;
};
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
_.object = function(list, values) {
if (list == null) return {};
var result = {};
for (var i = 0, length = list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
};
// Return the position of the first occurrence of an item in an array,
// or -1 if the item is not included in the array.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = function(array, item, isSorted) {
if (array == null) return -1;
var i = 0, length = array.length;
if (isSorted) {
if (typeof isSorted == 'number') {
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
} else {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
}
for (; i < length; i++) if (array[i] === item) return i;
return -1;
};
_.lastIndexOf = function(array, item, from) {
if (array == null) return -1;
var idx = array.length;
if (typeof from == 'number') {
idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1);
}
while (--idx >= 0) if (array[idx] === item) return idx;
return -1;
};
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = step || 1;
var length = Math.max(Math.ceil((stop - start) / step), 0);
var range = Array(length);
for (var idx = 0; idx < length; idx++, start += step) {
range[idx] = start;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Reusable constructor function for prototype setting.
var Ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
_.bind = function(func, context) {
var args, bound;
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
args = slice.call(arguments, 2);
bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
Ctor.prototype = func.prototype;
var self = new Ctor;
Ctor.prototype = null;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (_.isObject(result)) return result;
return self;
};
return bound;
};
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context. _ acts
// as a placeholder, allowing any combination of arguments to be pre-filled.
_.partial = function(func) {
var boundArgs = slice.call(arguments, 1);
return function() {
var position = 0;
var args = boundArgs.slice();
for (var i = 0, length = args.length; i < length; i++) {
if (args[i] === _) args[i] = arguments[position++];
}
while (position < arguments.length) args.push(arguments[position++]);
return func.apply(this, args);
};
};
// Bind a number of an object's methods to that object. Remaining arguments
// are the method names to be bound. Useful for ensuring that all callbacks
// defined on an object belong to it.
_.bindAll = function(obj) {
var i, length = arguments.length, key;
if (length <= 1) throw new Error('bindAll must be passed function names');
for (i = 1; i < length; i++) {
key = arguments[i];
obj[key] = _.bind(obj[key], obj);
}
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memoize = function(key) {
var cache = memoize.cache;
var address = hasher ? hasher.apply(this, arguments) : key;
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
return cache[address];
};
memoize.cache = {};
return memoize;
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){
return func.apply(null, args);
}, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = function(func) {
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leading edge, pass
// `{leading: false}`. To disable execution on the trailing edge, ditto.
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
if (!options) options = {};
var later = function() {
previous = options.leading === false ? 0 : _.now();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;
};
return function() {
var now = _.now();
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
clearTimeout(timeout);
timeout = null;
previous = now;
result = func.apply(context, args);
if (!timeout) context = args = null;
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
_.debounce = function(func, wait, immediate) {
var timeout, args, context, timestamp, result;
var later = function() {
var last = _.now() - timestamp;
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
};
return function() {
context = this;
args = arguments;
timestamp = _.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return _.partial(wrapper, func);
};
// Returns a negated version of the passed-in predicate.
_.negate = function(predicate) {
return function() {
return !predicate.apply(this, arguments);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var args = arguments;
var start = args.length - 1;
return function() {
var i = start;
var result = args[start].apply(this, arguments);
while (i--) result = args[i].call(this, result);
return result;
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
// Returns a function that will only be executed before being called N times.
_.before = function(times, func) {
var memo;
return function() {
if (--times > 0) {
memo = func.apply(this, arguments);
} else {
func = null;
}
return memo;
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = _.partial(_.before, 2);
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = function(obj) {
if (!_.isObject(obj)) return [];
if (nativeKeys) return nativeKeys(obj);
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys.push(key);
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var values = Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[keys[i]];
}
return values;
};
// Convert an object into a list of `[key, value]` pairs.
_.pairs = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var pairs = Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [keys[i], obj[keys[i]]];
}
return pairs;
};
// Invert the keys and values of an object. The values must be serializable.
_.invert = function(obj) {
var result = {};
var keys = _.keys(obj);
for (var i = 0, length = keys.length; i < length; i++) {
result[obj[keys[i]]] = keys[i];
}
return result;
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = function(obj) {
if (!_.isObject(obj)) return obj;
var source, prop;
for (var i = 1, length = arguments.length; i < length; i++) {
source = arguments[i];
for (prop in source) {
if (hasOwnProperty.call(source, prop)) {
obj[prop] = source[prop];
}
}
}
return obj;
};
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(obj, iteratee, context) {
var result = {}, key;
if (obj == null) return result;
if (_.isFunction(iteratee)) {
iteratee = createCallback(iteratee, context);
for (key in obj) {
var value = obj[key];
if (iteratee(value, key, obj)) result[key] = value;
}
} else {
var keys = concat.apply([], slice.call(arguments, 1));
obj = new Object(obj);
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
if (key in obj) result[key] = obj[key];
}
}
return result;
};
// Return a copy of the object without the blacklisted properties.
_.omit = function(obj, iteratee, context) {
if (_.isFunction(iteratee)) {
iteratee = _.negate(iteratee);
} else {
var keys = _.map(concat.apply([], slice.call(arguments, 1)), String);
iteratee = function(value, key) {
return !_.contains(keys, key);
};
}
return _.pick(obj, iteratee, context);
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
if (!_.isObject(obj)) return obj;
for (var i = 1, length = arguments.length; i < length; i++) {
var source = arguments[i];
for (var prop in source) {
if (obj[prop] === void 0) obj[prop] = source[prop];
}
}
return obj;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a === 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className !== toString.call(b)) return false;
switch (className) {
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
case '[object RegExp]':
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return '' + a === '' + b;
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive.
// Object(NaN) is equivalent to NaN
if (+a !== +a) return +b !== +b;
// An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a === +b;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] === a) return bStack[length] === b;
}
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (
aCtor !== bCtor &&
// Handle Object.create(x) cases
'constructor' in a && 'constructor' in b &&
!(_.isFunction(aCtor) && aCtor instanceof aCtor &&
_.isFunction(bCtor) && bCtor instanceof bCtor)
) {
return false;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size, result;
// Recursively compare objects and arrays.
if (className === '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size === b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
var keys = _.keys(a), key;
size = keys.length;
// Ensure that both objects contain the same number of properties before comparing deep equality.
result = _.keys(b).length === size;
if (result) {
while (size--) {
// Deep compare each member
key = keys[size];
if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
}
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
};
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b, [], []);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (obj == null) return true;
if (_.isArray(obj) || _.isString(obj) || _.isArguments(obj)) return obj.length === 0;
for (var key in obj) if (_.has(obj, key)) return false;
return true;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType === 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) === '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
var type = typeof obj;
return type === 'function' || type === 'object' && !!obj;
};
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) === '[object ' + name + ']';
};
});
// Define a fallback version of the method in browsers (ahem, IE), where
// there isn't any inspectable "Arguments" type.
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return _.has(obj, 'callee');
};
}
// Optimize `isFunction` if appropriate. Work around an IE 11 bug.
if (typeof /./ !== 'function') {
_.isFunction = function(obj) {
return typeof obj == 'function' || false;
};
}
// Is a given object a finite number?
_.isFinite = function(obj) {
return isFinite(obj) && !isNaN(parseFloat(obj));
};
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
return _.isNumber(obj) && obj !== +obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Shortcut function for checking if an object has a given property directly
// on itself (in other words, not on a prototype).
_.has = function(obj, key) {
return obj != null && hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iteratees.
_.identity = function(value) {
return value;
};
_.constant = function(value) {
return function() {
return value;
};
};
_.noop = function(){};
_.property = function(key) {
return function(obj) {
return obj[key];
};
};
// Returns a predicate for checking whether an object has a given set of `key:value` pairs.
_.matches = function(attrs) {
var pairs = _.pairs(attrs), length = pairs.length;
return function(obj) {
if (obj == null) return !length;
obj = new Object(obj);
for (var i = 0; i < length; i++) {
var pair = pairs[i], key = pair[0];
if (pair[1] !== obj[key] || !(key in obj)) return false;
}
return true;
};
};
// Run a function **n** times.
_.times = function(n, iteratee, context) {
var accum = Array(Math.max(0, n));
iteratee = createCallback(iteratee, context, 1);
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
return accum;
};
// Return a random integer between min and max (inclusive).
_.random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
};
// A (possibly faster) way to get the current timestamp as an integer.
_.now = Date.now || function() {
return new Date().getTime();
};
// List of HTML entities for escaping.
var escapeMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'`': '`'
};
var unescapeMap = _.invert(escapeMap);
// Functions for escaping and unescaping strings to/from HTML interpolation.
var createEscaper = function(map) {
var escaper = function(match) {
return map[match];
};
// Regexes for identifying a key that needs to be escaped
var source = '(?:' + _.keys(map).join('|') + ')';
var testRegexp = RegExp(source);
var replaceRegexp = RegExp(source, 'g');
return function(string) {
string = string == null ? '' : '' + string;
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
};
};
_.escape = createEscaper(escapeMap);
_.unescape = createEscaper(unescapeMap);
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property) {
if (object == null) return void 0;
var value = object[property];
return _.isFunction(value) ? object[property]() : value;
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /(.)^/;
// Certain characters need to be escaped so that they can be put into a
// string literal.
var escapes = {
"'": "'",
'\\': '\\',
'\r': 'r',
'\n': 'n',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
var escapeChar = function(match) {
return '\\' + escapes[match];
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
// NB: `oldSettings` only exists for backwards compatibility.
_.template = function(text, settings, oldSettings) {
if (!settings && oldSettings) settings = oldSettings;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
var matcher = RegExp([
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source
].join('|') + '|$', 'g');
// Compile the template source, escaping string literals appropriately.
var index = 0;
var source = "__p+='";
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset).replace(escaper, escapeChar);
index = offset + match.length;
if (escape) {
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
} else if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
} else if (evaluate) {
source += "';\n" + evaluate + "\n__p+='";
}
// Adobe VMs need the match returned to produce the correct offest.
return match;
});
source += "';\n";
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + 'return __p;\n';
try {
var render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
var template = function(data) {
return render.call(this, data, _);
};
// Provide the compiled source as a convenience for precompilation.
var argument = settings.variable || 'obj';
template.source = 'function(' + argument + '){\n' + source + '}';
return template;
};
// Add a "chain" function. Start chaining a wrapped Underscore object.
_.chain = function(obj) {
var instance = _(obj);
instance._chain = true;
return instance;
};
// OOP
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
// Helper function to continue chaining intermediate results.
var result = function(obj) {
return this._chain ? _(obj).chain() : obj;
};
// Add your own custom functions to the Underscore object.
_.mixin = function(obj) {
_.each(_.functions(obj), function(name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
push.apply(args, arguments);
return result.call(this, func.apply(_, args));
};
});
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
_.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
var obj = this._wrapped;
method.apply(obj, arguments);
if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
return result.call(this, obj);
};
});
// Add all accessor Array functions to the wrapper.
_.each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
return result.call(this, method.apply(this._wrapped, arguments));
};
});
// Extracts the result from a wrapped and chained object.
_.prototype.value = function() {
return this._wrapped;
};
// AMD registration happens at the end for compatibility with AMD loaders
// that may not enforce next-turn semantics on modules. Even though general
// practice for AMD registration is to be anonymous, underscore registers
// as a named module because, like jQuery, it is a base library that is
// popular enough to be bundled in a third party lib, but not be part of
// an AMD load request. Those cases could generate an error when an
// anonymous define() is called outside of a loader request.
if (typeof define === 'function' && define.amd) {
define('underscore', [], function() {
return _;
});
}
}.call(this));
},{}],"zepto":[function(require,module,exports){
/* Zepto v1.1.4-76-g2bd5d7a - zepto event ajax callbacks deferred touch selector - zeptojs.com/license */
var Zepto=function(){function D(t){return null==t?String(t):j[S.call(t)]||"object"}function L(t){return"function"==D(t)}function k(t){return null!=t&&t==t.window}function Z(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function $(t){return"object"==D(t)}function F(t){return $(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function R(t){return"number"==typeof t.length}function q(t){return s.call(t,function(t){return null!=t})}function W(t){return t.length>0?n.fn.concat.apply([],t):t}function z(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function H(t){return t in c?c[t]:c[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||l[z(t)]?e:e+"px"}function I(t){var e,n;return f[t]||(e=u.createElement(t),u.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),f[t]=n),f[t]}function U(t){return"children"in t?a.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,i=t?t.length:0;for(n=0;i>n;n++)this[n]=t[n];this.length=i,this.selector=e||""}function B(n,i,r){for(e in i)r&&(F(i[e])||A(i[e]))?(F(i[e])&&!F(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),B(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function V(t,e){return null==e?n(t):n(t).filter(e)}function Y(t,e,n,i){return L(e)?e.call(t,n,i):e}function J(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function G(e,n){var i=e.className||"",r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function K(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?n.parseJSON(t):t):t}catch(e){return t}}function Q(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)Q(t.childNodes[n],e)}var t,e,n,i,N,P,r=[],o=r.concat,s=r.filter,a=r.slice,u=window.document,f={},c={},l={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},h=/^\s*<(\w+|!)[^>]*>/,p=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,d=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,m=/^(?:body|html)$/i,g=/([A-Z])/g,v=["val","css","html","text","data","width","height","offset"],y=["after","prepend","before","append"],w=u.createElement("table"),x=u.createElement("tr"),b={tr:u.createElement("tbody"),tbody:w,thead:w,tfoot:w,td:x,th:x,"*":u.createElement("div")},E=/complete|loaded|interactive/,T=/^[\w-]*$/,j={},S=j.toString,C={},O=u.createElement("div"),M={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return C.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~C.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},N=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},C.fragment=function(e,i,r){var o,s,f;return p.test(e)&&(o=n(u.createElement(RegExp.$1))),o||(e.replace&&(e=e.replace(d,"<$1></$2>")),i===t&&(i=h.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,o=n.each(a.call(f.childNodes),function(){f.removeChild(this)})),F(r)&&(s=n(o),n.each(r,function(t,e){v.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},C.Z=function(t,e){return new X(t,e)},C.isZ=function(t){return t instanceof C.Z},C.init=function(e,i){var r;if(!e)return C.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&h.test(e))r=C.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}else{if(L(e))return n(u).ready(e);if(C.isZ(e))return e;if(A(e))r=q(e);else if($(e))r=[e],e=null;else if(h.test(e))r=C.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}}return C.Z(r,e)},n=function(t,e){return C.init(t,e)},n.extend=function(t){var e,n=a.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){B(t,n,e)}),t},C.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],o=i||r?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&i?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:a.call(s&&!i&&t.getElementsByClassName?r?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=u.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},n.type=D,n.isFunction=L,n.isWindow=k,n.isArray=A,n.isPlainObject=F,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=N,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.noop=function(){},n.map=function(t,e){var n,r,o,i=[];if(R(t))for(r=0;r<t.length;r++)n=e(t[r],r),null!=n&&i.push(n);else for(o in t)n=e(t[o],o),null!=n&&i.push(n);return W(i)},n.each=function(t,e){var n,i;if(R(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(i in t)if(e.call(t[i],i,t[i])===!1)return t;return t},n.grep=function(t,e){return s.call(t,e)},window.JSON&&(n.parseJSON=JSON.parse),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){j["[object "+e+"]"]=e.toLowerCase()}),n.fn={constructor:C.Z,length:0,forEach:r.forEach,reduce:r.reduce,push:r.push,sort:r.sort,splice:r.splice,indexOf:r.indexOf,concat:function(){var t,e,n=[];for(t=0;t<arguments.length;t++)e=arguments[t],n[t]=C.isZ(e)?e.toArray():e;return o.apply(C.isZ(this)?this.toArray():this,n)},map:function(t){return n(n.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return n(a.apply(this,arguments))},ready:function(t){return E.test(u.readyState)&&u.body?t(n):u.addEventListener("DOMContentLoaded",function(){t(n)},!1),this},get:function(e){return e===t?a.call(this):this[e>=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return L(t)?this.not(this.not(t)):n(s.call(this,function(e){return C.matches(e,t)}))},add:function(t,e){return n(P(this.concat(n(t,e))))},is:function(t){return this.length>0&&C.matches(this[0],t)},not:function(e){var i=[];if(L(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):R(e)&&L(e.item)?a.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return $(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!$(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!$(t)?t:n(t)},find:function(t){var e,i=this;return e=t?"object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(C.qsa(this[0],t)):this.map(function(){return C.qsa(this,t)}):n()},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:C.matches(i,t));)i=i!==e&&!Z(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!Z(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return V(e,t)},parent:function(t){return V(P(this.pluck("parentNode")),t)},children:function(t){return V(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||a.call(this.childNodes)})},siblings:function(t){return V(this.map(function(t,e){return s.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=L(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=L(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var i=this.innerHTML;n(this).empty().append(Y(this,t,e,i))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each(function(t){if(1===this.nodeType)if($(n))for(e in n)J(this,e,n[e]);else J(this,n,Y(this,i,t,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:t},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){J(this,t)},this)})},prop:function(t,e){return t=M[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(e,n){var i="data-"+e.replace(g,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?K(r):t},val:function(t){return 0 in arguments?this.each(function(e){this.value=Y(this,t,e,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=Y(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof t)return o.style[N(t)]||r.getPropertyValue(t);if(A(t)){var s={};return n.each(t,function(t,e){s[e]=o.style[N(e)]||r.getPropertyValue(e)}),s}}var a="";if("string"==D(t))i||0===i?a=z(t)+":"+_(t,i):this.each(function(){this.style.removeProperty(z(t))});else for(e in t)t[e]||0===t[e]?a+=z(e)+":"+_(e,t[e])+";":this.each(function(){this.style.removeProperty(z(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(G(t))},H(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var r=G(this),o=Y(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&G(this,r+(r?" ":"")+i.join(" "))}}):this},removeClass:function(e){return this.each(function(n){if("className"in this){if(e===t)return G(this,"");i=G(this),Y(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(H(t)," ")}),G(this,i.trim())}})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=Y(this,e,r,G(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=m.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||u.body;t&&!m.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?k(s)?s["inner"+i]:Z(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,Y(this,r,t,s[e]()))})}}),y.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=D(e),"object"==t||"array"==t||null==e?e:C.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null;var f=n.contains(u.documentElement,o);r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();o.insertBefore(t,a),f&&Q(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),C.Z.prototype=X.prototype=n.fn,C.uniq=P,C.deserializeValue=K,n.zepto=C,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=T(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function T(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=w,r&&r.apply(i,arguments)},e[n]=x}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function j(t){var e,i={originalEvent:t};for(e in t)b.test(e)||t[e]===n||(i[e]=t[e]);return T(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){var s=2 in arguments&&i.call(arguments,2);if(r(e)){var a=function(){return e.apply(n,s?s.concat(i.call(arguments)):arguments)};return a._zid=l(e),a}if(o(n))return s?(s.unshift(e[n],e),t.proxy.apply(null,s)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var w=function(){return!0},x=function(){return!1},b=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(u===n||a===!1)&&(u=a,a=n),u===!1&&(u=x),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(j(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=x),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):T(e),e._args=n,this.each(function(){e.type in f&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=j(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),T(n)}}(Zepto),function(t){function h(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function p(t,e,i,r){return t.global?h(e||n,i,r):void 0}function d(e){e.global&&0===t.active++&&p(e,null,"ajaxStart")}function m(e){e.global&&!--t.active&&p(e,null,"ajaxStop")}function g(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||p(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void p(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),p(n,r,"ajaxSuccess",[e,n,t]),w(o,e,n)}function y(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),p(i,o,"ajaxError",[n,i,t||e]),w(e,n,i)}function w(t,e,n){var i=n.context;n.complete.call(i,e,t),p(n,i,"ajaxComplete",[e,n]),m(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function E(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function T(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=E(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/,l=n.createElement("a");l.href=window.location.href,t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?v(f[0],l,i,r):y(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),g(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var a,u,o=t.extend({},e||{}),s=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===o[i]&&(o[i]=t.ajaxSettings[i]);d(o),o.crossDomain||(a=n.createElement("a"),a.href=o.url,a.href=a.href,o.crossDomain=l.protocol+"//"+l.host!=a.protocol+"//"+a.host),o.url||(o.url=window.location.toString()),(u=o.url.indexOf("#"))>-1&&(o.url=o.url.slice(0,u)),T(o);var f=o.dataType,h=/\?.+=\?/.test(o.url);if(h&&(f="jsonp"),o.cache!==!1&&(e&&e.cache===!0||"script"!=f&&"jsonp"!=f)||(o.url=E(o.url,"_="+Date.now())),"jsonp"==f)return h||(o.url=E(o.url,o.jsonp?o.jsonp+"=?":o.jsonp===!1?"":"callback=?")),t.ajaxJSONP(o,s);var N,p=o.accepts[f],m={},w=function(t,e){m[t.toLowerCase()]=[t,e]},j=/^([\w-]+:)\/\//.test(o.url)?RegExp.$1:window.location.protocol,S=o.xhr(),C=S.setRequestHeader;if(s&&s.promise(S),o.crossDomain||w("X-Requested-With","XMLHttpRequest"),w("Accept",p||"*/*"),(p=o.mimeType||p)&&(p.indexOf(",")>-1&&(p=p.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(p)),(o.contentType||o.contentType!==!1&&o.data&&"GET"!=o.type.toUpperCase())&&w("Content-Type",o.contentType||"application/x-www-form-urlencoded"),o.headers)for(r in o.headers)w(r,o.headers[r]);if(S.setRequestHeader=w,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=x,clearTimeout(N);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==j){f=f||b(o.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==f?(1,eval)(e):"xml"==f?e=S.responseXML:"json"==f&&(e=c.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?y(n,"parsererror",S,o,s):v(e,S,o,s)}else y(S.statusText||null,S.status?"error":"abort",S,o,s)}},g(S,o)===!1)return S.abort(),y(null,"abort",S,o,s),S;if(o.xhrFields)for(r in o.xhrFields)S[r]=o.xhrFields[r];var P="async"in o?o.async:!0;S.open(o.type,o.url,P,o.username,o.password);for(r in m)C.apply(S,m[r]);return o.timeout>0&&(N=setTimeout(function(){S.onreadystatechange=x,S.abort(),y(null,"timeout",S,o,s)},o.timeout)),S.send(o.data?o.data:null),S},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("<div>").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var S=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(S(e)+"="+S(n))},C(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.Callbacks=function(e){e=t.extend({},e);var n,i,r,o,s,a,u=[],f=!e.once&&[],c=function(t){for(n=e.memory&&t,i=!0,a=o||0,o=0,s=u.length,r=!0;u&&s>a;++a)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}r=!1,u&&(f?f.length&&c(f.shift()):n?u.length=0:l.disable())},l={add:function(){if(u){var i=u.length,a=function(n){t.each(n,function(t,n){"function"==typeof n?e.unique&&l.has(n)||u.push(n):n&&n.length&&"string"!=typeof n&&a(n)})};a(arguments),r?s=u.length:n&&(o=i,c(n))}return this},remove:function(){return u&&t.each(arguments,function(e,n){for(var i;(i=t.inArray(n,u,i))>-1;)u.splice(i,1),r&&(s>=i&&--s,a>=i&&--a)}),this},has:function(e){return!(!u||!(e?t.inArray(e,u)>-1:u.length))},empty:function(){return s=u.length=0,this},disable:function(){return u=f=n=void 0,this},disabled:function(){return!u},lock:function(){return f=void 0,n||l.disable(),this},locked:function(){return!f},fireWith:function(t,e){return!u||i&&!f||(e=e||[],e=[t,e.slice?e.slice():e],r?f.push(e):c(e)),this},fire:function(){return l.fireWith(this,arguments)},fired:function(){return!!i}};return l}}(Zepto),function(t){function n(e){var i=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],r="pending",o={state:function(){return r},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n(function(n){t.each(i,function(i,r){var a=t.isFunction(e[i])&&e[i];s[r[1]](function(){var e=a&&a.apply(this,arguments);if(e&&t.isFunction(e.promise))e.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var i=this===o?n.promise():this,s=a?[e]:arguments;n[r[0]+"With"](i,s)}})}),e=null}).promise()},promise:function(e){return null!=e?t.extend(e,o):o}},s={};return t.each(i,function(t,e){var n=e[2],a=e[3];o[e[1]]=n.add,a&&n.add(function(){r=a},i[1^t][2].disable,i[2][2].lock),s[e[0]]=function(){return s[e[0]+"With"](this===s?o:this,arguments),this},s[e[0]+"With"]=n.fireWith}),o.promise(s),e&&e.call(s,s),s}var e=Array.prototype.slice;t.when=function(i){var f,c,l,r=e.call(arguments),o=r.length,s=0,a=1!==o||i&&t.isFunction(i.promise)?o:0,u=1===a?i:n(),h=function(t,n,i){return function(r){n[t]=this,i[t]=arguments.length>1?e.call(arguments):r,i===f?u.notifyWith(n,i):--a||u.resolveWith(n,i)}};if(o>1)for(f=new Array(o),c=new Array(o),l=new Array(o);o>s;++s)r[s]&&t.isFunction(r[s].promise)?r[s].promise().done(h(s,l,r)).fail(u.reject).progress(h(s,c,f)):--a;return a||u.resolveWith(l,r),u.promise()},t.Deferred=n}(Zepto),function(t){function u(t,e,n,i){return Math.abs(t-e)>=Math.abs(n-i)?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function f(){o=null,e.last&&(e.el.trigger("longTap"),e={})}function c(){o&&clearTimeout(o),o=null}function l(){n&&clearTimeout(n),i&&clearTimeout(i),r&&clearTimeout(r),o&&clearTimeout(o),n=i=r=o=null,e={}}function h(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function p(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var n,i,r,o,a,e={},s=750;t(document).ready(function(){var d,m,y,w,g=0,v=0;"MSGesture"in window&&(a=new MSGesture,a.target=document.body),t(document).bind("MSGestureEnd",function(t){var n=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;n&&(e.el.trigger("swipe"),e.el.trigger("swipe"+n))}).on("touchstart MSPointerDown pointerdown",function(i){(!(w=p(i,"down"))||h(i))&&(y=w?i:i.touches[0],i.touches&&1===i.touches.length&&e.x2&&(e.x2=void 0,e.y2=void 0),d=Date.now(),m=d-(e.last||d),e.el=t("tagName"in y.target?y.target:y.target.parentNode),n&&clearTimeout(n),e.x1=y.pageX,e.y1=y.pageY,m>0&&250>=m&&(e.isDoubleTap=!0),e.last=d,o=setTimeout(f,s),a&&w&&a.addPointer(i.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(w=p(t,"move"))||h(t))&&(y=w?t:t.touches[0],c(),e.x2=y.pageX,e.y2=y.pageY,g+=Math.abs(e.x1-e.x2),v+=Math.abs(e.y1-e.y2))}).on("touchend MSPointerUp pointerup",function(o){(!(w=p(o,"up"))||h(o))&&(c(),e.x2&&Math.abs(e.x1-e.x2)>30||e.y2&&Math.abs(e.y1-e.y2)>30?r=setTimeout(function(){e.el.trigger("swipe"),e.el.trigger("swipe"+u(e.x1,e.x2,e.y1,e.y2)),e={}},0):"last"in e&&(30>g&&30>v?i=setTimeout(function(){var i=t.Event("tap");i.cancelTouch=l,e.el.trigger(i),e.isDoubleTap?(e.el&&e.el.trigger("doubleTap"),e={}):n=setTimeout(function(){n=null,e.el&&e.el.trigger("singleTap"),e={}},250)},0):e={}),g=v=0)}).on("touchcancel MSPointerCancel pointercancel",l),t(window).on("scroll",l)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(Zepto),function(t){function r(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function f(t,e){t=t.replace(/=#\]/g,'="#"]');var n,i,r=s.exec(t);if(r&&r[2]in o&&(n=o[r[2]],i=r[3],t=r[1],i)){var a=Number(i);i=isNaN(a)?i.replace(/^["']|["']$/g,""):a}return e(t,n,i)}var e=t.zepto,n=e.qsa,i=e.matches,o=t.expr[":"]={visible:function(){return r(this)?this:void 0},hidden:function(){return r(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,i){return t(this).text().indexOf(i)>-1?this:void 0},has:function(t,n,i){return e.qsa(this,i).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),a=/^\s*>/,u="Zepto"+ +new Date;e.qsa=function(i,r){return f(r,function(o,s,f){try{var c;!o&&s?o="*":a.test(o)&&(c=t(i).addClass(u),o="."+u+" "+o);var l=n(i,o)}catch(h){throw console.error("error performing selector: %o",r),h}finally{c&&c.removeClass(u)}return s?e.uniq(t.map(l,function(t,e){return s.call(t,e,l,f)})):l})},e.matches=function(t,e){return f(e,function(e,n,r){return!(e&&!i(t,e)||n&&n.call(t,null,r)!==t)})}}(Zepto);
module.exports = Zepto;
},{}]},{},[3,1])
//# sourceMappingURL=clappr.map |
tools/webpack.app_config.js | ChingxWando/2017-07-23_bubble-dragons | // App-specific back-end Webpack config should be here
const serverConfig = {
entry: {
index: [
'babel-polyfill',
'./src/server/index.js'
]
}
};
// App-specific web front-end Webpack config should be here
const webConfig = {
entry: {
bundle: [
'babel-polyfill',
'./src/client/index.jsx'
]
}
};
// App-specific Android React Native front-end Webpack config should be here
const androidConfig = {
entry: {
index: [
require.resolve('./react-native-polyfill.js'),
'./src/mobile/index.js'
]
}
};
// App-specific iOS React Native front-end Webpack config should be here
const iOSConfig = {
entry: {
index: [
require.resolve('./react-native-polyfill.js'),
'./src/mobile/index.js'
]
}
};
const dependencyPlatforms = {
"body-parser": "server",
"bootstrap": "web",
"dataloader": "server",
"expo": ["ios", "android"],
"express": "server",
"graphql-server-express": "server",
"graphql-subscriptions": "server",
"graphql-tools": "server",
"history": "web",
"immutability-helper": ["ios", "android", "web"],
"isomorphic-fetch": "server",
"knex": "server",
"multer": "server",
"persistgraphql": ["server", "web"],
"performance-now": "server",
"react-dom": "web",
"react-ga": "web",
"react-helmet": "web",
"react-hot-loader": "web",
"react-native": ["ios", "android"],
"react-native-web": "web",
"react-redux": "web",
"react-router": "web",
"react-router-dom": ["web", "ios", "android"],
"react-router-redux": "web",
"react-transition-group": "web",
"reactstrap": "web",
"redux-devtools-extension": "web",
"redux-form": "web",
"serialize-javascript": "server",
"source-map-support": "server",
"sqlite3": "server",
"styled-components": ["server", "web"],
"subscriptions-transport-ws": ["ios", "android", "web"]
};
export { webConfig, serverConfig, androidConfig, iOSConfig, dependencyPlatforms };
|
Public/Home/Js/Jquery.js | fetjq/jquery | /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window); |
js/src/ui/Form/FileSelect/fileSelect.spec.js | nipunn1313/parity | // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { shallow } from 'enzyme';
import React from 'react';
import sinon from 'sinon';
import FileSelect from './';
const FILE = {
content: 'some test content',
name: 'someName'
};
let component;
let globalFileReader;
let instance;
let onSelect;
let processedFile;
function stubReader () {
globalFileReader = global.FileReader;
global.FileReader = class {
readAsText (file) {
processedFile = file;
this.onload({
target: {
result: file.content
}
});
}
};
}
function restoreReader () {
global.FileReader = globalFileReader;
}
function render (props = {}) {
onSelect = sinon.stub();
component = shallow(
<FileSelect
onSelect={ onSelect }
{ ...props }
/>
);
instance = component.instance();
return component;
}
describe('ui/Form/FileSelect', () => {
beforeEach(() => {
stubReader();
render();
});
afterEach(() => {
restoreReader();
});
it('renders defaults', () => {
expect(component).to.be.ok;
});
describe('DropZone', () => {
let label;
let zone;
beforeEach(() => {
label = component.find('FormattedMessage');
zone = component.find('Dropzone');
});
it('renders the label', () => {
expect(label.props().id).to.equal('ui.fileSelect.defaultLabel');
});
it('attaches the onDrop event', () => {
expect(zone.props().onDrop).to.equal(instance.onDrop);
});
it('does not allow multiples', () => {
expect(zone.props().multiple).to.be.false;
});
});
describe('event methods', () => {
describe('onDrop', () => {
beforeEach(() => {
instance.onDrop([ FILE ]);
});
it('reads the file as dropped', () => {
expect(processedFile).to.deep.equal(FILE);
});
it('calls prop onSelect with file & content', () => {
expect(onSelect).to.have.been.calledWith(FILE.name, FILE.content);
});
});
});
});
|
react/gameday2/gameday2.js | bdaroz/the-blue-alliance | import 'babel-polyfill'
import React from 'react'
import ReactGA from 'react-ga'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import { createStore, applyMiddleware, compose } from 'redux'
import ReactDOM from 'react-dom'
import queryString from 'query-string'
import injectTapEventPlugin from 'react-tap-event-plugin'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import { indigo500, indigo700 } from 'material-ui/styles/colors'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import GamedayFrame from './components/GamedayFrame'
import gamedayReducer, { firedux } from './reducers'
import { setWebcastsRaw, setLayout, addWebcastAtPosition, setTwitchChat, setDefaultTwitchChat, setChatSidebarVisibility, setFavoriteTeams, togglePositionLivescore } from './actions'
import { MAX_SUPPORTED_VIEWS } from './constants/LayoutConstants'
ReactGA.initialize('UA-1090782-9')
injectTapEventPlugin()
const webcastData = JSON.parse(document.getElementById('webcasts_json').innerHTML)
const defaultChat = document.getElementById('default_chat').innerHTML
const store = createStore(gamedayReducer, compose(
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : (f) => f
))
firedux.dispatch = store.dispatch
const muiTheme = getMuiTheme({
palette: {
primary1Color: indigo500,
primary2Color: indigo700,
},
layout: {
appBarHeight: 36,
socialPanelWidth: 300,
chatPanelWidth: 300,
},
})
ReactDOM.render(
<MuiThemeProvider muiTheme={muiTheme}>
<Provider store={store}>
<GamedayFrame />
</Provider>
</MuiThemeProvider>,
document.getElementById('content')
)
// Subscribe to changes in state.videoGrid.displayed to watch the correct Firebase paths
// Subscribe to changes in state.videoGrid.domOrderLivescoreOn to watch the correct Firebase paths
let lastDisplayed = []
const subscribedEvents = new Set()
const lastLivescores = new Set()
store.subscribe(() => {
const state = store.getState()
// See what got added or removed
const a = new Set(lastDisplayed)
const b = new Set(state.videoGrid.displayed)
const added = new Set([...b].filter((x) => !a.has(x)))
const removed = new Set([...a].filter((x) => !b.has(x)))
// Subscribe to added event if not already added
added.forEach((webcastKey) => {
const eventKey = state.webcastsById[webcastKey].key
if (!subscribedEvents.has(eventKey)) {
subscribedEvents.add(eventKey)
firedux.watch(`e/${eventKey}/m`)
}
})
// Unsubscribe from removed event if no more existing
removed.forEach((webcastKey) => {
const existingEventKeys = new Set()
state.videoGrid.displayed.forEach((displayed) => existingEventKeys.add(state.webcastsById[displayed].key))
const eventKey = state.webcastsById[webcastKey].key
if (!existingEventKeys.has(eventKey)) {
subscribedEvents.delete(eventKey)
firedux.ref.child(`e/${eventKey}/m`).off('value')
firedux.watching[`e/${eventKey}/m`] = false // To make firedux.watch work again
}
})
// Something changed - save lastDisplayed
if (added.size > 0 || removed.size > 0) {
lastDisplayed = state.videoGrid.displayed
}
// Update Livescore subscriptions
const currentLivescores = new Set()
state.videoGrid.domOrder.forEach((webcastKey, i) => {
if (webcastKey && state.videoGrid.domOrderLivescoreOn[i]) {
const eventKey = state.webcastsById[webcastKey].key
currentLivescores.add(eventKey)
}
})
const addedLivescores = new Set([...currentLivescores].filter((x) => !lastLivescores.has(x)))
const removedLivescores = new Set([...lastLivescores].filter((x) => !currentLivescores.has(x)))
addedLivescores.forEach((eventKey) => {
lastLivescores.add(eventKey)
firedux.watch(`le/${eventKey}`)
})
removedLivescores.forEach((eventKey) => {
lastLivescores.delete(eventKey)
firedux.ref.child(`le/${eventKey}`).off('value')
firedux.watching[`le/${eventKey}`] = false // To make firedux.watch work again
})
})
// Load any special webcasts
store.dispatch(setWebcastsRaw(webcastData))
// Restore layout from URL hash.
const params = queryString.parse(location.hash)
if (params.layout && Number.isInteger(Number.parseInt(params.layout, 10))) {
store.dispatch(setLayout(Number.parseInt(params.layout, 10)))
}
// Used to store webcast state. Hacky. 2017-03-01 -fangeugene
// ongoing_events_w_webcasts and special_webcasts should be separate
let specialWebcasts = webcastData.special_webcasts
let ongoingEventsWithWebcasts = []
// Subscribe to updates to special webcasts
firedux.ref.child('special_webcasts').on('value', (snapshot) => {
specialWebcasts = snapshot.val()
const webcasts = {
ongoing_events_w_webcasts: ongoingEventsWithWebcasts,
special_webcasts: specialWebcasts,
}
store.dispatch(setWebcastsRaw(webcasts))
})
// Subscribe to live events for webcasts
let isLoad = true
firedux.ref.child('live_events').on('value', (snapshot) => {
ongoingEventsWithWebcasts = []
const liveEvents = snapshot.val()
if (liveEvents != null) {
Object.values(liveEvents).forEach((event) => {
if (event.webcasts) {
ongoingEventsWithWebcasts.push(event)
}
})
const webcasts = {
ongoing_events_w_webcasts: ongoingEventsWithWebcasts,
special_webcasts: specialWebcasts,
}
store.dispatch(setWebcastsRaw(webcasts))
}
// Now that webcasts are loaded, attempt to restore any state that's present in
// the URL hash. Only run the first time.
if (isLoad) {
for (let i = 0; i < MAX_SUPPORTED_VIEWS; i++) {
const viewKey = `view_${i}`
if (params[viewKey]) {
store.dispatch(addWebcastAtPosition(params[viewKey], i))
}
const livescoreKey = `livescore_${i}`
if (params[livescoreKey]) {
store.dispatch(togglePositionLivescore(i))
}
}
// Set the default chat channel
if (defaultChat) {
store.dispatch(setDefaultTwitchChat(defaultChat))
store.dispatch(setTwitchChat(defaultChat))
}
// Hide the chat if requested
if (params.chat === 'hidden') {
store.dispatch(setChatSidebarVisibility(false))
} else if (params.chat) {
// Overwrite default chat with param
store.dispatch(setTwitchChat(params.chat))
}
isLoad = false
}
})
// Subscribe to the store to keep the url hash in sync
store.subscribe(() => {
const newParams = {}
const state = store.getState()
const {
videoGrid: {
layoutId,
layoutSet,
positionMap,
domOrder,
domOrderLivescoreOn,
},
chats: {
currentChat,
},
visibility: {
chatSidebar,
},
} = state
// Which layout is currently active
if (layoutSet) {
newParams.layout = layoutId
}
// Positions of all webcasts
for (let i = 0; i < positionMap.length; i++) {
if (domOrder[positionMap[i]]) {
newParams[`view_${i}`] = domOrder[positionMap[i]]
}
if (domOrderLivescoreOn[positionMap[i]]) {
newParams[`livescore_${i}`] = true
}
}
// Chat sidebar
if (chatSidebar) {
newParams.chat = currentChat
} else {
newParams.chat = 'hidden'
}
const query = queryString.stringify(newParams)
if (query) {
location.replace(`#${query}`)
}
})
// Load myTBA Favorites
fetch('/_/account/favorites/1', {
credentials: 'same-origin',
}).then((response) => {
if (response.status === 200) {
return response.json()
}
return []
}).then((json) => store.dispatch(setFavoriteTeams(json)))
|
ajax/libs/react/15.2.1/react-dom.js | tonytomov/cdnjs | /**
* ReactDOM v15.2.1
*
* 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.
*
*/
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
;(function(f) {
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f(require('react'));
// RequireJS
} else if (typeof define === "function" && define.amd) {
define(['react'], f);
// <script>
} else {
var g;
if (typeof window !== "undefined") {
g = window;
} else if (typeof global !== "undefined") {
g = global;
} else if (typeof self !== "undefined") {
g = self;
} else {
// works providing we're not in "use strict";
// needed for Java 8 Nashorn
// see https://github.com/facebook/react/issues/3037
g = this;
}
g.ReactDOM = f(g.React);
}
})(function(React) {
return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
});
|
src/svg-icons/editor/format-underlined.js | mit-cml/iot-website-source | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorFormatUnderlined = (props) => (
<SvgIcon {...props}>
<path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"/>
</SvgIcon>
);
EditorFormatUnderlined = pure(EditorFormatUnderlined);
EditorFormatUnderlined.displayName = 'EditorFormatUnderlined';
EditorFormatUnderlined.muiName = 'SvgIcon';
export default EditorFormatUnderlined;
|
src/svg-icons/action/gif.js | igorbt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionGif = (props) => (
<SvgIcon {...props}>
<path d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z"/>
</SvgIcon>
);
ActionGif = pure(ActionGif);
ActionGif.displayName = 'ActionGif';
ActionGif.muiName = 'SvgIcon';
export default ActionGif;
|
app/components/CraftersPage.js | stratigos/stormsreach | /******************************************************************************
* Page to list available Crafter Avatars.
******************************************************************************/
import React from 'react';
import CraftersContainer from '../containers/CraftersContainer';
import HomepageLink from './HomepageLink';
const CraftersPage = () => {
return(
<div className='crafters-container'>
<div className='crafters-header'>
<h2>Crafters of Storm's Reach</h2>
</div>
<div className='crafters-body'>
<CraftersContainer />
</div>
<HomepageLink />
</div>
);
};
export default CraftersPage;
|
ajax/libs/analytics.js/2.3.16/analytics.js | NamPNQ/cdnjs | (function outer(modules, cache, entries){
/**
* Global
*/
var global = (function(){ return this; })();
/**
* Require `name`.
*
* @param {String} name
* @param {Boolean} jumped
* @api public
*/
function require(name, jumped){
if (cache[name]) return cache[name].exports;
if (modules[name]) return call(name, require);
throw new Error('cannot find module "' + name + '"');
}
/**
* Call module `id` and cache it.
*
* @param {Number} id
* @param {Function} require
* @return {Function}
* @api private
*/
function call(id, require){
var m = cache[id] = { exports: {} };
var mod = modules[id];
var name = mod[2];
var fn = mod[0];
fn.call(m.exports, function(req){
var dep = modules[id][1][req];
return require(dep ? dep : req);
}, m, m.exports, outer, modules, cache, entries);
// expose as `name`.
if (name) cache[name] = cache[id];
return cache[id].exports;
}
/**
* Require all entries exposing them on global if needed.
*/
for (var id in entries) {
if (entries[id]) {
global[entries[id]] = require(id);
} else {
require(id);
}
}
/**
* Duo flag.
*/
require.duo = true;
/**
* Expose cache.
*/
require.cache = cache;
/**
* Expose modules
*/
require.modules = modules;
/**
* Return newest require.
*/
return require;
})({
1: [function(require, module, exports) {
/**
* Analytics.js
*
* (C) 2013 Segment.io Inc.
*/
var Integrations = require('analytics.js-integrations');
var Analytics = require('./analytics');
var each = require('each');
/**
* Expose the `analytics` singleton.
*/
var analytics = module.exports = exports = new Analytics();
/**
* Expose require
*/
analytics.require = require;
/**
* Expose `VERSION`.
*/
exports.VERSION = require('./version');
/**
* Add integrations.
*/
each(Integrations, function (name, Integration) {
analytics.use(Integration);
});
}, {"analytics.js-integrations":2,"./analytics":3,"each":4,"./version":5}],
2: [function(require, module, exports) {
/**
* Module dependencies.
*/
var each = require('each');
var plugins = require('./integrations.js');
/**
* Expose the integrations, using their own `name` from their `prototype`.
*/
each(plugins, function(plugin){
var name = (plugin.Integration || plugin).prototype.name;
exports[name] = plugin;
});
}, {"each":4,"./integrations.js":6}],
4: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type = require('type');
/**
* HOP reference.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Iterate the given `obj` and invoke `fn(val, i)`.
*
* @param {String|Array|Object} obj
* @param {Function} fn
* @api public
*/
module.exports = function(obj, fn){
switch (type(obj)) {
case 'array':
return array(obj, fn);
case 'object':
if ('number' == typeof obj.length) return array(obj, fn);
return object(obj, fn);
case 'string':
return string(obj, fn);
}
};
/**
* Iterate string chars.
*
* @param {String} obj
* @param {Function} fn
* @api private
*/
function string(obj, fn) {
for (var i = 0; i < obj.length; ++i) {
fn(obj.charAt(i), i);
}
}
/**
* Iterate object keys.
*
* @param {Object} obj
* @param {Function} fn
* @api private
*/
function object(obj, fn) {
for (var key in obj) {
if (has.call(obj, key)) {
fn(key, obj[key]);
}
}
}
/**
* Iterate array-ish.
*
* @param {Array|Object} obj
* @param {Function} fn
* @api private
*/
function array(obj, fn) {
for (var i = 0; i < obj.length; ++i) {
fn(obj[i], i);
}
}
}, {"type":7}],
7: [function(require, module, exports) {
/**
* toString ref.
*/
var toString = Object.prototype.toString;
/**
* Return the type of `val`.
*
* @param {Mixed} val
* @return {String}
* @api public
*/
module.exports = function(val){
switch (toString.call(val)) {
case '[object Function]': return 'function';
case '[object Date]': return 'date';
case '[object RegExp]': return 'regexp';
case '[object Arguments]': return 'arguments';
case '[object Array]': return 'array';
case '[object String]': return 'string';
}
if (val === null) return 'null';
if (val === undefined) return 'undefined';
if (val && val.nodeType === 1) return 'element';
if (val === Object(val)) return 'object';
return typeof val;
};
}, {}],
6: [function(require, module, exports) {
/**
* DON'T EDIT THIS FILE. It's automatically generated!
*/
module.exports = [
require('./lib/adroll'),
require('./lib/adwords'),
require('./lib/alexa'),
require('./lib/amplitude'),
require('./lib/appcues'),
require('./lib/awesm'),
require('./lib/awesomatic'),
require('./lib/bing-ads'),
require('./lib/bronto'),
require('./lib/bugherd'),
require('./lib/bugsnag'),
require('./lib/chartbeat'),
require('./lib/churnbee'),
require('./lib/clicktale'),
require('./lib/clicky'),
require('./lib/comscore'),
require('./lib/crazy-egg'),
require('./lib/curebit'),
require('./lib/customerio'),
require('./lib/drip'),
require('./lib/errorception'),
require('./lib/evergage'),
require('./lib/facebook-conversion-tracking'),
require('./lib/foxmetrics'),
require('./lib/frontleaf'),
require('./lib/gauges'),
require('./lib/get-satisfaction'),
require('./lib/google-analytics'),
require('./lib/google-tag-manager'),
require('./lib/gosquared'),
require('./lib/heap'),
require('./lib/hellobar'),
require('./lib/hittail'),
require('./lib/hublo'),
require('./lib/hubspot'),
require('./lib/improvely'),
require('./lib/insidevault'),
require('./lib/inspectlet'),
require('./lib/intercom'),
require('./lib/keen-io'),
require('./lib/kenshoo'),
require('./lib/kissmetrics'),
require('./lib/klaviyo'),
require('./lib/leadlander'),
require('./lib/livechat'),
require('./lib/lucky-orange'),
require('./lib/lytics'),
require('./lib/mixpanel'),
require('./lib/mojn'),
require('./lib/mouseflow'),
require('./lib/mousestats'),
require('./lib/navilytics'),
require('./lib/olark'),
require('./lib/optimizely'),
require('./lib/perfect-audience'),
require('./lib/pingdom'),
require('./lib/piwik'),
require('./lib/preact'),
require('./lib/qualaroo'),
require('./lib/quantcast'),
require('./lib/rollbar'),
require('./lib/saasquatch'),
require('./lib/sentry'),
require('./lib/snapengage'),
require('./lib/spinnakr'),
require('./lib/tapstream'),
require('./lib/trakio'),
require('./lib/twitter-ads'),
require('./lib/usercycle'),
require('./lib/uservoice'),
require('./lib/vero'),
require('./lib/visual-website-optimizer'),
require('./lib/webengage'),
require('./lib/woopra'),
require('./lib/yandex-metrica')
];
}, {"./lib/adroll":8,"./lib/adwords":9,"./lib/alexa":10,"./lib/amplitude":11,"./lib/appcues":12,"./lib/awesm":13,"./lib/awesomatic":14,"./lib/bing-ads":15,"./lib/bronto":16,"./lib/bugherd":17,"./lib/bugsnag":18,"./lib/chartbeat":19,"./lib/churnbee":20,"./lib/clicktale":21,"./lib/clicky":22,"./lib/comscore":23,"./lib/crazy-egg":24,"./lib/curebit":25,"./lib/customerio":26,"./lib/drip":27,"./lib/errorception":28,"./lib/evergage":29,"./lib/facebook-conversion-tracking":30,"./lib/foxmetrics":31,"./lib/frontleaf":32,"./lib/gauges":33,"./lib/get-satisfaction":34,"./lib/google-analytics":35,"./lib/google-tag-manager":36,"./lib/gosquared":37,"./lib/heap":38,"./lib/hellobar":39,"./lib/hittail":40,"./lib/hublo":41,"./lib/hubspot":42,"./lib/improvely":43,"./lib/insidevault":44,"./lib/inspectlet":45,"./lib/intercom":46,"./lib/keen-io":47,"./lib/kenshoo":48,"./lib/kissmetrics":49,"./lib/klaviyo":50,"./lib/leadlander":51,"./lib/livechat":52,"./lib/lucky-orange":53,"./lib/lytics":54,"./lib/mixpanel":55,"./lib/mojn":56,"./lib/mouseflow":57,"./lib/mousestats":58,"./lib/navilytics":59,"./lib/olark":60,"./lib/optimizely":61,"./lib/perfect-audience":62,"./lib/pingdom":63,"./lib/piwik":64,"./lib/preact":65,"./lib/qualaroo":66,"./lib/quantcast":67,"./lib/rollbar":68,"./lib/saasquatch":69,"./lib/sentry":70,"./lib/snapengage":71,"./lib/spinnakr":72,"./lib/tapstream":73,"./lib/trakio":74,"./lib/twitter-ads":75,"./lib/usercycle":76,"./lib/uservoice":77,"./lib/vero":78,"./lib/visual-website-optimizer":79,"./lib/webengage":80,"./lib/woopra":81,"./lib/yandex-metrica":82}],
8: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var snake = require('to-snake-case');
var useHttps = require('use-https');
var each = require('each');
var is = require('is');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `AdRoll` integration.
*/
var AdRoll = module.exports = integration('AdRoll')
.assumesPageview()
.global('__adroll_loaded')
.global('adroll_adv_id')
.global('adroll_pix_id')
.global('adroll_custom_data')
.option('advId', '')
.option('pixId', '')
.tag('http', '<script src="http://a.adroll.com/j/roundtrip.js">')
.tag('https', '<script src="https://s.adroll.com/j/roundtrip.js">')
.mapping('events');
/**
* Initialize.
*
* http://support.adroll.com/getting-started-in-4-easy-steps/#step-one
* http://support.adroll.com/enhanced-conversion-tracking/
*
* @param {Object} page
*/
AdRoll.prototype.initialize = function(page){
window.adroll_adv_id = this.options.advId;
window.adroll_pix_id = this.options.pixId;
window.__adroll_loaded = true;
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
AdRoll.prototype.loaded = function(){
return window.__adroll;
};
/**
* Page.
*
* http://support.adroll.com/segmenting-clicks/
*
* @param {Page} page
*/
AdRoll.prototype.page = function(page){
var name = page.fullName();
this.track(page.track(name));
};
/**
* Track.
*
* @param {Track} track
*/
AdRoll.prototype.track = function(track){
var event = track.event();
var user = this.analytics.user();
var events = this.events(event);
var total = track.revenue() || track.total() || 0;
var orderId = track.orderId() || 0;
each(events, function(event){
var data = {};
if (user.id()) data.user_id = user.id();
data.adroll_conversion_value_in_dollars = total;
data.order_id = orderId;
// the adroll interface only allows for
// segment names which are snake cased.
data.adroll_segments = snake(event);
window.__adroll.record_user(data);
});
// no events found
if (!events.length) {
var data = {};
if (user.id()) data.user_id = user.id();
data.adroll_segments = snake(event);
window.__adroll.record_user(data);
}
};
}, {"analytics.js-integration":83,"to-snake-case":84,"use-https":85,"each":4,"is":86}],
83: [function(require, module, exports) {
/**
* Module dependencies.
*/
var bind = require('bind');
var callback = require('callback');
var clone = require('clone');
var debug = require('debug');
var defaults = require('defaults');
var protos = require('./protos');
var slug = require('slug');
var statics = require('./statics');
/**
* Expose `createIntegration`.
*/
module.exports = createIntegration;
/**
* Create a new `Integration` constructor.
*
* @param {String} name
* @return {Function} Integration
*/
function createIntegration(name){
/**
* Initialize a new `Integration`.
*
* @param {Object} options
*/
function Integration(options){
if (options && options.addIntegration) {
// plugin
return options.addIntegration(Integration);
}
this.debug = debug('analytics:integration:' + slug(name));
this.options = defaults(clone(options) || {}, this.defaults);
this._queue = [];
this.once('ready', bind(this, this.flush));
Integration.emit('construct', this);
this.ready = bind(this, this.ready);
this._wrapInitialize();
this._wrapPage();
this._wrapTrack();
}
Integration.prototype.defaults = {};
Integration.prototype.globals = [];
Integration.prototype.templates = {};
Integration.prototype.name = name;
for (var key in statics) Integration[key] = statics[key];
for (var key in protos) Integration.prototype[key] = protos[key];
return Integration;
}
}, {"bind":87,"callback":88,"clone":89,"debug":90,"defaults":91,"./protos":92,"slug":93,"./statics":94}],
87: [function(require, module, exports) {
var bind = require('bind')
, bindAll = require('bind-all');
/**
* Expose `bind`.
*/
module.exports = exports = bind;
/**
* Expose `bindAll`.
*/
exports.all = bindAll;
/**
* Expose `bindMethods`.
*/
exports.methods = bindMethods;
/**
* Bind `methods` on `obj` to always be called with the `obj` as context.
*
* @param {Object} obj
* @param {String} methods...
*/
function bindMethods (obj, methods) {
methods = [].slice.call(arguments, 1);
for (var i = 0, method; method = methods[i]; i++) {
obj[method] = bind(obj, obj[method]);
}
return obj;
}
}, {"bind":95,"bind-all":96}],
95: [function(require, module, exports) {
/**
* Slice reference.
*/
var slice = [].slice;
/**
* Bind `obj` to `fn`.
*
* @param {Object} obj
* @param {Function|String} fn or string
* @return {Function}
* @api public
*/
module.exports = function(obj, fn){
if ('string' == typeof fn) fn = obj[fn];
if ('function' != typeof fn) throw new Error('bind() requires a function');
var args = slice.call(arguments, 2);
return function(){
return fn.apply(obj, args.concat(slice.call(arguments)));
}
};
}, {}],
96: [function(require, module, exports) {
try {
var bind = require('bind');
var type = require('type');
} catch (e) {
var bind = require('bind-component');
var type = require('type-component');
}
module.exports = function (obj) {
for (var key in obj) {
var val = obj[key];
if (type(val) === 'function') obj[key] = bind(obj, obj[key]);
}
return obj;
};
}, {"bind":95,"type":7}],
88: [function(require, module, exports) {
var next = require('next-tick');
/**
* Expose `callback`.
*/
module.exports = callback;
/**
* Call an `fn` back synchronously if it exists.
*
* @param {Function} fn
*/
function callback (fn) {
if ('function' === typeof fn) fn();
}
/**
* Call an `fn` back asynchronously if it exists. If `wait` is ommitted, the
* `fn` will be called on next tick.
*
* @param {Function} fn
* @param {Number} wait (optional)
*/
callback.async = function (fn, wait) {
if ('function' !== typeof fn) return;
if (!wait) return next(fn);
setTimeout(fn, wait);
};
/**
* Symmetry.
*/
callback.sync = callback;
}, {"next-tick":97}],
97: [function(require, module, exports) {
"use strict"
if (typeof setImmediate == 'function') {
module.exports = function(f){ setImmediate(f) }
}
// legacy node.js
else if (typeof process != 'undefined' && typeof process.nextTick == 'function') {
module.exports = process.nextTick
}
// fallback for other environments / postMessage behaves badly on IE8
else if (typeof window == 'undefined' || window.ActiveXObject || !window.postMessage) {
module.exports = function(f){ setTimeout(f) };
} else {
var q = [];
window.addEventListener('message', function(){
var i = 0;
while (i < q.length) {
try { q[i++](); }
catch (e) {
q = q.slice(i);
window.postMessage('tic!', '*');
throw e;
}
}
q.length = 0;
}, true);
module.exports = function(fn){
if (!q.length) window.postMessage('tic!', '*');
q.push(fn);
}
}
}, {}],
89: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type;
try {
type = require('type');
} catch(e){
type = require('type-component');
}
/**
* Module exports.
*/
module.exports = clone;
/**
* Clones objects.
*
* @param {Mixed} any object
* @api public
*/
function clone(obj){
switch (type(obj)) {
case 'object':
var copy = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
copy[key] = clone(obj[key]);
}
}
return copy;
case 'array':
var copy = new Array(obj.length);
for (var i = 0, l = obj.length; i < l; i++) {
copy[i] = clone(obj[i]);
}
return copy;
case 'regexp':
// from millermedeiros/amd-utils - MIT
var flags = '';
flags += obj.multiline ? 'm' : '';
flags += obj.global ? 'g' : '';
flags += obj.ignoreCase ? 'i' : '';
return new RegExp(obj.source, flags);
case 'date':
return new Date(obj.getTime());
default: // string, number, boolean, …
return obj;
}
}
}, {"type":7}],
90: [function(require, module, exports) {
if ('undefined' == typeof window) {
module.exports = require('./lib/debug');
} else {
module.exports = require('./debug');
}
}, {"./lib/debug":98,"./debug":99}],
98: [function(require, module, exports) {
/**
* Module dependencies.
*/
var tty = require('tty');
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Enabled debuggers.
*/
var names = []
, skips = [];
(process.env.DEBUG || '')
.split(/[\s,]+/)
.forEach(function(name){
name = name.replace('*', '.*?');
if (name[0] === '-') {
skips.push(new RegExp('^' + name.substr(1) + '$'));
} else {
names.push(new RegExp('^' + name + '$'));
}
});
/**
* Colors.
*/
var colors = [6, 2, 3, 4, 5, 1];
/**
* Previous debug() call.
*/
var prev = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Is stdout a TTY? Colored output is disabled when `true`.
*/
var isatty = tty.isatty(2);
/**
* Select a color.
*
* @return {Number}
* @api private
*/
function color() {
return colors[prevColor++ % colors.length];
}
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
function humanize(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
}
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
function disabled(){}
disabled.enabled = false;
var match = skips.some(function(re){
return re.test(name);
});
if (match) return disabled;
match = names.some(function(re){
return re.test(name);
});
if (!match) return disabled;
var c = color();
function colored(fmt) {
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (prev[name] || curr);
prev[name] = curr;
fmt = ' \u001b[9' + c + 'm' + name + ' '
+ '\u001b[3' + c + 'm\u001b[90m'
+ fmt + '\u001b[3' + c + 'm'
+ ' +' + humanize(ms) + '\u001b[0m';
console.error.apply(this, arguments);
}
function plain(fmt) {
fmt = coerce(fmt);
fmt = new Date().toUTCString()
+ ' ' + name + ' ' + fmt;
console.error.apply(this, arguments);
}
colored.enabled = plain.enabled = true;
return isatty || process.env.DEBUG_COLORS
? colored
: plain;
}
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
}, {}],
99: [function(require, module, exports) {
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
if (!debug.enabled(name)) return function(){};
return function(fmt){
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (debug[name] || curr);
debug[name] = curr;
fmt = name
+ ' '
+ fmt
+ ' +' + debug.humanize(ms);
// This hackery is required for IE8
// where `console.log` doesn't have 'apply'
window.console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
}
/**
* The currently active debug mode names.
*/
debug.names = [];
debug.skips = [];
/**
* Enables a debug mode by name. This can include modes
* separated by a colon and wildcards.
*
* @param {String} name
* @api public
*/
debug.enable = function(name) {
try {
localStorage.debug = name;
} catch(e){}
var split = (name || '').split(/[\s,]+/)
, len = split.length;
for (var i = 0; i < len; i++) {
name = split[i].replace('*', '.*?');
if (name[0] === '-') {
debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
}
else {
debug.names.push(new RegExp('^' + name + '$'));
}
}
};
/**
* Disable debug output.
*
* @api public
*/
debug.disable = function(){
debug.enable('');
};
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
debug.humanize = function(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
};
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
debug.enabled = function(name) {
for (var i = 0, len = debug.skips.length; i < len; i++) {
if (debug.skips[i].test(name)) {
return false;
}
}
for (var i = 0, len = debug.names.length; i < len; i++) {
if (debug.names[i].test(name)) {
return true;
}
}
return false;
};
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
// persist
try {
if (window.localStorage) debug.enable(localStorage.debug);
} catch(e){}
}, {}],
91: [function(require, module, exports) {
'use strict';
/**
* Merge default values.
*
* @param {Object} dest
* @param {Object} defaults
* @return {Object}
* @api public
*/
var defaults = function (dest, src, recursive) {
for (var prop in src) {
if (recursive && dest[prop] instanceof Object && src[prop] instanceof Object) {
dest[prop] = defaults(dest[prop], src[prop], true);
} else if (! (prop in dest)) {
dest[prop] = src[prop];
}
}
return dest;
};
/**
* Expose `defaults`.
*/
module.exports = defaults;
}, {}],
92: [function(require, module, exports) {
/**
* Module dependencies.
*/
var loadScript = require('segmentio/load-script');
var normalize = require('to-no-case');
var callback = require('callback');
var Emitter = require('emitter');
var events = require('./events');
var tick = require('next-tick');
var assert = require('assert');
var after = require('after');
var each = require('component/each');
var type = require('type');
var fmt = require('yields/fmt');
/**
* Window defaults.
*/
var setTimeout = window.setTimeout;
var setInterval = window.setInterval;
var onerror = null;
var onload = null;
/**
* Mixin emitter.
*/
Emitter(exports);
/**
* Initialize.
*/
exports.initialize = function(){
var ready = this.ready;
tick(ready);
};
/**
* Loaded?
*
* @return {Boolean}
* @api private
*/
exports.loaded = function(){
return false;
};
/**
* Load.
*
* @param {Function} cb
*/
exports.load = function(cb){
callback.async(cb);
};
/**
* Page.
*
* @param {Page} page
*/
exports.page = function(page){};
/**
* Track.
*
* @param {Track} track
*/
exports.track = function(track){};
/**
* Get events that match `str`.
*
* Examples:
*
* events = { my_event: 'a4991b88' }
* .map(events, 'My Event');
* // => ["a4991b88"]
* .map(events, 'whatever');
* // => []
*
* events = [{ key: 'my event', value: '9b5eb1fa' }]
* .map(events, 'my_event');
* // => ["9b5eb1fa"]
* .map(events, 'whatever');
* // => []
*
* @param {String} str
* @return {Array}
* @api public
*/
exports.map = function(obj, str){
var a = normalize(str);
var ret = [];
// noop
if (!obj) return ret;
// object
if ('object' == type(obj)) {
for (var k in obj) {
var item = obj[k];
var b = normalize(k);
if (b == a) ret.push(item);
}
}
// array
if ('array' == type(obj)) {
if (!obj.length) return ret;
if (!obj[0].key) return ret;
for (var i = 0; i < obj.length; ++i) {
var item = obj[i];
var b = normalize(item.key);
if (b == a) ret.push(item.value);
}
}
return ret;
};
/**
* Invoke a `method` that may or may not exist on the prototype with `args`,
* queueing or not depending on whether the integration is "ready". Don't
* trust the method call, since it contains integration party code.
*
* @param {String} method
* @param {Mixed} args...
* @api private
*/
exports.invoke = function(method){
if (!this[method]) return;
var args = [].slice.call(arguments, 1);
if (!this._ready) return this.queue(method, args);
var ret;
try {
this.debug('%s with %o', method, args);
ret = this[method].apply(this, args);
} catch (e) {
this.debug('error %o calling %s with %o', e, method, args);
}
return ret;
};
/**
* Queue a `method` with `args`. If the integration assumes an initial
* pageview, then let the first call to `page` pass through.
*
* @param {String} method
* @param {Array} args
* @api private
*/
exports.queue = function(method, args){
if ('page' == method && this._assumesPageview && !this._initialized) {
return this.page.apply(this, args);
}
this._queue.push({ method: method, args: args });
};
/**
* Flush the internal queue.
*
* @api private
*/
exports.flush = function(){
this._ready = true;
var call;
while (call = this._queue.shift()) this[call.method].apply(this, call.args);
};
/**
* Reset the integration, removing its global variables.
*
* @api private
*/
exports.reset = function(){
for (var i = 0, key; key = this.globals[i]; i++) window[key] = undefined;
window.setTimeout = setTimeout;
window.setInterval = setInterval;
window.onerror = onerror;
window.onload = onload;
};
/**
* Load a tag by `name`.
*
* @param {String} name
* @param {Function} [fn]
*/
exports.load = function(name, locals, fn){
if ('function' == typeof name) fn = name, locals = null, name = null;
if (name && 'object' == typeof name) fn = locals, locals = name, name = null;
if ('function' == typeof locals) fn = locals, locals = null;
name = name || 'library';
locals = locals || {};
locals = this.locals(locals);
var template = this.templates[name];
assert(template, fmt('Template "%s" not defined.', name));
var attrs = render(template, locals);
var el;
switch (template.type) {
case 'img':
attrs.width = 1;
attrs.height = 1;
el = loadImage(attrs, fn);
break;
case 'script':
el = loadScript(attrs, fn);
// TODO: hack until refactoring load-script
delete attrs.src;
each(attrs, function(key, val){
el.setAttribute(key, val);
});
break;
case 'iframe':
el = loadIframe(attrs, fn);
break;
}
return el;
};
/**
* Locals for tag templates.
*
* By default it includes a cache buster,
* and all of the options.
*
* @param {Object} [locals]
* @return {Object}
*/
exports.locals = function(locals){
locals = locals || {};
var cache = Math.floor(new Date().getTime() / 3600000);
if (!locals.hasOwnProperty('cache')) locals.cache = cache;
each(this.options, function(key, val){
if (!locals.hasOwnProperty(key)) locals[key] = val;
});
return locals;
};
/**
* Simple way to emit ready.
*/
exports.ready = function(){
this.emit('ready');
};
/**
* Wrap the initialize method in an exists check, so we don't have to do it for
* every single integration.
*
* @api private
*/
exports._wrapInitialize = function(){
var initialize = this.initialize;
this.initialize = function(){
this.debug('initialize');
this._initialized = true;
var ret = initialize.apply(this, arguments);
this.emit('initialize');
return ret;
};
if (this._assumesPageview) this.initialize = after(2, this.initialize);
};
/**
* Wrap the page method to call `initialize` instead if the integration assumes
* a pageview.
*
* @api private
*/
exports._wrapPage = function(){
var page = this.page;
this.page = function(){
if (this._assumesPageview && !this._initialized) {
return this.initialize.apply(this, arguments);
}
return page.apply(this, arguments);
};
};
/**
* Wrap the track method to call other ecommerce methods if
* available depending on the `track.event()`.
*
* @api private
*/
exports._wrapTrack = function(){
var t = this.track;
this.track = function(track){
var event = track.event();
var called;
var ret;
for (var method in events) {
var regexp = events[method];
if (!this[method]) continue;
if (!regexp.test(event)) continue;
ret = this[method].apply(this, arguments);
called = true;
break;
}
if (!called) ret = t.apply(this, arguments);
return ret;
};
};
function loadImage(attrs, fn) {
fn = fn || function(){};
var img = new Image;
img.onerror = error(fn, 'failed to load pixel', img);
img.onload = function(){ fn(); };
img.src = attrs.src;
img.width = 1;
img.height = 1;
return img;
}
function error(fn, message, img){
return function(e){
e = e || window.event;
var err = new Error(message);
err.event = e;
err.source = img;
fn(err);
};
}
/**
* Render template + locals into an `attrs` object.
*
* @param {Object} template
* @param {Object} locals
* @return {Object}
*/
function render(template, locals) {
var attrs = {};
each(template.attrs, function(key, val){
attrs[key] = val.replace(/\{\{\ *(\w+)\ *\}\}/g, function(_, $1){
return locals[$1];
});
});
return attrs;
}
}, {"segmentio/load-script":100,"to-no-case":101,"callback":88,"emitter":102,"./events":103,"next-tick":97,"assert":104,"after":105,"component/each":106,"type":7,"yields/fmt":107}],
100: [function(require, module, exports) {
/**
* Module dependencies.
*/
var onload = require('script-onload');
var tick = require('next-tick');
var type = require('type');
/**
* Expose `loadScript`.
*
* @param {Object} options
* @param {Function} fn
* @api public
*/
module.exports = function loadScript(options, fn){
if (!options) throw new Error('Cant load nothing...');
// Allow for the simplest case, just passing a `src` string.
if ('string' == type(options)) options = { src : options };
var https = document.location.protocol === 'https:' ||
document.location.protocol === 'chrome-extension:';
// If you use protocol relative URLs, third-party scripts like Google
// Analytics break when testing with `file:` so this fixes that.
if (options.src && options.src.indexOf('//') === 0) {
options.src = https ? 'https:' + options.src : 'http:' + options.src;
}
// Allow them to pass in different URLs depending on the protocol.
if (https && options.https) options.src = options.https;
else if (!https && options.http) options.src = options.http;
// Make the `<script>` element and insert it before the first script on the
// page, which is guaranteed to exist since this Javascript is running.
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = options.src;
// If we have a fn, attach event handlers, even in IE. Based off of
// the Third-Party Javascript script loading example:
// https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html
if ('function' == type(fn)) {
onload(script, fn);
}
tick(function(){
// Append after event listeners are attached for IE.
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
});
// Return the script element in case they want to do anything special, like
// give it an ID or attributes.
return script;
};
}, {"script-onload":108,"next-tick":97,"type":7}],
108: [function(require, module, exports) {
// https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html
/**
* Invoke `fn(err)` when the given `el` script loads.
*
* @param {Element} el
* @param {Function} fn
* @api public
*/
module.exports = function(el, fn){
return el.addEventListener
? add(el, fn)
: attach(el, fn);
};
/**
* Add event listener to `el`, `fn()`.
*
* @param {Element} el
* @param {Function} fn
* @api private
*/
function add(el, fn){
el.addEventListener('load', function(_, e){ fn(null, e); }, false);
el.addEventListener('error', function(e){
var err = new Error('failed to load the script "' + el.src + '"');
err.event = e;
fn(err);
}, false);
}
/**
* Attach evnet.
*
* @param {Element} el
* @param {Function} fn
* @api private
*/
function attach(el, fn){
el.attachEvent('onreadystatechange', function(e){
if (!/complete|loaded/.test(el.readyState)) return;
fn(null, e);
});
}
}, {}],
101: [function(require, module, exports) {
/**
* Expose `toNoCase`.
*/
module.exports = toNoCase;
/**
* Test whether a string is camel-case.
*/
var hasSpace = /\s/;
var hasSeparator = /[\W_]/;
/**
* Remove any starting case from a `string`, like camel or snake, but keep
* spaces and punctuation that may be important otherwise.
*
* @param {String} string
* @return {String}
*/
function toNoCase (string) {
if (hasSpace.test(string)) return string.toLowerCase();
if (hasSeparator.test(string)) return unseparate(string).toLowerCase();
return uncamelize(string).toLowerCase();
}
/**
* Separator splitter.
*/
var separatorSplitter = /[\W_]+(.|$)/g;
/**
* Un-separate a `string`.
*
* @param {String} string
* @return {String}
*/
function unseparate (string) {
return string.replace(separatorSplitter, function (m, next) {
return next ? ' ' + next : '';
});
}
/**
* Camelcase splitter.
*/
var camelSplitter = /(.)([A-Z]+)/g;
/**
* Un-camelcase a `string`.
*
* @param {String} string
* @return {String}
*/
function uncamelize (string) {
return string.replace(camelSplitter, function (m, previous, uppers) {
return previous + ' ' + uppers.toLowerCase().split('').join(' ');
});
}
}, {}],
102: [function(require, module, exports) {
/**
* Module dependencies.
*/
var index = require('indexof');
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
var self = this;
this._callbacks = this._callbacks || {};
function on() {
self.off(event, on);
fn.apply(this, arguments);
}
fn._off = on;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return this;
}
// remove specific handler
var i = index(callbacks, fn._off || fn);
if (~i) callbacks.splice(i, 1);
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = [].slice.call(arguments, 1)
, callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
}, {"indexof":109}],
109: [function(require, module, exports) {
module.exports = function(arr, obj){
if (arr.indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
}, {}],
103: [function(require, module, exports) {
/**
* Expose `events`.
*/
module.exports = {
removedProduct: /removed[ _]?product/i,
viewedProduct: /viewed[ _]?product/i,
addedProduct: /added[ _]?product/i,
completedOrder: /completed[ _]?order/i
};
}, {}],
104: [function(require, module, exports) {
/**
* Module dependencies.
*/
var equals = require('equals');
var fmt = require('fmt');
var stack = require('stack');
/**
* Assert `expr` with optional failure `msg`.
*
* @param {Mixed} expr
* @param {String} [msg]
* @api public
*/
module.exports = exports = function (expr, msg) {
if (expr) return;
throw new Error(msg || message());
};
/**
* Assert `actual` is weak equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.equal = function (actual, expected, msg) {
if (actual == expected) return;
throw new Error(msg || fmt('Expected %o to equal %o.', actual, expected));
};
/**
* Assert `actual` is not weak equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.notEqual = function (actual, expected, msg) {
if (actual != expected) return;
throw new Error(msg || fmt('Expected %o not to equal %o.', actual, expected));
};
/**
* Assert `actual` is deep equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.deepEqual = function (actual, expected, msg) {
if (equals(actual, expected)) return;
throw new Error(msg || fmt('Expected %o to deeply equal %o.', actual, expected));
};
/**
* Assert `actual` is not deep equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.notDeepEqual = function (actual, expected, msg) {
if (!equals(actual, expected)) return;
throw new Error(msg || fmt('Expected %o not to deeply equal %o.', actual, expected));
};
/**
* Assert `actual` is strict equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.strictEqual = function (actual, expected, msg) {
if (actual === expected) return;
throw new Error(msg || fmt('Expected %o to strictly equal %o.', actual, expected));
};
/**
* Assert `actual` is not strict equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.notStrictEqual = function (actual, expected, msg) {
if (actual !== expected) return;
throw new Error(msg || fmt('Expected %o not to strictly equal %o.', actual, expected));
};
/**
* Assert `block` throws an `error`.
*
* @param {Function} block
* @param {Function} [error]
* @param {String} [msg]
* @api public
*/
exports.throws = function (block, error, msg) {
var err;
try {
block();
} catch (e) {
err = e;
}
if (!err) throw new Error(msg || fmt('Expected %s to throw an error.', block.toString()));
if (error && !(err instanceof error)) {
throw new Error(msg || fmt('Expected %s to throw an %o.', block.toString(), error));
}
};
/**
* Assert `block` doesn't throw an `error`.
*
* @param {Function} block
* @param {Function} [error]
* @param {String} [msg]
* @api public
*/
exports.doesNotThrow = function (block, error, msg) {
var err;
try {
block();
} catch (e) {
err = e;
}
if (err) throw new Error(msg || fmt('Expected %s not to throw an error.', block.toString()));
if (error && (err instanceof error)) {
throw new Error(msg || fmt('Expected %s not to throw an %o.', block.toString(), error));
}
};
/**
* Create a message from the call stack.
*
* @return {String}
* @api private
*/
function message() {
if (!Error.captureStackTrace) return 'assertion failed';
var callsite = stack()[2];
var fn = callsite.getFunctionName();
var file = callsite.getFileName();
var line = callsite.getLineNumber() - 1;
var col = callsite.getColumnNumber() - 1;
var src = get(file);
line = src.split('\n')[line].slice(col);
var m = line.match(/assert\((.*)\)/);
return m && m[1].trim();
}
/**
* Load contents of `script`.
*
* @param {String} script
* @return {String}
* @api private
*/
function get(script) {
var xhr = new XMLHttpRequest;
xhr.open('GET', script, false);
xhr.send(null);
return xhr.responseText;
}
}, {"equals":110,"fmt":107,"stack":111}],
110: [function(require, module, exports) {
var type = require('type')
/**
* expose equals
*/
module.exports = equals
equals.compare = compare
/**
* assert all values are equal
*
* @param {Any} [...]
* @return {Boolean}
*/
function equals(){
var i = arguments.length - 1
while (i > 0) {
if (!compare(arguments[i], arguments[--i])) return false
}
return true
}
// (any, any, [array]) -> boolean
function compare(a, b, memos){
// All identical values are equivalent
if (a === b) return true
var fnA = types[type(a)]
var fnB = types[type(b)]
return fnA && fnA === fnB
? fnA(a, b, memos)
: false
}
var types = {}
// (Number) -> boolean
types.number = function(a){
// NaN check
return a !== a
}
// (function, function, array) -> boolean
types['function'] = function(a, b, memos){
return a.toString() === b.toString()
// Functions can act as objects
&& types.object(a, b, memos)
&& compare(a.prototype, b.prototype)
}
// (date, date) -> boolean
types.date = function(a, b){
return +a === +b
}
// (regexp, regexp) -> boolean
types.regexp = function(a, b){
return a.toString() === b.toString()
}
// (DOMElement, DOMElement) -> boolean
types.element = function(a, b){
return a.outerHTML === b.outerHTML
}
// (textnode, textnode) -> boolean
types.textnode = function(a, b){
return a.textContent === b.textContent
}
// decorate `fn` to prevent it re-checking objects
// (function) -> function
function memoGaurd(fn){
return function(a, b, memos){
if (!memos) return fn(a, b, [])
var i = memos.length, memo
while (memo = memos[--i]) {
if (memo[0] === a && memo[1] === b) return true
}
return fn(a, b, memos)
}
}
types['arguments'] =
types.array = memoGaurd(compareArrays)
// (array, array, array) -> boolean
function compareArrays(a, b, memos){
var i = a.length
if (i !== b.length) return false
memos.push([a, b])
while (i--) {
if (!compare(a[i], b[i], memos)) return false
}
return true
}
types.object = memoGaurd(compareObjects)
// (object, object, array) -> boolean
function compareObjects(a, b, memos) {
var ka = getEnumerableProperties(a)
var kb = getEnumerableProperties(b)
var i = ka.length
// same number of properties
if (i !== kb.length) return false
// although not necessarily the same order
ka.sort()
kb.sort()
// cheap key test
while (i--) if (ka[i] !== kb[i]) return false
// remember
memos.push([a, b])
// iterate again this time doing a thorough check
i = ka.length
while (i--) {
var key = ka[i]
if (!compare(a[key], b[key], memos)) return false
}
return true
}
// (object) -> array
function getEnumerableProperties (object) {
var result = []
for (var k in object) if (k !== 'constructor') {
result.push(k)
}
return result
}
}, {"type":112}],
112: [function(require, module, exports) {
var toString = {}.toString
var DomNode = typeof window != 'undefined'
? window.Node
: Function
/**
* Return the type of `val`.
*
* @param {Mixed} val
* @return {String}
* @api public
*/
module.exports = exports = function(x){
var type = typeof x
if (type != 'object') return type
type = types[toString.call(x)]
if (type) return type
if (x instanceof DomNode) switch (x.nodeType) {
case 1: return 'element'
case 3: return 'text-node'
case 9: return 'document'
case 11: return 'document-fragment'
default: return 'dom-node'
}
}
var types = exports.types = {
'[object Function]': 'function',
'[object Date]': 'date',
'[object RegExp]': 'regexp',
'[object Arguments]': 'arguments',
'[object Array]': 'array',
'[object String]': 'string',
'[object Null]': 'null',
'[object Undefined]': 'undefined',
'[object Number]': 'number',
'[object Boolean]': 'boolean',
'[object Object]': 'object',
'[object Text]': 'text-node',
'[object Uint8Array]': 'bit-array',
'[object Uint16Array]': 'bit-array',
'[object Uint32Array]': 'bit-array',
'[object Uint8ClampedArray]': 'bit-array',
'[object Error]': 'error',
'[object FormData]': 'form-data',
'[object File]': 'file',
'[object Blob]': 'blob'
}
}, {}],
107: [function(require, module, exports) {
/**
* Export `fmt`
*/
module.exports = fmt;
/**
* Formatters
*/
fmt.o = JSON.stringify;
fmt.s = String;
fmt.d = parseInt;
/**
* Format the given `str`.
*
* @param {String} str
* @param {...} args
* @return {String}
* @api public
*/
function fmt(str){
var args = [].slice.call(arguments, 1);
var j = 0;
return str.replace(/%([a-z])/gi, function(_, f){
return fmt[f]
? fmt[f](args[j++])
: _ + f;
});
}
}, {}],
111: [function(require, module, exports) {
/**
* Expose `stack()`.
*/
module.exports = stack;
/**
* Return the stack.
*
* @return {Array}
* @api public
*/
function stack() {
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
}
}, {}],
105: [function(require, module, exports) {
module.exports = function after (times, func) {
// After 0, really?
if (times <= 0) return func();
// That's more like it.
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
}, {}],
106: [function(require, module, exports) {
/**
* Module dependencies.
*/
try {
var type = require('type');
} catch (err) {
var type = require('component-type');
}
var toFunction = require('to-function');
/**
* HOP reference.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Iterate the given `obj` and invoke `fn(val, i)`
* in optional context `ctx`.
*
* @param {String|Array|Object} obj
* @param {Function} fn
* @param {Object} [ctx]
* @api public
*/
module.exports = function(obj, fn, ctx){
fn = toFunction(fn);
ctx = ctx || this;
switch (type(obj)) {
case 'array':
return array(obj, fn, ctx);
case 'object':
if ('number' == typeof obj.length) return array(obj, fn, ctx);
return object(obj, fn, ctx);
case 'string':
return string(obj, fn, ctx);
}
};
/**
* Iterate string chars.
*
* @param {String} obj
* @param {Function} fn
* @param {Object} ctx
* @api private
*/
function string(obj, fn, ctx) {
for (var i = 0; i < obj.length; ++i) {
fn.call(ctx, obj.charAt(i), i);
}
}
/**
* Iterate object keys.
*
* @param {Object} obj
* @param {Function} fn
* @param {Object} ctx
* @api private
*/
function object(obj, fn, ctx) {
for (var key in obj) {
if (has.call(obj, key)) {
fn.call(ctx, key, obj[key]);
}
}
}
/**
* Iterate array-ish.
*
* @param {Array|Object} obj
* @param {Function} fn
* @param {Object} ctx
* @api private
*/
function array(obj, fn, ctx) {
for (var i = 0; i < obj.length; ++i) {
fn.call(ctx, obj[i], i);
}
}
}, {"type":7,"component-type":7,"to-function":113}],
113: [function(require, module, exports) {
/**
* Module Dependencies
*/
var expr;
try {
expr = require('props');
} catch(e) {
expr = require('component-props');
}
/**
* Expose `toFunction()`.
*/
module.exports = toFunction;
/**
* Convert `obj` to a `Function`.
*
* @param {Mixed} obj
* @return {Function}
* @api private
*/
function toFunction(obj) {
switch ({}.toString.call(obj)) {
case '[object Object]':
return objectToFunction(obj);
case '[object Function]':
return obj;
case '[object String]':
return stringToFunction(obj);
case '[object RegExp]':
return regexpToFunction(obj);
default:
return defaultToFunction(obj);
}
}
/**
* Default to strict equality.
*
* @param {Mixed} val
* @return {Function}
* @api private
*/
function defaultToFunction(val) {
return function(obj){
return val === obj;
};
}
/**
* Convert `re` to a function.
*
* @param {RegExp} re
* @return {Function}
* @api private
*/
function regexpToFunction(re) {
return function(obj){
return re.test(obj);
};
}
/**
* Convert property `str` to a function.
*
* @param {String} str
* @return {Function}
* @api private
*/
function stringToFunction(str) {
// immediate such as "> 20"
if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str);
// properties such as "name.first" or "age > 18" or "age > 18 && age < 36"
return new Function('_', 'return ' + get(str));
}
/**
* Convert `object` to a function.
*
* @param {Object} object
* @return {Function}
* @api private
*/
function objectToFunction(obj) {
var match = {};
for (var key in obj) {
match[key] = typeof obj[key] === 'string'
? defaultToFunction(obj[key])
: toFunction(obj[key]);
}
return function(val){
if (typeof val !== 'object') return false;
for (var key in match) {
if (!(key in val)) return false;
if (!match[key](val[key])) return false;
}
return true;
};
}
/**
* Built the getter function. Supports getter style functions
*
* @param {String} str
* @return {String}
* @api private
*/
function get(str) {
var props = expr(str);
if (!props.length) return '_.' + str;
var val, i, prop;
for (i = 0; i < props.length; i++) {
prop = props[i];
val = '_.' + prop;
val = "('function' == typeof " + val + " ? " + val + "() : " + val + ")";
// mimic negative lookbehind to avoid problems with nested properties
str = stripNested(prop, str, val);
}
return str;
}
/**
* Mimic negative lookbehind to avoid problems with nested properties.
*
* See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript
*
* @param {String} prop
* @param {String} str
* @param {String} val
* @return {String}
* @api private
*/
function stripNested (prop, str, val) {
return str.replace(new RegExp('(\\.)?' + prop, 'g'), function($0, $1) {
return $1 ? $0 : val;
});
}
}, {"props":114,"component-props":114}],
114: [function(require, module, exports) {
/**
* Global Names
*/
var globals = /\b(this|Array|Date|Object|Math|JSON)\b/g;
/**
* Return immediate identifiers parsed from `str`.
*
* @param {String} str
* @param {String|Function} map function or prefix
* @return {Array}
* @api public
*/
module.exports = function(str, fn){
var p = unique(props(str));
if (fn && 'string' == typeof fn) fn = prefixed(fn);
if (fn) return map(str, p, fn);
return p;
};
/**
* Return immediate identifiers in `str`.
*
* @param {String} str
* @return {Array}
* @api private
*/
function props(str) {
return str
.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, '')
.replace(globals, '')
.match(/[$a-zA-Z_]\w*/g)
|| [];
}
/**
* Return `str` with `props` mapped with `fn`.
*
* @param {String} str
* @param {Array} props
* @param {Function} fn
* @return {String}
* @api private
*/
function map(str, props, fn) {
var re = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;
return str.replace(re, function(_){
if ('(' == _[_.length - 1]) return fn(_);
if (!~props.indexOf(_)) return _;
return fn(_);
});
}
/**
* Return unique array.
*
* @param {Array} arr
* @return {Array}
* @api private
*/
function unique(arr) {
var ret = [];
for (var i = 0; i < arr.length; i++) {
if (~ret.indexOf(arr[i])) continue;
ret.push(arr[i]);
}
return ret;
}
/**
* Map with prefix `str`.
*/
function prefixed(str) {
return function(_){
return str + _;
};
}
}, {}],
93: [function(require, module, exports) {
/**
* Generate a slug from the given `str`.
*
* example:
*
* generate('foo bar');
* // > foo-bar
*
* @param {String} str
* @param {Object} options
* @config {String|RegExp} [replace] characters to replace, defaulted to `/[^a-z0-9]/g`
* @config {String} [separator] separator to insert, defaulted to `-`
* @return {String}
*/
module.exports = function (str, options) {
options || (options = {});
return str.toLowerCase()
.replace(options.replace || /[^a-z0-9]/g, ' ')
.replace(/^ +| +$/g, '')
.replace(/ +/g, options.separator || '-')
};
}, {}],
94: [function(require, module, exports) {
/**
* Module dependencies.
*/
var after = require('after');
var domify = require('component/domify');
var each = require('component/each');
var Emitter = require('emitter');
/**
* Mixin emitter.
*/
Emitter(exports);
/**
* Add a new option to the integration by `key` with default `value`.
*
* @param {String} key
* @param {Mixed} value
* @return {Integration}
*/
exports.option = function(key, value){
this.prototype.defaults[key] = value;
return this;
};
/**
* Add a new mapping option.
*
* This will create a method `name` that will return a mapping
* for you to use.
*
* Example:
*
* Integration('My Integration')
* .mapping('events');
*
* new MyIntegration().track('My Event');
*
* .track = function(track){
* var events = this.events(track.event());
* each(events, send);
* };
*
* @param {String} name
* @return {Integration}
*/
exports.mapping = function(name){
this.option(name, []);
this.prototype[name] = function(str){
return this.map(this.options[name], str);
};
return this;
};
/**
* Register a new global variable `key` owned by the integration, which will be
* used to test whether the integration is already on the page.
*
* @param {String} global
* @return {Integration}
*/
exports.global = function(key){
this.prototype.globals.push(key);
return this;
};
/**
* Mark the integration as assuming an initial pageview, so to defer loading
* the script until the first `page` call, noop the first `initialize`.
*
* @return {Integration}
*/
exports.assumesPageview = function(){
this.prototype._assumesPageview = true;
return this;
};
/**
* Mark the integration as being "ready" once `load` is called.
*
* @return {Integration}
*/
exports.readyOnLoad = function(){
this.prototype._readyOnLoad = true;
return this;
};
/**
* Mark the integration as being "ready" once `initialize` is called.
*
* @return {Integration}
*/
exports.readyOnInitialize = function(){
this.prototype._readyOnInitialize = true;
return this;
};
/**
* Define a tag to be loaded.
*
* @param {String} str DOM tag as string or URL
* @return {Integration}
*/
exports.tag = function(name, str){
if (null == str) {
str = name;
name = 'library';
}
this.prototype.templates[name] = objectify(str);
return this;
};
/**
* Given a string, give back DOM attributes.
*
* Do it in a way where the browser doesn't load images or iframes.
* It turns out, domify will load images/iframes, because
* whenever you construct those DOM elements,
* the browser immediately loads them.
*
* @param {String} str
* @return {Object}
*/
function objectify(str) {
// replace `src` with `data-src` to prevent image loading
str = str.replace(' src="', ' data-src="');
var el = domify(str);
var attrs = {};
each(el.attributes, function(attr){
// then replace it back
var name = 'data-src' == attr.name ? 'src' : attr.name;
attrs[name] = attr.value;
});
return {
type: el.tagName.toLowerCase(),
attrs: attrs
};
}
}, {"after":105,"component/domify":115,"component/each":106,"emitter":102}],
115: [function(require, module, exports) {
/**
* Expose `parse`.
*/
module.exports = parse;
/**
* Tests for browser support.
*/
var div = document.createElement('div');
// Setup
div.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
var innerHTMLBug = !div.getElementsByTagName('link').length;
div = undefined;
/**
* Wrap map from jquery.
*/
var map = {
legend: [1, '<fieldset>', '</fieldset>'],
tr: [2, '<table><tbody>', '</tbody></table>'],
col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
// for script/link/style tags to work in IE6-8, you have to wrap
// in a div with a non-whitespace character in front, ha!
_default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
};
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map.text =
map.circle =
map.ellipse =
map.line =
map.path =
map.polygon =
map.polyline =
map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
/**
* Parse `html` and return a DOM Node instance, which could be a TextNode,
* HTML DOM Node of some kind (<div> for example), or a DocumentFragment
* instance, depending on the contents of the `html` string.
*
* @param {String} html - HTML string to "domify"
* @param {Document} doc - The `document` instance to create the Node for
* @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
* @api private
*/
function parse(html, doc) {
if ('string' != typeof html) throw new TypeError('String expected');
// default to the global `document` object
if (!doc) doc = document;
// tag name
var m = /<([\w:]+)/.exec(html);
if (!m) return doc.createTextNode(html);
html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
var tag = m[1];
// body support
if (tag == 'body') {
var el = doc.createElement('html');
el.innerHTML = html;
return el.removeChild(el.lastChild);
}
// wrap map
var wrap = map[tag] || map._default;
var depth = wrap[0];
var prefix = wrap[1];
var suffix = wrap[2];
var el = doc.createElement('div');
el.innerHTML = prefix + html + suffix;
while (depth--) el = el.lastChild;
// one element
if (el.firstChild == el.lastChild) {
return el.removeChild(el.firstChild);
}
// several elements
var fragment = doc.createDocumentFragment();
while (el.firstChild) {
fragment.appendChild(el.removeChild(el.firstChild));
}
return fragment;
}
}, {}],
84: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toSnakeCase`.
*/
module.exports = toSnakeCase;
/**
* Convert a `string` to snake case.
*
* @param {String} string
* @return {String}
*/
function toSnakeCase (string) {
return toSpace(string).replace(/\s/g, '_');
}
}, {"to-space-case":116}],
116: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toSpaceCase`.
*/
module.exports = toSpaceCase;
/**
* Convert a `string` to space case.
*
* @param {String} string
* @return {String}
*/
function toSpaceCase (string) {
return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
return match ? ' ' + match : '';
});
}
}, {"to-no-case":117}],
117: [function(require, module, exports) {
/**
* Expose `toNoCase`.
*/
module.exports = toNoCase;
/**
* Test whether a string is camel-case.
*/
var hasSpace = /\s/;
var hasCamel = /[a-z][A-Z]/;
var hasSeparator = /[\W_]/;
/**
* Remove any starting case from a `string`, like camel or snake, but keep
* spaces and punctuation that may be important otherwise.
*
* @param {String} string
* @return {String}
*/
function toNoCase (string) {
if (hasSpace.test(string)) return string.toLowerCase();
if (hasSeparator.test(string)) string = unseparate(string);
if (hasCamel.test(string)) string = uncamelize(string);
return string.toLowerCase();
}
/**
* Separator splitter.
*/
var separatorSplitter = /[\W_]+(.|$)/g;
/**
* Un-separate a `string`.
*
* @param {String} string
* @return {String}
*/
function unseparate (string) {
return string.replace(separatorSplitter, function (m, next) {
return next ? ' ' + next : '';
});
}
/**
* Camelcase splitter.
*/
var camelSplitter = /(.)([A-Z]+)/g;
/**
* Un-camelcase a `string`.
*
* @param {String} string
* @return {String}
*/
function uncamelize (string) {
return string.replace(camelSplitter, function (m, previous, uppers) {
return previous + ' ' + uppers.toLowerCase().split('').join(' ');
});
}
}, {}],
85: [function(require, module, exports) {
/**
* Protocol.
*/
module.exports = function (url) {
switch (arguments.length) {
case 0: return check();
case 1: return transform(url);
}
};
/**
* Transform a protocol-relative `url` to the use the proper protocol.
*
* @param {String} url
* @return {String}
*/
function transform (url) {
return check() ? 'https:' + url : 'http:' + url;
}
/**
* Check whether `https:` be used for loading scripts.
*
* @return {Boolean}
*/
function check () {
return (
location.protocol == 'https:' ||
location.protocol == 'chrome-extension:'
);
}
}, {}],
86: [function(require, module, exports) {
var isEmpty = require('is-empty');
try {
var typeOf = require('type');
} catch (e) {
var typeOf = require('component-type');
}
/**
* Types.
*/
var types = [
'arguments',
'array',
'boolean',
'date',
'element',
'function',
'null',
'number',
'object',
'regexp',
'string',
'undefined'
];
/**
* Expose type checkers.
*
* @param {Mixed} value
* @return {Boolean}
*/
for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type);
/**
* Add alias for `function` for old browsers.
*/
exports.fn = exports['function'];
/**
* Expose `empty` check.
*/
exports.empty = isEmpty;
/**
* Expose `nan` check.
*/
exports.nan = function (val) {
return exports.number(val) && val != val;
};
/**
* Generate a type checker.
*
* @param {String} type
* @return {Function}
*/
function generate (type) {
return function (value) {
return type === typeOf(value);
};
}
}, {"is-empty":118,"type":7,"component-type":7}],
118: [function(require, module, exports) {
/**
* Expose `isEmpty`.
*/
module.exports = isEmpty;
/**
* Has.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Test whether a value is "empty".
*
* @param {Mixed} val
* @return {Boolean}
*/
function isEmpty (val) {
if (null == val) return true;
if ('number' == typeof val) return 0 === val;
if (undefined !== val.length) return 0 === val.length;
for (var key in val) if (has.call(val, key)) return false;
return true;
}
}, {}],
9: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var domify = require('domify');
var each = require('each');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `AdWords`.
*/
var AdWords = module.exports = integration('AdWords')
.option('conversionId', '')
.option('remarketing', false)
.tag('<script src="//www.googleadservices.com/pagead/conversion_async.js">')
.mapping('events');
/**
* Load.
*
* @param {Function} fn
* @api public
*/
AdWords.prototype.initialize = function(){
this.load(this.ready);
};
/**
* Loaded.
*
* @return {Boolean}
* @api public
*/
AdWords.prototype.loaded = function(){
return !! document.body;
};
/**
* Page.
*
* https://support.google.com/adwords/answer/3111920#standard_parameters
* https://support.google.com/adwords/answer/3103357
* https://developers.google.com/adwords-remarketing-tag/asynchronous/
* https://developers.google.com/adwords-remarketing-tag/parameters
*
* @param {Page} page
*/
AdWords.prototype.page = function(page){
var remarketing = !!this.options.remarketing;
var id = this.options.conversionId;
var props = {};
window.google_trackConversion({
google_conversion_id: id,
google_custom_params: props,
google_remarketing_only: remarketing
});
};
/**
* Track.
*
* @param {Track}
* @api public
*/
AdWords.prototype.track = function(track){
var id = this.options.conversionId;
var events = this.events(track.event());
var revenue = track.revenue() || 0;
var remarketing = !!this.options.remarketing;
each(events, function(label){
var props = track.properties();
window.google_trackConversion({
google_conversion_id: id,
// TODO
// google_custom_params: props,
google_conversion_language: 'en',
google_conversion_format: '3',
google_conversion_color: 'ffffff',
google_conversion_label: label,
google_conversion_value: revenue,
google_remarketing_only: remarketing
});
});
};
}, {"analytics.js-integration":83,"domify":119,"each":4}],
119: [function(require, module, exports) {
/**
* Expose `parse`.
*/
module.exports = parse;
/**
* Wrap map from jquery.
*/
var map = {
legend: [1, '<fieldset>', '</fieldset>'],
tr: [2, '<table><tbody>', '</tbody></table>'],
col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
_default: [0, '', '']
};
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map.text =
map.circle =
map.ellipse =
map.line =
map.path =
map.polygon =
map.polyline =
map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
/**
* Parse `html` and return the children.
*
* @param {String} html
* @return {Array}
* @api private
*/
function parse(html) {
if ('string' != typeof html) throw new TypeError('String expected');
html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
// tag name
var m = /<([\w:]+)/.exec(html);
if (!m) return document.createTextNode(html);
var tag = m[1];
// body support
if (tag == 'body') {
var el = document.createElement('html');
el.innerHTML = html;
return el.removeChild(el.lastChild);
}
// wrap map
var wrap = map[tag] || map._default;
var depth = wrap[0];
var prefix = wrap[1];
var suffix = wrap[2];
var el = document.createElement('div');
el.innerHTML = prefix + html + suffix;
while (depth--) el = el.lastChild;
// one element
if (el.firstChild == el.lastChild) {
return el.removeChild(el.firstChild);
}
// several elements
var fragment = document.createDocumentFragment();
while (el.firstChild) {
fragment.appendChild(el.removeChild(el.firstChild));
}
return fragment;
}
}, {}],
10: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose Alexa integration.
*/
var Alexa = module.exports = integration('Alexa')
.assumesPageview()
.global('_atrk_opts')
.option('account', null)
.option('domain', '')
.option('dynamic', true)
.tag('<script src="//d31qbv1cthcecs.cloudfront.net/atrk.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Alexa.prototype.initialize = function(page){
var self = this;
window._atrk_opts = {
atrk_acct: this.options.account,
domain: this.options.domain,
dynamic: this.options.dynamic
};
this.load(function(){
window.atrk();
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Alexa.prototype.loaded = function(){
return !! window.atrk;
};
}, {"analytics.js-integration":83}],
11: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `Amplitude` integration.
*/
var Amplitude = module.exports = integration('Amplitude')
.global('amplitude')
.option('apiKey', '')
.option('trackAllPages', false)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-1.1-min.js">');
/**
* Initialize.
*
* https://github.com/amplitude/Amplitude-Javascript
*
* @param {Object} page
*/
Amplitude.prototype.initialize = function(page){
(function(e,t){var r=e.amplitude||{}; r._q=[];function i(e){r[e]=function(){r._q.push([e].concat(Array.prototype.slice.call(arguments,0)));};} var s=["init","logEvent","setUserId","setGlobalUserProperties","setVersionName","setDomain"]; for (var c=0;c<s.length;c++){i(s[c]);}e.amplitude=r;})(window,document);
window.amplitude.init(this.options.apiKey);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Amplitude.prototype.loaded = function(){
return !! (window.amplitude && window.amplitude.options);
};
/**
* Page.
*
* @param {Page} page
*/
Amplitude.prototype.page = function(page){
var properties = page.properties();
var category = page.category();
var name = page.fullName();
var opts = this.options;
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Identify.
*
* @param {Facade} identify
*/
Amplitude.prototype.identify = function(identify){
var id = identify.userId();
var traits = identify.traits();
if (id) window.amplitude.setUserId(id);
if (traits) window.amplitude.setGlobalUserProperties(traits);
};
/**
* Track.
*
* @param {Track} event
*/
Amplitude.prototype.track = function(track){
var props = track.properties();
var event = track.event();
window.amplitude.logEvent(event, props);
};
}, {"analytics.js-integration":83}],
12: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var load = require('load-script');
var is = require('is');
/**
* Expose plugin.
*/
module.exports = exports = function (analytics) {
analytics.addIntegration(Appcues);
};
/**
* Expose `Appcues` integration.
*/
var Appcues = exports.Integration = integration('Appcues')
.assumesPageview()
.global('Appcues')
.global('AppcuesIdentity')
.option('appcuesId', '')
.option('userId', '')
.option('userEmail', '');
/**
* Initialize.
*
* http://appcues.com/docs/
*
* @param {Object}
*/
Appcues.prototype.initialize = function(){
this.load(function() {
window.Appcues.init();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Appcues.prototype.loaded = function(){
return is.object(window.Appcues);
};
/**
* Load the Appcues library.
*
* @param {Function} callback
*/
Appcues.prototype.load = function(callback){
var script = load('//d2dubfq97s02eu.cloudfront.net/appcues-bundle.min.js', callback);
script.setAttribute('data-appcues-id', this.options.appcuesId);
script.setAttribute('data-user-id', this.options.userId);
script.setAttribute('data-user-email', this.options.userEmail);
};
/**
* Identify.
*
* http://appcues.com/docs#identify
*
* @param {Identify} identify
*/
Appcues.prototype.identify = function(identify){
window.Appcues.identify(identify.traits());
};
}, {"analytics.js-integration":83,"load-script":120,"is":86}],
120: [function(require, module, exports) {
/**
* Module dependencies.
*/
var onload = require('script-onload');
var tick = require('next-tick');
var type = require('type');
/**
* Expose `loadScript`.
*
* @param {Object} options
* @param {Function} fn
* @api public
*/
module.exports = function loadScript(options, fn){
if (!options) throw new Error('Cant load nothing...');
// Allow for the simplest case, just passing a `src` string.
if ('string' == type(options)) options = { src : options };
var https = document.location.protocol === 'https:' ||
document.location.protocol === 'chrome-extension:';
// If you use protocol relative URLs, third-party scripts like Google
// Analytics break when testing with `file:` so this fixes that.
if (options.src && options.src.indexOf('//') === 0) {
options.src = https ? 'https:' + options.src : 'http:' + options.src;
}
// Allow them to pass in different URLs depending on the protocol.
if (https && options.https) options.src = options.https;
else if (!https && options.http) options.src = options.http;
// Make the `<script>` element and insert it before the first script on the
// page, which is guaranteed to exist since this Javascript is running.
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = options.src;
// If we have a fn, attach event handlers, even in IE. Based off of
// the Third-Party Javascript script loading example:
// https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html
if ('function' == type(fn)) {
onload(script, fn);
}
tick(function(){
// Append after event listeners are attached for IE.
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
});
// Return the script element in case they want to do anything special, like
// give it an ID or attributes.
return script;
};
}, {"script-onload":108,"next-tick":97,"type":7}],
13: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var each = require('each');
/**
* Expose `Awesm` integration.
*/
var Awesm = module.exports = integration('awe.sm')
.assumesPageview()
.global('AWESM')
.option('apiKey', '')
.tag('<script src="//widgets.awe.sm/v3/widgets.js?key={{ apiKey }}&async=true">')
.mapping('events');
/**
* Initialize.
*
* http://developers.awe.sm/guides/javascript/
*
* @param {Object} page
*/
Awesm.prototype.initialize = function(page){
window.AWESM = { api_key: this.options.apiKey };
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Awesm.prototype.loaded = function(){
return !! (window.AWESM && window.AWESM._exists);
};
/**
* Track.
*
* @param {Track} track
*/
Awesm.prototype.track = function(track){
var user = this.analytics.user();
var goals = this.events(track.event());
each(goals, function(goal){
window.AWESM.convert(goal, track.cents(), null, user.id());
});
};
}, {"analytics.js-integration":83,"each":4}],
14: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
var noop = function(){};
var onBody = require('on-body');
/**
* Expose `Awesomatic` integration.
*/
var Awesomatic = module.exports = integration('Awesomatic')
.assumesPageview()
.global('Awesomatic')
.global('AwesomaticSettings')
.global('AwsmSetup')
.global('AwsmTmp')
.option('appId', '')
.tag('<script src="https://1c817b7a15b6941337c0-dff9b5f4adb7ba28259631e99c3f3691.ssl.cf2.rackcdn.com/gen/embed.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Awesomatic.prototype.initialize = function(page){
var self = this;
var user = this.analytics.user();
var id = user.id();
var options = user.traits();
options.appId = this.options.appId;
if (id) options.user_id = id;
this.load(function(){
window.Awesomatic.initialize(options, function(){
self.ready(); // need to wait for initialize to callback
});
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Awesomatic.prototype.loaded = function(){
return is.object(window.Awesomatic);
};
}, {"analytics.js-integration":83,"is":86,"on-body":121}],
121: [function(require, module, exports) {
var each = require('each');
/**
* Cache whether `<body>` exists.
*/
var body = false;
/**
* Callbacks to call when the body exists.
*/
var callbacks = [];
/**
* Export a way to add handlers to be invoked once the body exists.
*
* @param {Function} callback A function to call when the body exists.
*/
module.exports = function onBody (callback) {
if (body) {
call(callback);
} else {
callbacks.push(callback);
}
};
/**
* Set an interval to check for `document.body`.
*/
var interval = setInterval(function () {
if (!document.body) return;
body = true;
each(callbacks, call);
clearInterval(interval);
}, 5);
/**
* Call a callback, passing it the body.
*
* @param {Function} callback The callback to call.
*/
function call (callback) {
callback(document.body);
}
}, {"each":106}],
15: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var onbody = require('on-body');
var domify = require('domify');
var extend = require('extend');
var bind = require('bind');
var when = require('when');
var each = require('each');
/**
* HOP.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Noop.
*/
var noop = function(){};
/**
* Expose `Bing`.
*
* https://bingads.microsoft.com/campaign/signup
*/
var Bing = module.exports = integration('Bing Ads')
.option('siteId', '')
.option('domainId', '')
.tag('<script id="mstag_tops" src="//flex.msn.com/mstag/site/{{ siteId }}/mstag.js">')
.mapping('events');
/**
* Initialize.
*
* http://msdn.microsoft.com/en-us/library/bing-ads-campaign-management-campaign-analytics-scripts.aspx
*
* @param {Object} page
*/
Bing.prototype.initialize = function(page){
if (!window.mstag) {
window.mstag = {
loadTag: noop,
time: (new Date()).getTime(),
// they use document.write, which doesn't work when loaded async.
// they provide a way to override it.
// the first time it is called, load the script,
// and only when that script is done, is "loading" done.
_write: writeToAppend
};
};
var self = this;
onbody(function(){
self.load(function(){
var loaded = bind(self, self.loaded);
// poll until this.loaded() is true.
// have to do a weird hack like this because
// the first script loads a second script,
// and only after the second script is it actually loaded.
when(loaded, self.ready);
});
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Bing.prototype.loaded = function(){
return !! (window.mstag && window.mstag.loadTag !== noop);
};
/**
* Track.
*
* @param {Track} track
*/
Bing.prototype.track = function(track){
var events = this.events(track.event());
var revenue = track.revenue() || 0;
var self = this;
each(events, function(goal){
window.mstag.loadTag('analytics', {
domainId: self.options.domainId,
revenue: revenue,
dedup: '1',
type: '1',
actionid: goal
});
});
};
/**
* Convert `document.write` to `document.appendChild`.
*
* TODO: make into a component.
*
* @param {String} str
*/
function writeToAppend(str) {
var first = document.getElementsByTagName('script')[0];
var el = domify(str);
// https://github.com/component/domify/issues/14
if ('script' == el.tagName.toLowerCase() && el.getAttribute('src')) {
var tmp = document.createElement('script');
tmp.src = el.getAttribute('src');
tmp.async = true;
el = tmp;
}
document.body.appendChild(el);
}
}, {"analytics.js-integration":83,"on-body":121,"domify":119,"extend":122,"bind":95,"when":123,"each":4}],
122: [function(require, module, exports) {
module.exports = function extend (object) {
// Takes an unlimited number of extenders.
var args = Array.prototype.slice.call(arguments, 1);
// For each extender, copy their properties on our object.
for (var i = 0, source; source = args[i]; i++) {
if (!source) continue;
for (var property in source) {
object[property] = source[property];
}
}
return object;
};
}, {}],
123: [function(require, module, exports) {
var callback = require('callback');
/**
* Expose `when`.
*/
module.exports = when;
/**
* Loop on a short interval until `condition()` is true, then call `fn`.
*
* @param {Function} condition
* @param {Function} fn
* @param {Number} interval (optional)
*/
function when (condition, fn, interval) {
if (condition()) return callback.async(fn);
var ref = setInterval(function () {
if (!condition()) return;
callback(fn);
clearInterval(ref);
}, interval || 10);
}
}, {"callback":88}],
16: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var Identify = require('facade').Identify;
var Track = require('facade').Track;
var pixel = require('load-pixel')('http://app.bronto.com/public/');
var qs = require('querystring');
var each = require('each');
/**
* Expose `Bronto` integration.
*/
var Bronto = module.exports = integration('Bronto')
.global('__bta')
.option('siteId', '')
.option('host', '')
.tag('<script src="//p.bm23.com/bta.js">');
/**
* Initialize.
*
* http://app.bronto.com/mail/help/help_view/?k=mail:home:api_tracking:tracking_data_store_js#addingjavascriptconversiontrackingtoyoursite
* http://bronto.com/product-blog/features/using-conversion-tracking-private-domain#.Ut_Vk2T8KqB
* http://bronto.com/product-blog/features/javascript-conversion-tracking-setup-and-reporting#.Ut_VhmT8KqB
*
* @param {Object} page
*/
Bronto.prototype.initialize = function(page){
var self = this;
var params = qs.parse(window.location.search);
if (!params._bta_tid && !params._bta_c) {
this.debug('missing tracking URL parameters `_bta_tid` and `_bta_c`.');
}
this.load(function(){
var opts = self.options;
self.bta = new window.__bta(opts.siteId);
if (opts.host) self.bta.setHost(opts.host);
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Bronto.prototype.loaded = function(){
return this.bta;
};
/**
* Completed order.
*
* The cookie is used to link the order being processed back to the delivery,
* message, and contact which makes it a conversion.
* Passing in just the email ensures that the order itself
* gets linked to the contact record in Bronto even if the user
* does not have a tracking cookie.
*
* @param {Track} track
* @api private
*/
Bronto.prototype.completedOrder = function(track){
var user = this.analytics.user();
var products = track.products();
var props = track.properties();
var items = [];
var identify = new Identify({
userId: user.id(),
traits: user.traits()
});
var email = identify.email();
// items
each(products, function(product){
var track = new Track({ properties: product });
items.push({
item_id: track.id() || track.sku(),
desc: product.description || track.name(),
quantity: track.quantity(),
amount: track.price(),
});
});
// add conversion
this.bta.addOrder({
order_id: track.orderId(),
email: email,
// they recommend not putting in a date
// because it needs to be formatted correctly
// YYYY-MM-DDTHH:MM:SS
items: items
});
};
}, {"analytics.js-integration":83,"facade":124,"load-pixel":125,"querystring":126,"each":4}],
124: [function(require, module, exports) {
var Facade = require('./facade');
/**
* Expose `Facade` facade.
*/
module.exports = Facade;
/**
* Expose specific-method facades.
*/
Facade.Alias = require('./alias');
Facade.Group = require('./group');
Facade.Identify = require('./identify');
Facade.Track = require('./track');
Facade.Page = require('./page');
Facade.Screen = require('./screen');
}, {"./facade":127,"./alias":128,"./group":129,"./identify":130,"./track":131,"./page":132,"./screen":133}],
127: [function(require, module, exports) {
var traverse = require('isodate-traverse');
var isEnabled = require('./is-enabled');
var clone = require('./utils').clone;
var type = require('./utils').type;
var address = require('./address');
var objCase = require('obj-case');
var newDate = require('new-date');
/**
* Expose `Facade`.
*/
module.exports = Facade;
/**
* Initialize a new `Facade` with an `obj` of arguments.
*
* @param {Object} obj
*/
function Facade (obj) {
if (!obj.hasOwnProperty('timestamp')) obj.timestamp = new Date();
else obj.timestamp = newDate(obj.timestamp);
traverse(obj);
this.obj = obj;
}
/**
* Mixin address traits.
*/
address(Facade.prototype);
/**
* Return a proxy function for a `field` that will attempt to first use methods,
* and fallback to accessing the underlying object directly. You can specify
* deeply nested fields too like:
*
* this.proxy('options.Librato');
*
* @param {String} field
*/
Facade.prototype.proxy = function (field) {
var fields = field.split('.');
field = fields.shift();
// Call a function at the beginning to take advantage of facaded fields
var obj = this[field] || this.field(field);
if (!obj) return obj;
if (typeof obj === 'function') obj = obj.call(this) || {};
if (fields.length === 0) return transform(obj);
obj = objCase(obj, fields.join('.'));
return transform(obj);
};
/**
* Directly access a specific `field` from the underlying object, returning a
* clone so outsiders don't mess with stuff.
*
* @param {String} field
* @return {Mixed}
*/
Facade.prototype.field = function (field) {
var obj = this.obj[field];
return transform(obj);
};
/**
* Utility method to always proxy a particular `field`. You can specify deeply
* nested fields too like:
*
* Facade.proxy('options.Librato');
*
* @param {String} field
* @return {Function}
*/
Facade.proxy = function (field) {
return function () {
return this.proxy(field);
};
};
/**
* Utility method to directly access a `field`.
*
* @param {String} field
* @return {Function}
*/
Facade.field = function (field) {
return function () {
return this.field(field);
};
};
/**
* Proxy multiple `path`.
*
* @param {String} path
* @return {Array}
*/
Facade.multi = function(path){
return function(){
var multi = this.proxy(path + 's');
if ('array' == type(multi)) return multi;
var one = this.proxy(path);
if (one) one = [clone(one)];
return one || [];
};
};
/**
* Proxy one `path`.
*
* @param {String} path
* @return {Mixed}
*/
Facade.one = function(path){
return function(){
var one = this.proxy(path);
if (one) return one;
var multi = this.proxy(path + 's');
if ('array' == type(multi)) return multi[0];
};
};
/**
* Get the basic json object of this facade.
*
* @return {Object}
*/
Facade.prototype.json = function () {
var ret = clone(this.obj);
if (this.type) ret.type = this.type();
return ret;
};
/**
* Get the options of a call (formerly called "context"). If you pass an
* integration name, it will get the options for that specific integration, or
* undefined if the integration is not enabled.
*
* @param {String} integration (optional)
* @return {Object or Null}
*/
Facade.prototype.context =
Facade.prototype.options = function (integration) {
var options = clone(this.obj.options || this.obj.context) || {};
if (!integration) return clone(options);
if (!this.enabled(integration)) return;
var integrations = this.integrations();
var value = integrations[integration] || objCase(integrations, integration);
if ('boolean' == typeof value) value = {};
return value || {};
};
/**
* Check whether an integration is enabled.
*
* @param {String} integration
* @return {Boolean}
*/
Facade.prototype.enabled = function (integration) {
var allEnabled = this.proxy('options.providers.all');
if (typeof allEnabled !== 'boolean') allEnabled = this.proxy('options.all');
if (typeof allEnabled !== 'boolean') allEnabled = this.proxy('integrations.all');
if (typeof allEnabled !== 'boolean') allEnabled = true;
var enabled = allEnabled && isEnabled(integration);
var options = this.integrations();
// If the integration is explicitly enabled or disabled, use that
// First, check options.providers for backwards compatibility
if (options.providers && options.providers.hasOwnProperty(integration)) {
enabled = options.providers[integration];
}
// Next, check for the integration's existence in 'options' to enable it.
// If the settings are a boolean, use that, otherwise it should be enabled.
if (options.hasOwnProperty(integration)) {
var settings = options[integration];
if (typeof settings === 'boolean') {
enabled = settings;
} else {
enabled = true;
}
}
return enabled ? true : false;
};
/**
* Get all `integration` options.
*
* @param {String} integration
* @return {Object}
* @api private
*/
Facade.prototype.integrations = function(){
return this.obj.integrations
|| this.proxy('options.providers')
|| this.options();
};
/**
* Check whether the user is active.
*
* @return {Boolean}
*/
Facade.prototype.active = function () {
var active = this.proxy('options.active');
if (active === null || active === undefined) active = true;
return active;
};
/**
* Get `sessionId / anonymousId`.
*
* @return {Mixed}
* @api public
*/
Facade.prototype.sessionId =
Facade.prototype.anonymousId = function(){
return this.field('anonymousId')
|| this.field('sessionId');
};
/**
* Get `groupId` from `context.groupId`.
*
* @return {String}
* @api public
*/
Facade.prototype.groupId = Facade.proxy('options.groupId');
/**
* Get the call's "super properties" which are just traits that have been
* passed in as if from an identify call.
*
* @param {Object} aliases
* @return {Object}
*/
Facade.prototype.traits = function (aliases) {
var ret = this.proxy('options.traits') || {};
var id = this.userId();
aliases = aliases || {};
if (id) ret.id = id;
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('options.traits.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
delete ret[alias];
}
return ret;
};
/**
* Add a convenient way to get the library name and version
*/
Facade.prototype.library = function(){
var library = this.proxy('options.library');
if (!library) return { name: 'unknown', version: null };
if (typeof library === 'string') return { name: library, version: null };
return library;
};
/**
* Setup some basic proxies.
*/
Facade.prototype.userId = Facade.field('userId');
Facade.prototype.channel = Facade.field('channel');
Facade.prototype.timestamp = Facade.field('timestamp');
Facade.prototype.userAgent = Facade.proxy('options.userAgent');
Facade.prototype.ip = Facade.proxy('options.ip');
/**
* Return the cloned and traversed object
*
* @param {Mixed} obj
* @return {Mixed}
*/
function transform(obj){
var cloned = clone(obj);
return cloned;
}
}, {"isodate-traverse":134,"./is-enabled":135,"./utils":136,"./address":137,"obj-case":138,"new-date":139}],
134: [function(require, module, exports) {
var is = require('is');
var isodate = require('isodate');
var each;
try {
each = require('each');
} catch (err) {
each = require('each-component');
}
/**
* Expose `traverse`.
*/
module.exports = traverse;
/**
* Traverse an object or array, and return a clone with all ISO strings parsed
* into Date objects.
*
* @param {Object} obj
* @return {Object}
*/
function traverse (input, strict) {
if (strict === undefined) strict = true;
if (is.object(input)) return object(input, strict);
if (is.array(input)) return array(input, strict);
return input;
}
/**
* Object traverser.
*
* @param {Object} obj
* @param {Boolean} strict
* @return {Object}
*/
function object (obj, strict) {
each(obj, function (key, val) {
if (isodate.is(val, strict)) {
obj[key] = isodate.parse(val);
} else if (is.object(val) || is.array(val)) {
traverse(val, strict);
}
});
return obj;
}
/**
* Array traverser.
*
* @param {Array} arr
* @param {Boolean} strict
* @return {Array}
*/
function array (arr, strict) {
each(arr, function (val, x) {
if (is.object(val)) {
traverse(val, strict);
} else if (isodate.is(val, strict)) {
arr[x] = isodate.parse(val);
}
});
return arr;
}
}, {"is":140,"isodate":141,"each":4}],
140: [function(require, module, exports) {
var isEmpty = require('is-empty');
try {
var typeOf = require('type');
} catch (e) {
var typeOf = require('component-type');
}
/**
* Types.
*/
var types = [
'arguments',
'array',
'boolean',
'date',
'element',
'function',
'null',
'number',
'object',
'regexp',
'string',
'undefined'
];
/**
* Expose type checkers.
*
* @param {Mixed} value
* @return {Boolean}
*/
for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type);
/**
* Add alias for `function` for old browsers.
*/
exports.fn = exports['function'];
/**
* Expose `empty` check.
*/
exports.empty = isEmpty;
/**
* Expose `nan` check.
*/
exports.nan = function (val) {
return exports.number(val) && val != val;
};
/**
* Generate a type checker.
*
* @param {String} type
* @return {Function}
*/
function generate (type) {
return function (value) {
return type === typeOf(value);
};
}
}, {"is-empty":118,"type":7,"component-type":7}],
141: [function(require, module, exports) {
/**
* Matcher, slightly modified from:
*
* https://github.com/csnover/js-iso8601/blob/lax/iso8601.js
*/
var matcher = /^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
/**
* Convert an ISO date string to a date. Fallback to native `Date.parse`.
*
* https://github.com/csnover/js-iso8601/blob/lax/iso8601.js
*
* @param {String} iso
* @return {Date}
*/
exports.parse = function (iso) {
var numericKeys = [1, 5, 6, 7, 11, 12];
var arr = matcher.exec(iso);
var offset = 0;
// fallback to native parsing
if (!arr) return new Date(iso);
// remove undefined values
for (var i = 0, val; val = numericKeys[i]; i++) {
arr[val] = parseInt(arr[val], 10) || 0;
}
// allow undefined days and months
arr[2] = parseInt(arr[2], 10) || 1;
arr[3] = parseInt(arr[3], 10) || 1;
// month is 0-11
arr[2]--;
// allow abitrary sub-second precision
arr[8] = arr[8]
? (arr[8] + '00').substring(0, 3)
: 0;
// apply timezone if one exists
if (arr[4] == ' ') {
offset = new Date().getTimezoneOffset();
} else if (arr[9] !== 'Z' && arr[10]) {
offset = arr[11] * 60 + arr[12];
if ('+' == arr[10]) offset = 0 - offset;
}
var millis = Date.UTC(arr[1], arr[2], arr[3], arr[5], arr[6] + offset, arr[7], arr[8]);
return new Date(millis);
};
/**
* Checks whether a `string` is an ISO date string. `strict` mode requires that
* the date string at least have a year, month and date.
*
* @param {String} string
* @param {Boolean} strict
* @return {Boolean}
*/
exports.is = function (string, strict) {
if (strict && false === /^\d{4}-\d{2}-\d{2}/.test(string)) return false;
return matcher.test(string);
};
}, {}],
135: [function(require, module, exports) {
/**
* A few integrations are disabled by default. They must be explicitly
* enabled by setting options[Provider] = true.
*/
var disabled = {
Salesforce: true
};
/**
* Check whether an integration should be enabled by default.
*
* @param {String} integration
* @return {Boolean}
*/
module.exports = function (integration) {
return ! disabled[integration];
};
}, {}],
136: [function(require, module, exports) {
/**
* TODO: use component symlink, everywhere ?
*/
try {
exports.inherit = require('inherit');
exports.clone = require('clone');
exports.type = require('type');
} catch (e) {
exports.inherit = require('inherit-component');
exports.clone = require('clone-component');
exports.type = require('type-component');
}
}, {"inherit":142,"clone":143,"type":7}],
142: [function(require, module, exports) {
module.exports = function(a, b){
var fn = function(){};
fn.prototype = b.prototype;
a.prototype = new fn;
a.prototype.constructor = a;
};
}, {}],
143: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type;
try {
type = require('component-type');
} catch (_) {
type = require('type');
}
/**
* Module exports.
*/
module.exports = clone;
/**
* Clones objects.
*
* @param {Mixed} any object
* @api public
*/
function clone(obj){
switch (type(obj)) {
case 'object':
var copy = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
copy[key] = clone(obj[key]);
}
}
return copy;
case 'array':
var copy = new Array(obj.length);
for (var i = 0, l = obj.length; i < l; i++) {
copy[i] = clone(obj[i]);
}
return copy;
case 'regexp':
// from millermedeiros/amd-utils - MIT
var flags = '';
flags += obj.multiline ? 'm' : '';
flags += obj.global ? 'g' : '';
flags += obj.ignoreCase ? 'i' : '';
return new RegExp(obj.source, flags);
case 'date':
return new Date(obj.getTime());
default: // string, number, boolean, …
return obj;
}
}
}, {"component-type":7,"type":7}],
137: [function(require, module, exports) {
/**
* Module dependencies.
*/
var get = require('obj-case');
/**
* Add address getters to `proto`.
*
* @param {Function} proto
*/
module.exports = function(proto){
proto.zip = trait('postalCode', 'zip');
proto.country = trait('country');
proto.street = trait('street');
proto.state = trait('state');
proto.city = trait('city');
function trait(a, b){
return function(){
var traits = this.traits();
return get(traits, 'address.' + a)
|| get(traits, a)
|| (b ? get(traits, 'address.' + b) : null)
|| (b ? get(traits, b) : null);
};
}
};
}, {"obj-case":138}],
138: [function(require, module, exports) {
var Case = require('case');
var identity = function(_){ return _; };
/**
* Cases
*/
var cases = [
identity,
Case.upper,
Case.lower,
Case.snake,
Case.pascal,
Case.camel,
Case.constant,
Case.title,
Case.capital,
Case.sentence
];
/**
* Module exports, export
*/
module.exports = module.exports.find = multiple(find);
/**
* Export the replacement function, return the modified object
*/
module.exports.replace = function (obj, key, val) {
multiple(replace).apply(this, arguments);
return obj;
};
/**
* Export the delete function, return the modified object
*/
module.exports.del = function (obj, key) {
multiple(del).apply(this, arguments);
return obj;
};
/**
* Compose applying the function to a nested key
*/
function multiple (fn) {
return function (obj, key, val) {
var keys = key.split('.');
if (keys.length === 0) return;
while (keys.length > 1) {
key = keys.shift();
obj = find(obj, key);
if (obj === null || obj === undefined) return;
}
key = keys.shift();
return fn(obj, key, val);
};
}
/**
* Find an object by its key
*
* find({ first_name : 'Calvin' }, 'firstName')
*/
function find (obj, key) {
for (var i = 0; i < cases.length; i++) {
var cased = cases[i](key);
if (obj.hasOwnProperty(cased)) return obj[cased];
}
}
/**
* Delete a value for a given key
*
* del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' }
*/
function del (obj, key) {
for (var i = 0; i < cases.length; i++) {
var cased = cases[i](key);
if (obj.hasOwnProperty(cased)) delete obj[cased];
}
return obj;
}
/**
* Replace an objects existing value with a new one
*
* replace({ a : 'b' }, 'a', 'c') -> { a : 'c' }
*/
function replace (obj, key, val) {
for (var i = 0; i < cases.length; i++) {
var cased = cases[i](key);
if (obj.hasOwnProperty(cased)) obj[cased] = val;
}
return obj;
}
}, {"case":144}],
144: [function(require, module, exports) {
var cases = require('./cases');
/**
* Expose `determineCase`.
*/
module.exports = exports = determineCase;
/**
* Determine the case of a `string`.
*
* @param {String} string
* @return {String|Null}
*/
function determineCase (string) {
for (var key in cases) {
if (key == 'none') continue;
var convert = cases[key];
if (convert(string) == string) return key;
}
return null;
}
/**
* Define a case by `name` with a `convert` function.
*
* @param {String} name
* @param {Object} convert
*/
exports.add = function (name, convert) {
exports[name] = cases[name] = convert;
};
/**
* Add all the `cases`.
*/
for (var key in cases) {
exports.add(key, cases[key]);
}
}, {"./cases":145}],
145: [function(require, module, exports) {
var camel = require('to-camel-case')
, capital = require('to-capital-case')
, constant = require('to-constant-case')
, dot = require('to-dot-case')
, none = require('to-no-case')
, pascal = require('to-pascal-case')
, sentence = require('to-sentence-case')
, slug = require('to-slug-case')
, snake = require('to-snake-case')
, space = require('to-space-case')
, title = require('to-title-case');
/**
* Camel.
*/
exports.camel = camel;
/**
* Pascal.
*/
exports.pascal = pascal;
/**
* Dot. Should precede lowercase.
*/
exports.dot = dot;
/**
* Slug. Should precede lowercase.
*/
exports.slug = slug;
/**
* Snake. Should precede lowercase.
*/
exports.snake = snake;
/**
* Space. Should precede lowercase.
*/
exports.space = space;
/**
* Constant. Should precede uppercase.
*/
exports.constant = constant;
/**
* Capital. Should precede sentence and title.
*/
exports.capital = capital;
/**
* Title.
*/
exports.title = title;
/**
* Sentence.
*/
exports.sentence = sentence;
/**
* Convert a `string` to lower case from camel, slug, etc. Different that the
* usual `toLowerCase` in that it will try to break apart the input first.
*
* @param {String} string
* @return {String}
*/
exports.lower = function (string) {
return none(string).toLowerCase();
};
/**
* Convert a `string` to upper case from camel, slug, etc. Different that the
* usual `toUpperCase` in that it will try to break apart the input first.
*
* @param {String} string
* @return {String}
*/
exports.upper = function (string) {
return none(string).toUpperCase();
};
/**
* Invert each character in a `string` from upper to lower and vice versa.
*
* @param {String} string
* @return {String}
*/
exports.inverse = function (string) {
for (var i = 0, char; char = string[i]; i++) {
if (!/[a-z]/i.test(char)) continue;
var upper = char.toUpperCase();
var lower = char.toLowerCase();
string[i] = char == upper ? lower : upper;
}
return string;
};
/**
* None.
*/
exports.none = none;
}, {"to-camel-case":146,"to-capital-case":147,"to-constant-case":148,"to-dot-case":149,"to-no-case":117,"to-pascal-case":150,"to-sentence-case":151,"to-slug-case":152,"to-snake-case":153,"to-space-case":154,"to-title-case":155}],
146: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toCamelCase`.
*/
module.exports = toCamelCase;
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toCamelCase (string) {
return toSpace(string).replace(/\s(\w)/g, function (matches, letter) {
return letter.toUpperCase();
});
}
}, {"to-space-case":154}],
154: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toSpaceCase`.
*/
module.exports = toSpaceCase;
/**
* Convert a `string` to space case.
*
* @param {String} string
* @return {String}
*/
function toSpaceCase (string) {
return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
return match ? ' ' + match : '';
});
}
}, {"to-no-case":117}],
147: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toCapitalCase`.
*/
module.exports = toCapitalCase;
/**
* Convert a `string` to capital case.
*
* @param {String} string
* @return {String}
*/
function toCapitalCase (string) {
return clean(string).replace(/(^|\s)(\w)/g, function (matches, previous, letter) {
return previous + letter.toUpperCase();
});
}
}, {"to-no-case":117}],
148: [function(require, module, exports) {
var snake = require('to-snake-case');
/**
* Expose `toConstantCase`.
*/
module.exports = toConstantCase;
/**
* Convert a `string` to constant case.
*
* @param {String} string
* @return {String}
*/
function toConstantCase (string) {
return snake(string).toUpperCase();
}
}, {"to-snake-case":153}],
153: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toSnakeCase`.
*/
module.exports = toSnakeCase;
/**
* Convert a `string` to snake case.
*
* @param {String} string
* @return {String}
*/
function toSnakeCase (string) {
return toSpace(string).replace(/\s/g, '_');
}
}, {"to-space-case":154}],
149: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toDotCase`.
*/
module.exports = toDotCase;
/**
* Convert a `string` to slug case.
*
* @param {String} string
* @return {String}
*/
function toDotCase (string) {
return toSpace(string).replace(/\s/g, '.');
}
}, {"to-space-case":154}],
150: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toPascalCase`.
*/
module.exports = toPascalCase;
/**
* Convert a `string` to pascal case.
*
* @param {String} string
* @return {String}
*/
function toPascalCase (string) {
return toSpace(string).replace(/(?:^|\s)(\w)/g, function (matches, letter) {
return letter.toUpperCase();
});
}
}, {"to-space-case":154}],
151: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toSentenceCase`.
*/
module.exports = toSentenceCase;
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toSentenceCase (string) {
return clean(string).replace(/[a-z]/i, function (letter) {
return letter.toUpperCase();
});
}
}, {"to-no-case":117}],
152: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toSlugCase`.
*/
module.exports = toSlugCase;
/**
* Convert a `string` to slug case.
*
* @param {String} string
* @return {String}
*/
function toSlugCase (string) {
return toSpace(string).replace(/\s/g, '-');
}
}, {"to-space-case":154}],
155: [function(require, module, exports) {
var capital = require('to-capital-case')
, escape = require('escape-regexp')
, map = require('map')
, minors = require('title-case-minors');
/**
* Expose `toTitleCase`.
*/
module.exports = toTitleCase;
/**
* Minors.
*/
var escaped = map(minors, escape);
var minorMatcher = new RegExp('[^^]\\b(' + escaped.join('|') + ')\\b', 'ig');
var colonMatcher = /:\s*(\w)/g;
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toTitleCase (string) {
return capital(string)
.replace(minorMatcher, function (minor) {
return minor.toLowerCase();
})
.replace(colonMatcher, function (letter) {
return letter.toUpperCase();
});
}
}, {"to-capital-case":147,"escape-regexp":156,"map":157,"title-case-minors":158}],
156: [function(require, module, exports) {
/**
* Escape regexp special characters in `str`.
*
* @param {String} str
* @return {String}
* @api public
*/
module.exports = function(str){
return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g, '\\$1');
};
}, {}],
157: [function(require, module, exports) {
var each = require('each');
/**
* Map an array or object.
*
* @param {Array|Object} obj
* @param {Function} iterator
* @return {Mixed}
*/
module.exports = function map (obj, iterator) {
var arr = [];
each(obj, function (o) {
arr.push(iterator.apply(null, arguments));
});
return arr;
};
}, {"each":106}],
158: [function(require, module, exports) {
module.exports = [
'a',
'an',
'and',
'as',
'at',
'but',
'by',
'en',
'for',
'from',
'how',
'if',
'in',
'neither',
'nor',
'of',
'on',
'only',
'onto',
'out',
'or',
'per',
'so',
'than',
'that',
'the',
'to',
'until',
'up',
'upon',
'v',
'v.',
'versus',
'vs',
'vs.',
'via',
'when',
'with',
'without',
'yet'
];
}, {}],
139: [function(require, module, exports) {
var is = require('is');
var isodate = require('isodate');
var milliseconds = require('./milliseconds');
var seconds = require('./seconds');
/**
* Returns a new Javascript Date object, allowing a variety of extra input types
* over the native Date constructor.
*
* @param {Date|String|Number} val
*/
module.exports = function newDate (val) {
if (is.date(val)) return val;
if (is.number(val)) return new Date(toMs(val));
// date strings
if (isodate.is(val)) return isodate.parse(val);
if (milliseconds.is(val)) return milliseconds.parse(val);
if (seconds.is(val)) return seconds.parse(val);
// fallback to Date.parse
return new Date(val);
};
/**
* If the number passed val is seconds from the epoch, turn it into milliseconds.
* Milliseconds would be greater than 31557600000 (December 31, 1970).
*
* @param {Number} num
*/
function toMs (num) {
if (num < 31557600000) return num * 1000;
return num;
}
}, {"is":159,"isodate":141,"./milliseconds":160,"./seconds":161}],
159: [function(require, module, exports) {
var isEmpty = require('is-empty')
, typeOf = require('type');
/**
* Types.
*/
var types = [
'arguments',
'array',
'boolean',
'date',
'element',
'function',
'null',
'number',
'object',
'regexp',
'string',
'undefined'
];
/**
* Expose type checkers.
*
* @param {Mixed} value
* @return {Boolean}
*/
for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type);
/**
* Add alias for `function` for old browsers.
*/
exports.fn = exports['function'];
/**
* Expose `empty` check.
*/
exports.empty = isEmpty;
/**
* Expose `nan` check.
*/
exports.nan = function (val) {
return exports.number(val) && val != val;
};
/**
* Generate a type checker.
*
* @param {String} type
* @return {Function}
*/
function generate (type) {
return function (value) {
return type === typeOf(value);
};
}
}, {"is-empty":118,"type":7}],
160: [function(require, module, exports) {
/**
* Matcher.
*/
var matcher = /\d{13}/;
/**
* Check whether a string is a millisecond date string.
*
* @param {String} string
* @return {Boolean}
*/
exports.is = function (string) {
return matcher.test(string);
};
/**
* Convert a millisecond string to a date.
*
* @param {String} millis
* @return {Date}
*/
exports.parse = function (millis) {
millis = parseInt(millis, 10);
return new Date(millis);
};
}, {}],
161: [function(require, module, exports) {
/**
* Matcher.
*/
var matcher = /\d{10}/;
/**
* Check whether a string is a second date string.
*
* @param {String} string
* @return {Boolean}
*/
exports.is = function (string) {
return matcher.test(string);
};
/**
* Convert a second string to a date.
*
* @param {String} seconds
* @return {Date}
*/
exports.parse = function (seconds) {
var millis = parseInt(seconds, 10) * 1000;
return new Date(millis);
};
}, {}],
128: [function(require, module, exports) {
/**
* Module dependencies.
*/
var inherit = require('./utils').inherit;
var Facade = require('./facade');
/**
* Expose `Alias` facade.
*/
module.exports = Alias;
/**
* Initialize a new `Alias` facade with a `dictionary` of arguments.
*
* @param {Object} dictionary
* @property {String} from
* @property {String} to
* @property {Object} options
*/
function Alias (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`.
*/
inherit(Alias, Facade);
/**
* Return type of facade.
*
* @return {String}
*/
Alias.prototype.type =
Alias.prototype.action = function () {
return 'alias';
};
/**
* Get `previousId`.
*
* @return {Mixed}
* @api public
*/
Alias.prototype.from =
Alias.prototype.previousId = function(){
return this.field('previousId')
|| this.field('from');
};
/**
* Get `userId`.
*
* @return {String}
* @api public
*/
Alias.prototype.to =
Alias.prototype.userId = function(){
return this.field('userId')
|| this.field('to');
};
}, {"./utils":136,"./facade":127}],
129: [function(require, module, exports) {
/**
* Module dependencies.
*/
var inherit = require('./utils').inherit;
var address = require('./address');
var isEmail = require('is-email');
var newDate = require('new-date');
var Facade = require('./facade');
/**
* Expose `Group` facade.
*/
module.exports = Group;
/**
* Initialize a new `Group` facade with a `dictionary` of arguments.
*
* @param {Object} dictionary
* @param {String} userId
* @param {String} groupId
* @param {Object} properties
* @param {Object} options
*/
function Group (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`
*/
inherit(Group, Facade);
/**
* Get the facade's action.
*/
Group.prototype.type =
Group.prototype.action = function () {
return 'group';
};
/**
* Setup some basic proxies.
*/
Group.prototype.groupId = Facade.field('groupId');
/**
* Get created or createdAt.
*
* @return {Date}
*/
Group.prototype.created = function(){
var created = this.proxy('traits.createdAt')
|| this.proxy('traits.created')
|| this.proxy('properties.createdAt')
|| this.proxy('properties.created');
if (created) return newDate(created);
};
/**
* Get the group's email, falling back to the group ID if it's a valid email.
*
* @return {String}
*/
Group.prototype.email = function () {
var email = this.proxy('traits.email');
if (email) return email;
var groupId = this.groupId();
if (isEmail(groupId)) return groupId;
};
/**
* Get the group's traits.
*
* @param {Object} aliases
* @return {Object}
*/
Group.prototype.traits = function (aliases) {
var ret = this.properties();
var id = this.groupId();
aliases = aliases || {};
if (id) ret.id = id;
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('traits.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
delete ret[alias];
}
return ret;
};
/**
* Special traits.
*/
Group.prototype.name = Facade.proxy('traits.name');
Group.prototype.industry = Facade.proxy('traits.industry');
Group.prototype.employees = Facade.proxy('traits.employees');
/**
* Get traits or properties.
*
* TODO: remove me
*
* @return {Object}
*/
Group.prototype.properties = function(){
return this.field('traits')
|| this.field('properties')
|| {};
};
}, {"./utils":136,"./address":137,"is-email":162,"new-date":139,"./facade":127}],
162: [function(require, module, exports) {
/**
* Expose `isEmail`.
*/
module.exports = isEmail;
/**
* Email address matcher.
*/
var matcher = /.+\@.+\..+/;
/**
* Loosely validate an email address.
*
* @param {String} string
* @return {Boolean}
*/
function isEmail (string) {
return matcher.test(string);
}
}, {}],
130: [function(require, module, exports) {
var address = require('./address');
var Facade = require('./facade');
var isEmail = require('is-email');
var newDate = require('new-date');
var utils = require('./utils');
var get = require('obj-case');
var trim = require('trim');
var inherit = utils.inherit;
var clone = utils.clone;
var type = utils.type;
/**
* Expose `Idenfity` facade.
*/
module.exports = Identify;
/**
* Initialize a new `Identify` facade with a `dictionary` of arguments.
*
* @param {Object} dictionary
* @param {String} userId
* @param {String} sessionId
* @param {Object} traits
* @param {Object} options
*/
function Identify (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`.
*/
inherit(Identify, Facade);
/**
* Get the facade's action.
*/
Identify.prototype.type =
Identify.prototype.action = function () {
return 'identify';
};
/**
* Get the user's traits.
*
* @param {Object} aliases
* @return {Object}
*/
Identify.prototype.traits = function (aliases) {
var ret = this.field('traits') || {};
var id = this.userId();
aliases = aliases || {};
if (id) ret.id = id;
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('traits.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
if (alias !== aliases[alias]) delete ret[alias];
}
return ret;
};
/**
* Get the user's email, falling back to their user ID if it's a valid email.
*
* @return {String}
*/
Identify.prototype.email = function () {
var email = this.proxy('traits.email');
if (email) return email;
var userId = this.userId();
if (isEmail(userId)) return userId;
};
/**
* Get the user's created date, optionally looking for `createdAt` since lots of
* people do that instead.
*
* @return {Date or Undefined}
*/
Identify.prototype.created = function () {
var created = this.proxy('traits.created') || this.proxy('traits.createdAt');
if (created) return newDate(created);
};
/**
* Get the company created date.
*
* @return {Date or undefined}
*/
Identify.prototype.companyCreated = function(){
var created = this.proxy('traits.company.created')
|| this.proxy('traits.company.createdAt');
if (created) return newDate(created);
};
/**
* Get the user's name, optionally combining a first and last name if that's all
* that was provided.
*
* @return {String or Undefined}
*/
Identify.prototype.name = function () {
var name = this.proxy('traits.name');
if (typeof name === 'string') return trim(name);
var firstName = this.firstName();
var lastName = this.lastName();
if (firstName && lastName) return trim(firstName + ' ' + lastName);
};
/**
* Get the user's first name, optionally splitting it out of a single name if
* that's all that was provided.
*
* @return {String or Undefined}
*/
Identify.prototype.firstName = function () {
var firstName = this.proxy('traits.firstName');
if (typeof firstName === 'string') return trim(firstName);
var name = this.proxy('traits.name');
if (typeof name === 'string') return trim(name).split(' ')[0];
};
/**
* Get the user's last name, optionally splitting it out of a single name if
* that's all that was provided.
*
* @return {String or Undefined}
*/
Identify.prototype.lastName = function () {
var lastName = this.proxy('traits.lastName');
if (typeof lastName === 'string') return trim(lastName);
var name = this.proxy('traits.name');
if (typeof name !== 'string') return;
var space = trim(name).indexOf(' ');
if (space === -1) return;
return trim(name.substr(space + 1));
};
/**
* Get the user's unique id.
*
* @return {String or undefined}
*/
Identify.prototype.uid = function(){
return this.userId()
|| this.username()
|| this.email();
};
/**
* Get description.
*
* @return {String}
*/
Identify.prototype.description = function(){
return this.proxy('traits.description')
|| this.proxy('traits.background');
};
/**
* Get the age.
*
* If the age is not explicitly set
* the method will compute it from `.birthday()`
* if possible.
*
* @return {Number}
*/
Identify.prototype.age = function(){
var date = this.birthday();
var age = get(this.traits(), 'age');
if (null != age) return age;
if ('date' != type(date)) return;
var now = new Date;
return now.getFullYear() - date.getFullYear();
};
/**
* Get the avatar.
*
* .photoUrl needed because help-scout
* implementation uses `.avatar || .photoUrl`.
*
* .avatarUrl needed because trakio uses it.
*
* @return {Mixed}
*/
Identify.prototype.avatar = function(){
var traits = this.traits();
return get(traits, 'avatar')
|| get(traits, 'photoUrl')
|| get(traits, 'avatarUrl');
};
/**
* Get the position.
*
* .jobTitle needed because some integrations use it.
*
* @return {Mixed}
*/
Identify.prototype.position = function(){
var traits = this.traits();
return get(traits, 'position') || get(traits, 'jobTitle');
};
/**
* Setup sme basic "special" trait proxies.
*/
Identify.prototype.username = Facade.proxy('traits.username');
Identify.prototype.website = Facade.one('traits.website');
Identify.prototype.websites = Facade.multi('traits.website');
Identify.prototype.phone = Facade.one('traits.phone');
Identify.prototype.phones = Facade.multi('traits.phone');
Identify.prototype.address = Facade.proxy('traits.address');
Identify.prototype.gender = Facade.proxy('traits.gender');
Identify.prototype.birthday = Facade.proxy('traits.birthday');
}, {"./address":137,"./facade":127,"is-email":162,"new-date":139,"./utils":136,"obj-case":138,"trim":163}],
163: [function(require, module, exports) {
exports = module.exports = trim;
function trim(str){
if (str.trim) return str.trim();
return str.replace(/^\s*|\s*$/g, '');
}
exports.left = function(str){
if (str.trimLeft) return str.trimLeft();
return str.replace(/^\s*/, '');
};
exports.right = function(str){
if (str.trimRight) return str.trimRight();
return str.replace(/\s*$/, '');
};
}, {}],
131: [function(require, module, exports) {
var inherit = require('./utils').inherit;
var clone = require('./utils').clone;
var type = require('./utils').type;
var Facade = require('./facade');
var Identify = require('./identify');
var isEmail = require('is-email');
var get = require('obj-case');
/**
* Expose `Track` facade.
*/
module.exports = Track;
/**
* Initialize a new `Track` facade with a `dictionary` of arguments.
*
* @param {object} dictionary
* @property {String} event
* @property {String} userId
* @property {String} sessionId
* @property {Object} properties
* @property {Object} options
*/
function Track (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`.
*/
inherit(Track, Facade);
/**
* Return the facade's action.
*
* @return {String}
*/
Track.prototype.type =
Track.prototype.action = function () {
return 'track';
};
/**
* Setup some basic proxies.
*/
Track.prototype.event = Facade.field('event');
Track.prototype.value = Facade.proxy('properties.value');
/**
* Misc
*/
Track.prototype.category = Facade.proxy('properties.category');
Track.prototype.country = Facade.proxy('properties.country');
Track.prototype.state = Facade.proxy('properties.state');
Track.prototype.city = Facade.proxy('properties.city');
Track.prototype.zip = Facade.proxy('properties.zip');
/**
* Ecommerce
*/
Track.prototype.id = Facade.proxy('properties.id');
Track.prototype.sku = Facade.proxy('properties.sku');
Track.prototype.tax = Facade.proxy('properties.tax');
Track.prototype.name = Facade.proxy('properties.name');
Track.prototype.price = Facade.proxy('properties.price');
Track.prototype.total = Facade.proxy('properties.total');
Track.prototype.coupon = Facade.proxy('properties.coupon');
Track.prototype.shipping = Facade.proxy('properties.shipping');
/**
* Description
*/
Track.prototype.description = Facade.proxy('properties.description');
/**
* Plan
*/
Track.prototype.plan = Facade.proxy('properties.plan');
/**
* Order id.
*
* @return {String}
* @api public
*/
Track.prototype.orderId = function(){
return this.proxy('properties.id')
|| this.proxy('properties.orderId');
};
/**
* Get subtotal.
*
* @return {Number}
*/
Track.prototype.subtotal = function(){
var subtotal = get(this.properties(), 'subtotal');
var total = this.total();
var n;
if (subtotal) return subtotal;
if (!total) return 0;
if (n = this.tax()) total -= n;
if (n = this.shipping()) total -= n;
return total;
};
/**
* Get products.
*
* @return {Array}
*/
Track.prototype.products = function(){
var props = this.properties();
var products = get(props, 'products');
return 'array' == type(products)
? products
: [];
};
/**
* Get quantity.
*
* @return {Number}
*/
Track.prototype.quantity = function(){
var props = this.obj.properties || {};
return props.quantity || 1;
};
/**
* Get currency.
*
* @return {String}
*/
Track.prototype.currency = function(){
var props = this.obj.properties || {};
return props.currency || 'USD';
};
/**
* BACKWARDS COMPATIBILITY: should probably re-examine where these come from.
*/
Track.prototype.referrer = Facade.proxy('properties.referrer');
Track.prototype.query = Facade.proxy('options.query');
/**
* Get the call's properties.
*
* @param {Object} aliases
* @return {Object}
*/
Track.prototype.properties = function (aliases) {
var ret = this.field('properties') || {};
aliases = aliases || {};
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('properties.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
delete ret[alias];
}
return ret;
};
/**
* Get the call's username.
*
* @return {String or Undefined}
*/
Track.prototype.username = function () {
return this.proxy('traits.username') ||
this.proxy('properties.username') ||
this.userId() ||
this.sessionId();
};
/**
* Get the call's email, using an the user ID if it's a valid email.
*
* @return {String or Undefined}
*/
Track.prototype.email = function () {
var email = this.proxy('traits.email');
email = email || this.proxy('properties.email');
if (email) return email;
var userId = this.userId();
if (isEmail(userId)) return userId;
};
/**
* Get the call's revenue, parsing it from a string with an optional leading
* dollar sign.
*
* For products/services that don't have shipping and are not directly taxed,
* they only care about tracking `revenue`. These are things like
* SaaS companies, who sell monthly subscriptions. The subscriptions aren't
* taxed directly, and since it's a digital product, it has no shipping.
*
* The only case where there's a difference between `revenue` and `total`
* (in the context of analytics) is on ecommerce platforms, where they want
* the `revenue` function to actually return the `total` (which includes
* tax and shipping, total = subtotal + tax + shipping). This is probably
* because on their backend they assume tax and shipping has been applied to
* the value, and so can get the revenue on their own.
*
* @return {Number}
*/
Track.prototype.revenue = function () {
var revenue = this.proxy('properties.revenue');
var event = this.event();
// it's always revenue, unless it's called during an order completion.
if (!revenue && event && event.match(/completed ?order/i)) {
revenue = this.proxy('properties.total');
}
return currency(revenue);
};
/**
* Get cents.
*
* @return {Number}
*/
Track.prototype.cents = function(){
var revenue = this.revenue();
return 'number' != typeof revenue
? this.value() || 0
: revenue * 100;
};
/**
* A utility to turn the pieces of a track call into an identify. Used for
* integrations with super properties or rate limits.
*
* TODO: remove me.
*
* @return {Facade}
*/
Track.prototype.identify = function () {
var json = this.json();
json.traits = this.traits();
return new Identify(json);
};
/**
* Get float from currency value.
*
* @param {Mixed} val
* @return {Number}
*/
function currency(val) {
if (!val) return;
if (typeof val === 'number') return val;
if (typeof val !== 'string') return;
val = val.replace(/\$/g, '');
val = parseFloat(val);
if (!isNaN(val)) return val;
}
}, {"./utils":136,"./facade":127,"./identify":130,"is-email":162,"obj-case":138}],
132: [function(require, module, exports) {
var inherit = require('./utils').inherit;
var Facade = require('./facade');
var Track = require('./track');
/**
* Expose `Page` facade
*/
module.exports = Page;
/**
* Initialize new `Page` facade with `dictionary`.
*
* @param {Object} dictionary
* @param {String} category
* @param {String} name
* @param {Object} traits
* @param {Object} options
*/
function Page(dictionary){
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`
*/
inherit(Page, Facade);
/**
* Get the facade's action.
*
* @return {String}
*/
Page.prototype.type =
Page.prototype.action = function(){
return 'page';
};
/**
* Fields
*/
Page.prototype.category = Facade.field('category');
Page.prototype.name = Facade.field('name');
/**
* Proxies.
*/
Page.prototype.title = Facade.proxy('properties.title');
Page.prototype.path = Facade.proxy('properties.path');
Page.prototype.url = Facade.proxy('properties.url');
/**
* Get the page properties mixing `category` and `name`.
*
* @return {Object}
*/
Page.prototype.properties = function(){
var props = this.field('properties') || {};
var category = this.category();
var name = this.name();
if (category) props.category = category;
if (name) props.name = name;
return props;
};
/**
* Get the page fullName.
*
* @return {String}
*/
Page.prototype.fullName = function(){
var category = this.category();
var name = this.name();
return name && category
? category + ' ' + name
: name;
};
/**
* Get event with `name`.
*
* @return {String}
*/
Page.prototype.event = function(name){
return name
? 'Viewed ' + name + ' Page'
: 'Loaded a Page';
};
/**
* Convert this Page to a Track facade with `name`.
*
* @param {String} name
* @return {Track}
*/
Page.prototype.track = function(name){
var props = this.properties();
return new Track({
event: this.event(name),
timestamp: this.timestamp(),
context: this.context(),
properties: props
});
};
}, {"./utils":136,"./facade":127,"./track":131}],
133: [function(require, module, exports) {
var inherit = require('./utils').inherit;
var Page = require('./page');
var Track = require('./track');
/**
* Expose `Screen` facade
*/
module.exports = Screen;
/**
* Initialize new `Screen` facade with `dictionary`.
*
* @param {Object} dictionary
* @param {String} category
* @param {String} name
* @param {Object} traits
* @param {Object} options
*/
function Screen(dictionary){
Page.call(this, dictionary);
}
/**
* Inherit from `Page`
*/
inherit(Screen, Page);
/**
* Get the facade's action.
*
* @return {String}
* @api public
*/
Screen.prototype.type =
Screen.prototype.action = function(){
return 'screen';
};
/**
* Get event with `name`.
*
* @param {String} name
* @return {String}
* @api public
*/
Screen.prototype.event = function(name){
return name
? 'Viewed ' + name + ' Screen'
: 'Loaded a Screen';
};
/**
* Convert this Screen.
*
* @param {String} name
* @return {Track}
* @api public
*/
Screen.prototype.track = function(name){
var props = this.properties();
return new Track({
event: this.event(name),
timestamp: this.timestamp(),
context: this.context(),
properties: props
});
};
}, {"./utils":136,"./page":132,"./track":131}],
125: [function(require, module, exports) {
/**
* Module dependencies.
*/
var stringify = require('querystring').stringify;
var sub = require('substitute');
/**
* Factory function to create a pixel loader.
*
* @param {String} path
* @return {Function}
* @api public
*/
module.exports = function(path){
return function(query, obj, fn){
if ('function' == typeof obj) fn = obj, obj = {};
obj = obj || {};
fn = fn || function(){};
var url = sub(path, obj);
var img = new Image;
img.onerror = error(fn, 'failed to load pixel', img);
img.onload = function(){ fn(); };
query = stringify(query);
if (query) query = '?' + query;
img.src = url + query;
img.width = 1;
img.height = 1;
return img;
};
};
/**
* Create an error handler.
*
* @param {Fucntion} fn
* @param {String} message
* @param {Image} img
* @return {Function}
* @api private
*/
function error(fn, message, img){
return function(e){
e = e || window.event;
var err = new Error(message);
err.event = e;
err.source = img;
fn(err);
};
}
}, {"querystring":126,"substitute":164}],
126: [function(require, module, exports) {
/**
* Module dependencies.
*/
var encode = encodeURIComponent;
var decode = decodeURIComponent;
var trim = require('trim');
var type = require('type');
/**
* Parse the given query `str`.
*
* @param {String} str
* @return {Object}
* @api public
*/
exports.parse = function(str){
if ('string' != typeof str) return {};
str = trim(str);
if ('' == str) return {};
if ('?' == str.charAt(0)) str = str.slice(1);
var obj = {};
var pairs = str.split('&');
for (var i = 0; i < pairs.length; i++) {
var parts = pairs[i].split('=');
var key = decode(parts[0]);
var m;
if (m = /(\w+)\[(\d+)\]/.exec(key)) {
obj[m[1]] = obj[m[1]] || [];
obj[m[1]][m[2]] = decode(parts[1]);
continue;
}
obj[parts[0]] = null == parts[1]
? ''
: decode(parts[1]);
}
return obj;
};
/**
* Stringify the given `obj`.
*
* @param {Object} obj
* @return {String}
* @api public
*/
exports.stringify = function(obj){
if (!obj) return '';
var pairs = [];
for (var key in obj) {
var value = obj[key];
if ('array' == type(value)) {
for (var i = 0; i < value.length; ++i) {
pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
}
continue;
}
pairs.push(encode(key) + '=' + encode(obj[key]));
}
return pairs.join('&');
};
}, {"trim":163,"type":7}],
164: [function(require, module, exports) {
/**
* Expose `substitute`
*/
module.exports = substitute;
/**
* Type.
*/
var type = Object.prototype.toString;
/**
* Substitute `:prop` with the given `obj` in `str`
*
* @param {String} str
* @param {Object or Array} obj
* @param {RegExp} expr
* @return {String}
* @api public
*/
function substitute(str, obj, expr){
if (!obj) throw new TypeError('expected an object');
expr = expr || /:(\w+)/g;
return str.replace(expr, function(_, prop){
switch (type.call(obj)) {
case '[object Object]':
return null != obj[prop] ? obj[prop] : _;
case '[object Array]':
var val = obj.shift();
return null != val ? val : _;
}
});
}
}, {}],
17: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var tick = require('next-tick');
/**
* Expose `BugHerd` integration.
*/
var BugHerd = module.exports = integration('BugHerd')
.assumesPageview()
.global('BugHerdConfig')
.global('_bugHerd')
.option('apiKey', '')
.option('showFeedbackTab', true)
.tag('<script src="//www.bugherd.com/sidebarv2.js?apikey={{ apiKey }}">');
/**
* Initialize.
*
* http://support.bugherd.com/home
*
* @param {Object} page
*/
BugHerd.prototype.initialize = function(page){
window.BugHerdConfig = { feedback: { hide: !this.options.showFeedbackTab }};
var ready = this.ready;
this.load(function(){
tick(ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
BugHerd.prototype.loaded = function(){
return !! window._bugHerd;
};
}, {"analytics.js-integration":83,"next-tick":97}],
18: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
var extend = require('extend');
var onError = require('on-error');
/**
* Expose `Bugsnag` integration.
*/
var Bugsnag = module.exports = integration('Bugsnag')
.global('Bugsnag')
.option('apiKey', '')
.tag('<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js">');
/**
* Initialize.
*
* https://bugsnag.com/docs/notifiers/js
*
* @param {Object} page
*/
Bugsnag.prototype.initialize = function(page){
var self = this;
this.load(function(){
window.Bugsnag.apiKey = self.options.apiKey;
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Bugsnag.prototype.loaded = function(){
return is.object(window.Bugsnag);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Bugsnag.prototype.identify = function(identify){
window.Bugsnag.metaData = window.Bugsnag.metaData || {};
extend(window.Bugsnag.metaData, identify.traits());
};
}, {"analytics.js-integration":83,"is":86,"extend":122,"on-error":165}],
165: [function(require, module, exports) {
/**
* Expose `onError`.
*/
module.exports = onError;
/**
* Callbacks.
*/
var callbacks = [];
/**
* Preserve existing handler.
*/
if ('function' == typeof window.onerror) callbacks.push(window.onerror);
/**
* Bind to `window.onerror`.
*/
window.onerror = handler;
/**
* Error handler.
*/
function handler () {
for (var i = 0, fn; fn = callbacks[i]; i++) fn.apply(this, arguments);
}
/**
* Call a `fn` on `window.onerror`.
*
* @param {Function} fn
*/
function onError (fn) {
callbacks.push(fn);
if (window.onerror != handler) {
callbacks.push(window.onerror);
window.onerror = handler;
}
}
}, {}],
19: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var defaults = require('defaults');
var onBody = require('on-body');
/**
* Expose `Chartbeat` integration.
*/
var Chartbeat = module.exports = integration('Chartbeat')
.assumesPageview()
.global('_sf_async_config')
.global('_sf_endpt')
.global('pSUPERFLY')
.option('domain', '')
.option('uid', null)
.tag('<script src="//static.chartbeat.com/js/chartbeat.js">');
/**
* Initialize.
*
* http://chartbeat.com/docs/configuration_variables/
*
* @param {Object} page
*/
Chartbeat.prototype.initialize = function(page){
var self = this;
window._sf_async_config = window._sf_async_config || {};
window._sf_async_config.useCanonical = true;
defaults(window._sf_async_config, this.options);
onBody(function(){
window._sf_endpt = new Date().getTime();
// Note: Chartbeat depends on document.body existing so the script does
// not load until that is confirmed. Otherwise it may trigger errors.
self.load(self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Chartbeat.prototype.loaded = function(){
return !! window.pSUPERFLY;
};
/**
* Page.
*
* http://chartbeat.com/docs/handling_virtual_page_changes/
*
* @param {Page} page
*/
Chartbeat.prototype.page = function(page){
var props = page.properties();
var name = page.fullName();
window.pSUPERFLY.virtualPage(props.path, name || props.title);
};
}, {"analytics.js-integration":83,"defaults":166,"on-body":121}],
166: [function(require, module, exports) {
/**
* Expose `defaults`.
*/
module.exports = defaults;
function defaults (dest, defaults) {
for (var prop in defaults) {
if (! (prop in dest)) {
dest[prop] = defaults[prop];
}
}
return dest;
};
}, {}],
20: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_cbq');
var each = require('each');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Supported events
*/
var supported = {
activation: true,
changePlan: true,
register: true,
refund: true,
charge: true,
cancel: true,
login: true
};
/**
* Expose `ChurnBee` integration.
*/
var ChurnBee = module.exports = integration('ChurnBee')
.global('_cbq')
.global('ChurnBee')
.option('apiKey', '')
.tag('<script src="//api.churnbee.com/cb.js">')
.mapping('events');
/**
* Initialize.
*
* https://churnbee.com/docs
*
* @param {Object} page
*/
ChurnBee.prototype.initialize = function(page){
push('_setApiKey', this.options.apiKey);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
ChurnBee.prototype.loaded = function(){
return !! window.ChurnBee;
};
/**
* Track.
*
* @param {Track} event
*/
ChurnBee.prototype.track = function(track){
var event = track.event();
var events = this.events(event);
events.push(event);
each(events, function(event){
if (true != supported[event]) return;
push(event, track.properties({ revenue: 'amount' }));
});
};
}, {"analytics.js-integration":83,"global-queue":167,"each":4}],
167: [function(require, module, exports) {
/**
* Expose `generate`.
*/
module.exports = generate;
/**
* Generate a global queue pushing method with `name`.
*
* @param {String} name
* @param {Object} options
* @property {Boolean} wrap
* @return {Function}
*/
function generate (name, options) {
options = options || {};
return function (args) {
args = [].slice.call(arguments);
window[name] || (window[name] = []);
options.wrap === false
? window[name].push.apply(window[name], args)
: window[name].push(args);
};
}
}, {}],
21: [function(require, module, exports) {
/**
* Module dependencies.
*/
var date = require('load-date');
var domify = require('domify');
var each = require('each');
var integration = require('analytics.js-integration');
var is = require('is');
var useHttps = require('use-https');
var onBody = require('on-body');
/**
* Expose `ClickTale` integration.
*/
var ClickTale = module.exports = integration('ClickTale')
.assumesPageview()
.global('WRInitTime')
.global('ClickTale')
.global('ClickTaleSetUID')
.global('ClickTaleField')
.global('ClickTaleEvent')
.option('httpCdnUrl', 'http://s.clicktale.net/WRe0.js')
.option('httpsCdnUrl', '')
.option('projectId', '')
.option('recordingRatio', 0.01)
.option('partitionId', '')
.tag('<script src="{{src}}">');
/**
* Initialize.
*
* http://wiki.clicktale.com/Article/JavaScript_API
*
* @param {Object} page
*/
ClickTale.prototype.initialize = function(page){
var self = this;
window.WRInitTime = date.getTime();
onBody(function(body){
body.appendChild(domify('<div id="ClickTaleDiv" style="display: none;">'));
});
var http = this.options.httpCdnUrl;
var https = this.options.httpsCdnUrl;
if (useHttps() && !https) return this.debug('https option required');
var src = useHttps() ? https : http;
this.load({ src: src }, function(){
window.ClickTale(
self.options.projectId,
self.options.recordingRatio,
self.options.partitionId
);
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
ClickTale.prototype.loaded = function(){
return is.fn(window.ClickTale);
};
/**
* Identify.
*
* http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleSetUID
* http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleField
*
* @param {Identify} identify
*/
ClickTale.prototype.identify = function(identify){
var id = identify.userId();
window.ClickTaleSetUID(id);
each(identify.traits(), function(key, value){
window.ClickTaleField(key, value);
});
};
/**
* Track.
*
* http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleEvent
*
* @param {Track} track
*/
ClickTale.prototype.track = function(track){
window.ClickTaleEvent(track.event());
};
}, {"load-date":168,"domify":119,"each":4,"analytics.js-integration":83,"is":86,"use-https":85,"on-body":121}],
168: [function(require, module, exports) {
/*
* Load date.
*
* For reference: http://www.html5rocks.com/en/tutorials/webperformance/basics/
*/
var time = new Date()
, perf = window.performance;
if (perf && perf.timing && perf.timing.responseEnd) {
time = new Date(perf.timing.responseEnd);
}
module.exports = time;
}, {}],
22: [function(require, module, exports) {
/**
* Module dependencies.
*/
var Identify = require('facade').Identify;
var extend = require('extend');
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `Clicky` integration.
*/
var Clicky = module.exports = integration('Clicky')
.assumesPageview()
.global('clicky')
.global('clicky_site_ids')
.global('clicky_custom')
.option('siteId', null)
.tag('<script src="//static.getclicky.com/js"></script>');
/**
* Initialize.
*
* http://clicky.com/help/customization
*
* @param {Object} page
*/
Clicky.prototype.initialize = function(page){
var user = this.analytics.user();
window.clicky_site_ids = window.clicky_site_ids || [this.options.siteId];
this.identify(new Identify({
userId: user.id(),
traits: user.traits()
}));
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Clicky.prototype.loaded = function(){
return is.object(window.clicky);
};
/**
* Page.
*
* http://clicky.com/help/customization#/help/custom/manual
*
* @param {Page} page
*/
Clicky.prototype.page = function(page){
var properties = page.properties();
var category = page.category();
var name = page.fullName();
window.clicky.log(properties.path, name || properties.title);
};
/**
* Identify.
*
* @param {Identify} id (optional)
*/
Clicky.prototype.identify = function(identify){
window.clicky_custom = window.clicky_custom || {};
window.clicky_custom.session = window.clicky_custom.session || {};
extend(window.clicky_custom.session, identify.traits());
};
/**
* Track.
*
* http://clicky.com/help/customization#/help/custom/manual
*
* @param {Track} event
*/
Clicky.prototype.track = function(track){
window.clicky.goal(track.event(), track.revenue());
};
}, {"facade":124,"extend":122,"analytics.js-integration":83,"is":86}],
23: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
/**
* Expose `Comscore` integration.
*/
var Comscore = module.exports = integration('comScore')
.assumesPageview()
.global('_comscore')
.global('COMSCORE')
.option('c1', '2')
.option('c2', '')
.tag('http', '<script src="http://b.scorecardresearch.com/beacon.js">')
.tag('https', '<script src="https://sb.scorecardresearch.com/beacon.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Comscore.prototype.initialize = function(page){
window._comscore = window._comscore || [this.options];
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Comscore.prototype.loaded = function(){
return !! window.COMSCORE;
};
}, {"analytics.js-integration":83,"use-https":85}],
24: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `CrazyEgg` integration.
*/
var CrazyEgg = module.exports = integration('Crazy Egg')
.assumesPageview()
.global('CE2')
.option('accountNumber', '')
.tag('<script src="//dnn506yrbagrg.cloudfront.net/pages/scripts/{{ path }}.js?{{ cache }}">');
/**
* Initialize.
*
* @param {Object} page
*/
CrazyEgg.prototype.initialize = function(page){
var number = this.options.accountNumber;
var path = number.slice(0,4) + '/' + number.slice(4);
var cache = Math.floor(new Date().getTime() / 3600000);
this.load({ path: path, cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
CrazyEgg.prototype.loaded = function(){
return !! window.CE2;
};
}, {"analytics.js-integration":83}],
25: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_curebitq');
var Identify = require('facade').Identify;
var throttle = require('throttle');
var Track = require('facade').Track;
var iso = require('to-iso-string');
var clone = require('clone');
var each = require('each');
var bind = require('bind');
/**
* Expose `Curebit` integration.
*/
var Curebit = module.exports = integration('Curebit')
.global('_curebitq')
.global('curebit')
.option('siteId', '')
.option('iframeWidth', '100%')
.option('iframeHeight', '480')
.option('iframeBorder', 0)
.option('iframeId', 'curebit_integration')
.option('responsive', true)
.option('device', '')
.option('insertIntoId', '')
.option('campaigns', {})
.option('server', 'https://www.curebit.com')
.tag('<script src="//d2jjzw81hqbuqv.cloudfront.net/integration/curebit-1.0.min.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Curebit.prototype.initialize = function(page){
push('init', { site_id: this.options.siteId, server: this.options.server });
this.load(this.ready);
// throttle the call to `page` since curebit needs to append an iframe
this.page = throttle(bind(this, this.page), 250);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Curebit.prototype.loaded = function(){
return !!window.curebit;
};
/**
* Page.
*
* Call the `register_affiliate` method of the Curebit API that will load a
* custom iframe onto the page, only if this page's path is marked as a
* campaign.
*
* http://www.curebit.com/docs/affiliate/registration
*
* This is throttled to prevent accidentally drawing the iframe multiple times,
* from multiple `.page()` calls. The `250` is from the curebit script.
*
* @param {String} url
* @param {String} id
* @param {Function} fn
* @api private
*/
Curebit.prototype.injectIntoId = function(url, id, fn){
var server = this.options.server;
when(function(){
return document.getElementById(id);
}, function(){
var script = document.createElement('script');
script.src = url;
var parent = document.getElementById(id);
parent.appendChild(script);
onload(script, fn);
});
};
/**
* Campaign tags.
*
* @param {Page} page
*/
Curebit.prototype.page = function(page){
var user = this.analytics.user();
var campaigns = this.options.campaigns;
var path = window.location.pathname;
if (!campaigns[path]) return;
var tags = (campaigns[path] || '').split(',');
if (!tags.length) return;
var settings = {
responsive: this.options.responsive,
device: this.options.device,
campaign_tags: tags,
iframe: {
width: this.options.iframeWidth,
height: this.options.iframeHeight,
id: this.options.iframeId,
frameborder: this.options.iframeBorder,
container: this.options.insertIntoId
}
};
var identify = new Identify({
userId: user.id(),
traits: user.traits()
});
// if we have an email, add any information about the user
if (identify.email()) {
settings.affiliate_member = {
email: identify.email(),
first_name: identify.firstName(),
last_name: identify.lastName(),
customer_id: identify.userId()
};
}
push('register_affiliate', settings);
};
/**
* Completed order.
*
* Fire the Curebit `register_purchase` with the order details and items.
*
* https://www.curebit.com/docs/ecommerce/custom
*
* @param {Track} track
*/
Curebit.prototype.completedOrder = function(track){
var user = this.analytics.user();
var orderId = track.orderId();
var products = track.products();
var props = track.properties();
var items = [];
var identify = new Identify({
traits: user.traits(),
userId: user.id()
});
each(products, function(product){
var track = new Track({ properties: product });
items.push({
product_id: track.id() || track.sku(),
quantity: track.quantity(),
image_url: product.image,
price: track.price(),
title: track.name(),
url: product.url,
});
});
push('register_purchase', {
order_date: iso(props.date || new Date()),
order_number: orderId,
coupon_code: track.coupon(),
subtotal: track.total(),
customer_id: identify.userId(),
first_name: identify.firstName(),
last_name: identify.lastName(),
email: identify.email(),
items: items
});
};
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"throttle":169,"to-iso-string":170,"clone":171,"each":4,"bind":95}],
169: [function(require, module, exports) {
/**
* Module exports.
*/
module.exports = throttle;
/**
* Returns a new function that, when invoked, invokes `func` at most one time per
* `wait` milliseconds.
*
* @param {Function} func The `Function` instance to wrap.
* @param {Number} wait The minimum number of milliseconds that must elapse in between `func` invokations.
* @return {Function} A new function that wraps the `func` function passed in.
* @api public
*/
function throttle (func, wait) {
var rtn; // return value
var last = 0; // last invokation timestamp
return function throttled () {
var now = new Date().getTime();
var delta = now - last;
if (delta >= wait) {
rtn = func.apply(this, arguments);
last = now;
}
return rtn;
};
}
}, {}],
170: [function(require, module, exports) {
/**
* Expose `toIsoString`.
*/
module.exports = toIsoString;
/**
* Turn a `date` into an ISO string.
*
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
*
* @param {Date} date
* @return {String}
*/
function toIsoString (date) {
return date.getUTCFullYear()
+ '-' + pad(date.getUTCMonth() + 1)
+ '-' + pad(date.getUTCDate())
+ 'T' + pad(date.getUTCHours())
+ ':' + pad(date.getUTCMinutes())
+ ':' + pad(date.getUTCSeconds())
+ '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5)
+ 'Z';
}
/**
* Pad a `number` with a ten's place zero.
*
* @param {Number} number
* @return {String}
*/
function pad (number) {
var n = number.toString();
return n.length === 1 ? '0' + n : n;
}
}, {}],
171: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type;
try {
type = require('type');
} catch(e){
type = require('type-component');
}
/**
* Module exports.
*/
module.exports = clone;
/**
* Clones objects.
*
* @param {Mixed} any object
* @api public
*/
function clone(obj){
switch (type(obj)) {
case 'object':
var copy = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
copy[key] = clone(obj[key]);
}
}
return copy;
case 'array':
var copy = new Array(obj.length);
for (var i = 0, l = obj.length; i < l; i++) {
copy[i] = clone(obj[i]);
}
return copy;
case 'regexp':
// from millermedeiros/amd-utils - MIT
var flags = '';
flags += obj.multiline ? 'm' : '';
flags += obj.global ? 'g' : '';
flags += obj.ignoreCase ? 'i' : '';
return new RegExp(obj.source, flags);
case 'date':
return new Date(obj.getTime());
default: // string, number, boolean, …
return obj;
}
}
}, {"type":7}],
26: [function(require, module, exports) {
/**
* Module dependencies.
*/
var alias = require('alias');
var convertDates = require('convert-dates');
var Identify = require('facade').Identify;
var integration = require('analytics.js-integration');
/**
* Expose `Customerio` integration.
*/
var Customerio = module.exports = integration('Customer.io')
.assumesPageview()
.global('_cio')
.option('siteId', '')
.tag('<script id="cio-tracker" src="https://assets.customer.io/assets/track.js" data-site-id="{{ siteId }}">');
/**
* Initialize.
*
* http://customer.io/docs/api/javascript.html
*
* @param {Object} page
*/
Customerio.prototype.initialize = function(page){
window._cio = window._cio || [];
(function(){var a,b,c; a = function(f){return function(){window._cio.push([f].concat(Array.prototype.slice.call(arguments,0))); }; }; b = ['identify', 'track']; for (c = 0; c < b.length; c++) {window._cio[b[c]] = a(b[c]); } })();
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Customerio.prototype.loaded = function(){
return (!! window._cio) && (window._cio.push !== Array.prototype.push);
};
/**
* Identify.
*
* http://customer.io/docs/api/javascript.html#section-Identify_customers
*
* @param {Identify} identify
*/
Customerio.prototype.identify = function(identify){
if (!identify.userId()) return this.debug('user id required');
var traits = identify.traits({ created: 'created_at' });
traits = convertDates(traits, convertDate);
window._cio.identify(traits);
};
/**
* Group.
*
* @param {Group} group
*/
Customerio.prototype.group = function(group){
var traits = group.traits();
var user = this.analytics.user();
traits = alias(traits, function(trait){
return 'Group ' + trait;
});
this.identify(new Identify({
userId: user.id(),
traits: traits
}));
};
/**
* Track.
*
* http://customer.io/docs/api/javascript.html#section-Track_a_custom_event
*
* @param {Track} track
*/
Customerio.prototype.track = function(track){
var properties = track.properties();
properties = convertDates(properties, convertDate);
window._cio.track(track.event(), properties);
};
/**
* Convert a date to the format Customer.io supports.
*
* @param {Date} date
* @return {Number}
*/
function convertDate(date){
return Math.floor(date.getTime() / 1000);
}
}, {"alias":172,"convert-dates":173,"facade":124,"analytics.js-integration":83}],
172: [function(require, module, exports) {
var type = require('type');
try {
var clone = require('clone');
} catch (e) {
var clone = require('clone-component');
}
/**
* Expose `alias`.
*/
module.exports = alias;
/**
* Alias an `object`.
*
* @param {Object} obj
* @param {Mixed} method
*/
function alias (obj, method) {
switch (type(method)) {
case 'object': return aliasByDictionary(clone(obj), method);
case 'function': return aliasByFunction(clone(obj), method);
}
}
/**
* Convert the keys in an `obj` using a dictionary of `aliases`.
*
* @param {Object} obj
* @param {Object} aliases
*/
function aliasByDictionary (obj, aliases) {
for (var key in aliases) {
if (undefined === obj[key]) continue;
obj[aliases[key]] = obj[key];
delete obj[key];
}
return obj;
}
/**
* Convert the keys in an `obj` using a `convert` function.
*
* @param {Object} obj
* @param {Function} convert
*/
function aliasByFunction (obj, convert) {
// have to create another object so that ie8 won't infinite loop on keys
var output = {};
for (var key in obj) output[convert(key)] = obj[key];
return output;
}
}, {"type":7,"clone":143}],
173: [function(require, module, exports) {
var is = require('is');
try {
var clone = require('clone');
} catch (e) {
var clone = require('clone-component');
}
/**
* Expose `convertDates`.
*/
module.exports = convertDates;
/**
* Recursively convert an `obj`'s dates to new values.
*
* @param {Object} obj
* @param {Function} convert
* @return {Object}
*/
function convertDates (obj, convert) {
obj = clone(obj);
for (var key in obj) {
var val = obj[key];
if (is.date(val)) obj[key] = convert(val);
if (is.object(val)) obj[key] = convertDates(val, convert);
}
return obj;
}
}, {"is":86,"clone":89}],
27: [function(require, module, exports) {
/**
* Module dependencies.
*/
var alias = require('alias');
var integration = require('analytics.js-integration');
var is = require('is');
var load = require('load-script');
var push = require('global-queue')('_dcq');
/**
* Expose `Drip` integration.
*/
var Drip = module.exports = integration('Drip')
.assumesPageview()
.global('dc')
.global('_dcq')
.global('_dcs')
.option('account', '')
.tag('<script src="//tag.getdrip.com/{{ account }}.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Drip.prototype.initialize = function(page){
window._dcq = window._dcq || [];
window._dcs = window._dcs || {};
window._dcs.account = this.options.account;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Drip.prototype.loaded = function(){
return is.object(window.dc);
};
/**
* Track.
*
* @param {Track} track
*/
Drip.prototype.track = function(track){
var props = track.properties();
var cents = track.cents();
if (cents) props.value = cents;
delete props.revenue;
push('track', track.event(), props);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Drip.prototype.identify = function (identify) {
push('identify', identify.traits());
};
}, {"alias":172,"analytics.js-integration":83,"is":86,"load-script":120,"global-queue":167}],
28: [function(require, module, exports) {
/**
* Module dependencies.
*/
var extend = require('extend');
var integration = require('analytics.js-integration');
var onError = require('on-error');
var push = require('global-queue')('_errs');
/**
* Expose `Errorception` integration.
*/
var Errorception = module.exports = integration('Errorception')
.assumesPageview()
.global('_errs')
.option('projectId', '')
.option('meta', true)
.tag('<script src="//beacon.errorception.com/{{ projectId }}.js">');
/**
* Initialize.
*
* https://github.com/amplitude/Errorception-Javascript
*
* @param {Object} page
*/
Errorception.prototype.initialize = function(page){
window._errs = window._errs || [this.options.projectId];
onError(push);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Errorception.prototype.loaded = function(){
return !! (window._errs && window._errs.push !== Array.prototype.push);
};
/**
* Identify.
*
* http://blog.errorception.com/2012/11/capture-custom-data-with-your-errors.html
*
* @param {Object} identify
*/
Errorception.prototype.identify = function(identify){
if (!this.options.meta) return;
var traits = identify.traits();
window._errs = window._errs || [];
window._errs.meta = window._errs.meta || {};
extend(window._errs.meta, traits);
};
}, {"extend":122,"analytics.js-integration":83,"on-error":165,"global-queue":167}],
29: [function(require, module, exports) {
/**
* Module dependencies.
*/
var each = require('each');
var integration = require('analytics.js-integration');
var push = require('global-queue')('_aaq');
/**
* Expose `Evergage` integration.integration.
*/
var Evergage = module.exports = integration('Evergage')
.assumesPageview()
.global('_aaq')
.option('account', '')
.option('dataset', '')
.tag('<script src="//cdn.evergage.com/beacon/{{ account }}/{{ dataset }}/scripts/evergage.min.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Evergage.prototype.initialize = function(page){
var account = this.options.account;
var dataset = this.options.dataset;
window._aaq = window._aaq || [];
push('setEvergageAccount', account);
push('setDataset', dataset);
push('setUseSiteConfig', true);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Evergage.prototype.loaded = function(){
return !! (window._aaq && window._aaq.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
Evergage.prototype.page = function(page){
var props = page.properties();
var name = page.name();
if (name) push('namePage', name);
each(props, function(key, value){
push('setCustomField', key, value, 'page');
});
window.Evergage.init(true);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Evergage.prototype.identify = function(identify){
var id = identify.userId();
if (!id) return;
push('setUser', id);
var traits = identify.traits({
email: 'userEmail',
name: 'userName'
});
each(traits, function(key, value){
push('setUserField', key, value, 'page');
});
};
/**
* Group.
*
* @param {Group} group
*/
Evergage.prototype.group = function(group){
var props = group.traits();
var id = group.groupId();
if (!id) return;
push('setCompany', id);
each(props, function(key, value){
push('setAccountField', key, value, 'page');
});
};
/**
* Track.
*
* @param {Track} track
*/
Evergage.prototype.track = function(track){
push('trackAction', track.event(), track.properties());
};
}, {"each":4,"analytics.js-integration":83,"global-queue":167}],
30: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_fbq');
var each = require('each');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `Facebook`
*/
var Facebook = module.exports = integration('Facebook Conversion Tracking')
.global('_fbq')
.option('currency', 'USD')
.tag('<script src="//connect.facebook.net/en_US/fbds.js">')
.mapping('events');
/**
* Initialize Facebook Conversion Tracking
*
* https://developers.facebook.com/docs/ads-for-websites/conversion-pixel-code-migration
*
* @param {Object} page
*/
Facebook.prototype.initialize = function(page){
window._fbq = window._fbq || [];
this.load(this.ready);
window._fbq.loaded = true;
};
/**
* Loaded?
*
* @return {Boolean}
*/
Facebook.prototype.loaded = function(){
return !! (window._fbq && window._fbq.loaded);
};
/**
* Track.
*
* https://developers.facebook.com/docs/reference/ads-api/custom-audience-website-faq/#fbpixel
*
* @param {Track} track
*/
Facebook.prototype.track = function(track){
var event = track.event();
var events = this.events(event);
var revenue = track.revenue() || 0;
var self = this;
each(events, function(event){
push('track', event, {
value: String(revenue.toFixed(2)),
currency: self.options.currency
});
});
if (!events.length) {
var data = track.properties();
push('track', event, data);
}
};
}, {"analytics.js-integration":83,"global-queue":167,"each":4}],
31: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('_fxm');
var integration = require('analytics.js-integration');
var Track = require('facade').Track;
var each = require('each');
/**
* Expose `FoxMetrics` integration.
*/
var FoxMetrics = module.exports = integration('FoxMetrics')
.assumesPageview()
.global('_fxm')
.option('appId', '')
.tag('<script src="//d35tca7vmefkrc.cloudfront.net/scripts/{{ appId }}.js">');
/**
* Initialize.
*
* http://foxmetrics.com/documentation/apijavascript
*
* @param {Object} page
*/
FoxMetrics.prototype.initialize = function(page){
window._fxm = window._fxm || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
FoxMetrics.prototype.loaded = function(){
return !! (window._fxm && window._fxm.appId);
};
/**
* Page.
*
* @param {Page} page
*/
FoxMetrics.prototype.page = function(page){
var properties = page.proxy('properties');
var category = page.category();
var name = page.name();
this._category = category; // store for later
push(
'_fxm.pages.view',
properties.title, // title
name, // name
category, // category
properties.url, // url
properties.referrer // referrer
);
};
/**
* Identify.
*
* @param {Identify} identify
*/
FoxMetrics.prototype.identify = function(identify){
var id = identify.userId();
if (!id) return;
push(
'_fxm.visitor.profile',
id, // user id
identify.firstName(), // first name
identify.lastName(), // last name
identify.email(), // email
identify.address(), // address
undefined, // social
undefined, // partners
identify.traits() // attributes
);
};
/**
* Track.
*
* @param {Track} track
*/
FoxMetrics.prototype.track = function(track){
var props = track.properties();
var category = this._category || props.category;
push(track.event(), category, props);
};
/**
* Viewed product.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.viewedProduct = function(track){
ecommerce('productview', track);
};
/**
* Removed product.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.removedProduct = function(track){
ecommerce('removecartitem', track);
};
/**
* Added product.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.addedProduct = function(track){
ecommerce('cartitem', track);
};
/**
* Completed Order.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.completedOrder = function(track){
var orderId = track.orderId();
// transaction
push(
'_fxm.ecommerce.order',
orderId,
track.subtotal(),
track.shipping(),
track.tax(),
track.city(),
track.state(),
track.zip(),
track.quantity()
);
// items
each(track.products(), function(product){
var track = new Track({ properties: product });
ecommerce('purchaseitem', track, [
track.quantity(),
track.price(),
orderId
]);
});
};
/**
* Track ecommerce `event` with `track`
* with optional `arr` to append.
*
* @param {String} event
* @param {Track} track
* @param {Array} arr
* @api private
*/
function ecommerce(event, track, arr){
push.apply(null, [
'_fxm.ecommerce.' + event,
track.id() || track.sku(),
track.name(),
track.category()
].concat(arr || []));
}
}, {"global-queue":167,"analytics.js-integration":83,"facade":124,"each":4}],
32: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var bind = require('bind');
var when = require('when');
var is = require('is');
/**
* Expose `Frontleaf` integration.
*/
var Frontleaf = module.exports = integration('Frontleaf')
.assumesPageview()
.global('_fl')
.global('_flBaseUrl')
.option('baseUrl', 'https://api.frontleaf.com')
.option('token', '')
.option('stream', '')
.option('trackNamedPages', false)
.option('trackCategorizedPages', false)
.tag('<script id="_fl" src="{{ baseUrl }}/lib/tracker.js">');
/**
* Initialize.
*
* http://docs.frontleaf.com/#/technical-implementation/tracking-customers/tracking-beacon
*
* @param {Object} page
*/
Frontleaf.prototype.initialize = function(page){
window._fl = window._fl || [];
window._flBaseUrl = window._flBaseUrl || this.options.baseUrl;
this._push('setApiToken', this.options.token);
this._push('setStream', this.options.stream);
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load({ baseUrl: window._flBaseUrl }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Frontleaf.prototype.loaded = function(){
return is.array(window._fl) && window._fl.ready === true;
};
/**
* Identify.
*
* @param {Identify} identify
*/
Frontleaf.prototype.identify = function(identify){
var userId = identify.userId();
if (userId) {
this._push('setUser', {
id: userId,
name: identify.name() || identify.username(),
data: clean(identify.traits())
});
}
};
/**
* Group.
*
* @param {Group} group
*/
Frontleaf.prototype.group = function(group){
var groupId = group.groupId();
if (groupId) {
this._push('setAccount', {
id: groupId,
name: group.proxy('traits.name'),
data: clean(group.traits())
});
}
};
/**
* Page.
*
* @param {Page} page
*/
Frontleaf.prototype.page = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Track.
*
* @param {Track} track
*/
Frontleaf.prototype.track = function(track){
var event = track.event();
this._push('event', event, clean(track.properties()));
};
/**
* Push a command onto the global Frontleaf queue.
*
* @param {String} command
* @return {Object} args
* @api private
*/
Frontleaf.prototype._push = function(command){
var args = [].slice.call(arguments, 1);
window._fl.push(function(t){ t[command].apply(command, args); });
};
/**
* Clean all nested objects and arrays.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function clean(obj){
var ret = {};
// Remove traits/properties that are already represented
// outside of the data container
var excludeKeys = ["id","name","firstName","lastName"];
var len = excludeKeys.length;
for (var i = 0; i < len; i++) {
clear(obj, excludeKeys[i]);
}
// Flatten nested hierarchy, preserving arrays
obj = flatten(obj);
// Discard nulls, represent arrays as comma-separated strings
for (var key in obj) {
var val = obj[key];
if (null == val) {
continue;
}
if (is.array(val)) {
ret[key] = val.toString();
continue;
}
ret[key] = val;
}
return ret;
}
/**
* Remove a property from an object if set.
*
* @param {Object} obj
* @param {String} key
* @api private
*/
function clear(obj, key){
if (obj.hasOwnProperty(key)) {
delete obj[key];
}
}
/**
* Flatten a nested object into a single level space-delimited
* hierarchy.
*
* Based on https://github.com/hughsk/flat
*
* @param {Object} source
* @return {Object}
* @api private
*/
function flatten(source){
var output = {};
function step(object, prev){
for (var key in object) {
var value = object[key];
var newKey = prev ? prev + ' ' + key : key;
if (!is.array(value) && is.object(value)) {
return step(value, newKey);
}
output[newKey] = value;
}
}
step(source);
return output;
}
}, {"analytics.js-integration":83,"bind":95,"when":123,"is":86}],
33: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_gauges');
/**
* Expose `Gauges` integration.
*/
var Gauges = module.exports = integration('Gauges')
.assumesPageview()
.global('_gauges')
.option('siteId', '')
.tag('<script id="gauges-tracker" src="//secure.gaug.es/track.js" data-site-id="{{ siteId }}">');
/**
* Initialize Gauges.
*
* http://get.gaug.es/documentation/tracking/
*
* @param {Object} page
*/
Gauges.prototype.initialize = function(page){
window._gauges = window._gauges || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Gauges.prototype.loaded = function(){
return !! (window._gauges && window._gauges.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
Gauges.prototype.page = function(page){
push('track');
};
}, {"analytics.js-integration":83,"global-queue":167}],
34: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var onBody = require('on-body');
/**
* Expose `GetSatisfaction` integration.
*/
var GetSatisfaction = module.exports = integration('Get Satisfaction')
.assumesPageview()
.global('GSFN')
.option('widgetId', '')
.tag('<script src="https://loader.engage.gsfn.us/loader.js">');
/**
* Initialize.
*
* https://console.getsatisfaction.com/start/101022?signup=true#engage
*
* @param {Object} page
*/
GetSatisfaction.prototype.initialize = function(page){
var self = this;
var widget = this.options.widgetId;
var div = document.createElement('div');
var id = div.id = 'getsat-widget-' + widget;
onBody(function(body){ body.appendChild(div); });
// usually the snippet is sync, so wait for it before initializing the tab
this.load(function(){
window.GSFN.loadWidget(widget, { containerId: id });
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
GetSatisfaction.prototype.loaded = function(){
return !! window.GSFN;
};
}, {"analytics.js-integration":83,"on-body":121}],
35: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_gaq');
var length = require('object').length;
var canonical = require('canonical');
var useHttps = require('use-https');
var Track = require('facade').Track;
var callback = require('callback');
var load = require('load-script');
var keys = require('object').keys;
var dot = require('obj-case');
var each = require('each');
var type = require('type');
var url = require('url');
var is = require('is');
var group;
var user;
/**
* Expose plugin.
*/
module.exports = exports = function(analytics){
analytics.addIntegration(GA);
group = analytics.group();
user = analytics.user();
};
/**
* Expose `GA` integration.
*
* http://support.google.com/analytics/bin/answer.py?hl=en&answer=2558867
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setSiteSpeedSampleRate
*/
var GA = exports.Integration = integration('Google Analytics')
.readyOnLoad()
.global('ga')
.global('gaplugins')
.global('_gaq')
.global('GoogleAnalyticsObject')
.option('anonymizeIp', false)
.option('classic', false)
.option('domain', 'none')
.option('doubleClick', false)
.option('enhancedLinkAttribution', false)
.option('ignoredReferrers', null)
.option('includeSearch', false)
.option('siteSpeedSampleRate', 1)
.option('trackingId', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.option('sendUserId', false)
.option('metrics', {})
.option('dimensions', {})
.tag('library', '<script src="//www.google-analytics.com/analytics.js">')
.tag('double click', '<script src="//stats.g.doubleclick.net/dc.js">')
.tag('http', '<script src="http://www.google-analytics.com/ga.js">')
.tag('https', '<script src="https://ssl.google-analytics.com/ga.js">');
/**
* When in "classic" mode, on `construct` swap all of the method to point to
* their classic counterparts.
*/
GA.on('construct', function(integration){
if (!integration.options.classic) return;
integration.initialize = integration.initializeClassic;
integration.loaded = integration.loadedClassic;
integration.page = integration.pageClassic;
integration.track = integration.trackClassic;
integration.completedOrder = integration.completedOrderClassic;
});
/**
* Initialize.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced
*/
GA.prototype.initialize = function(){
var opts = this.options;
// setup the tracker globals
window.GoogleAnalyticsObject = 'ga';
window.ga = window.ga || function(){
window.ga.q = window.ga.q || [];
window.ga.q.push(arguments);
};
window.ga.l = new Date().getTime();
window.ga('create', opts.trackingId, {
cookieDomain: opts.domain || GA.prototype.defaults.domain, // to protect against empty string
siteSpeedSampleRate: opts.siteSpeedSampleRate,
allowLinker: true
});
// display advertising
if (opts.doubleClick) {
window.ga('require', 'displayfeatures');
}
// send global id
if (opts.sendUserId && user.id()) {
window.ga('set', 'userId', user.id());
}
// anonymize after initializing, otherwise a warning is shown
// in google analytics debugger
if (opts.anonymizeIp) window.ga('set', 'anonymizeIp', true);
// custom dimensions & metrics
var custom = metrics(user.traits(), opts);
if (length(custom)) window.ga('set', custom);
this.load('library', this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
GA.prototype.loaded = function(){
return !! window.gaplugins;
};
/**
* Page.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
*
* @param {Page} page
*/
GA.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
var pageview = {};
var track;
this._category = category; // store for later
// send
window.ga('send', 'pageview', {
page: path(props, this.options),
title: name || props.title,
location: props.url
});
// categorized pages
if (category && this.options.trackCategorizedPages) {
track = page.track(category);
this.track(track, { noninteraction: true });
}
// named pages
if (name && this.options.trackNamedPages) {
track = page.track(name);
this.track(track, { noninteraction: true });
}
};
/**
* Track.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
* https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
*
* @param {Track} event
*/
GA.prototype.track = function(track, options){
var opts = options || track.options(this.name);
var props = track.properties();
window.ga('send', 'event', {
eventAction: track.event(),
eventCategory: props.category || this._category || 'All',
eventLabel: props.label,
eventValue: formatValue(props.value || track.revenue()),
nonInteraction: props.noninteraction || opts.noninteraction
});
};
/**
* Completed order.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#multicurrency
*
* @param {Track} track
* @api private
*/
GA.prototype.completedOrder = function(track){
var total = track.total() || track.revenue() || 0;
var orderId = track.orderId();
var products = track.products();
var props = track.properties();
// orderId is required.
if (!orderId) return;
// require ecommerce
if (!this.ecommerce) {
window.ga('require', 'ecommerce');
this.ecommerce = true;
}
// add transaction
window.ga('ecommerce:addTransaction', {
affiliation: props.affiliation,
shipping: track.shipping(),
revenue: total,
tax: track.tax(),
id: orderId,
currency: track.currency()
});
// add products
each(products, function(product){
var track = new Track({ properties: product });
window.ga('ecommerce:addItem', {
category: track.category(),
quantity: track.quantity(),
price: track.price(),
name: track.name(),
sku: track.sku(),
id: orderId,
currency: track.currency()
});
});
// send
window.ga('ecommerce:send');
};
/**
* Initialize (classic).
*
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration
*/
GA.prototype.initializeClassic = function(){
var opts = this.options;
var anonymize = opts.anonymizeIp;
var db = opts.doubleClick;
var domain = opts.domain;
var enhanced = opts.enhancedLinkAttribution;
var ignore = opts.ignoredReferrers;
var sample = opts.siteSpeedSampleRate;
window._gaq = window._gaq || [];
push('_setAccount', opts.trackingId);
push('_setAllowLinker', true);
if (anonymize) push('_gat._anonymizeIp');
if (domain) push('_setDomainName', domain);
if (sample) push('_setSiteSpeedSampleRate', sample);
if (enhanced) {
var protocol = 'https:' === document.location.protocol ? 'https:' : 'http:';
var pluginUrl = protocol + '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
push('_require', 'inpage_linkid', pluginUrl);
}
if (ignore) {
if (!is.array(ignore)) ignore = [ignore];
each(ignore, function (domain) {
push('_addIgnoredRef', domain);
});
}
if (this.options.doubleClick) {
this.load('double click', this.ready);
} else {
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
}
};
/**
* Loaded? (classic)
*
* @return {Boolean}
*/
GA.prototype.loadedClassic = function(){
return !! (window._gaq && window._gaq.push !== Array.prototype.push);
};
/**
* Page (classic).
*
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration
*
* @param {Page} page
*/
GA.prototype.pageClassic = function(page){
var opts = page.options(this.name);
var category = page.category();
var props = page.properties();
var name = page.fullName();
var track;
push('_trackPageview', path(props, this.options));
// categorized pages
if (category && this.options.trackCategorizedPages) {
track = page.track(category);
this.track(track, { noninteraction: true });
}
// named pages
if (name && this.options.trackNamedPages) {
track = page.track(name);
this.track(track, { noninteraction: true });
}
};
/**
* Track (classic).
*
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking
*
* @param {Track} track
*/
GA.prototype.trackClassic = function(track, options){
var opts = options || track.options(this.name);
var props = track.properties();
var revenue = track.revenue();
var event = track.event();
var category = this._category || props.category || 'All';
var label = props.label;
var value = formatValue(revenue || props.value);
var noninteraction = props.noninteraction || opts.noninteraction;
push('_trackEvent', category, event, label, value, noninteraction);
};
/**
* Completed order.
*
* https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce
* https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce#localcurrencies
*
* @param {Track} track
* @api private
*/
GA.prototype.completedOrderClassic = function(track){
var total = track.total() || track.revenue() || 0;
var orderId = track.orderId();
var products = track.products() || [];
var props = track.properties();
var currency = track.currency();
// required
if (!orderId) return;
// add transaction
push('_addTrans'
, orderId
, props.affiliation
, total
, track.tax()
, track.shipping()
, track.city()
, track.state()
, track.country());
// add items
each(products, function(product){
var track = new Track({ properties: product });
push('_addItem'
, orderId
, track.sku()
, track.name()
, track.category()
, track.price()
, track.quantity());
});
// send
push('_set', 'currencyCode', currency);
push('_trackTrans');
};
/**
* Return the path based on `properties` and `options`.
*
* @param {Object} properties
* @param {Object} options
*/
function path(properties, options) {
if (!properties) return;
var str = properties.path;
if (options.includeSearch && properties.search) str += properties.search;
return str;
}
/**
* Format the value property to Google's liking.
*
* @param {Number} value
* @return {Number}
*/
function formatValue(value) {
if (!value || value < 0) return 0;
return Math.round(value);
}
/**
* Map google's custom dimensions & metrics with `obj`.
*
* Example:
*
* metrics({ revenue: 1.9 }, { { metrics : { revenue: 'metric8' } });
* // => { metric8: 1.9 }
*
* metrics({ revenue: 1.9 }, {});
* // => {}
*
* @param {Object} obj
* @param {Object} data
* @return {Object|null}
* @api private
*/
function metrics(obj, data){
var dimensions = data.dimensions;
var metrics = data.metrics;
var names = keys(metrics).concat(keys(dimensions));
var ret = {};
for (var i = 0; i < names.length; ++i) {
var name = names[i];
var key = metrics[name] || dimensions[name];
var value = dot(obj, name) || obj[name];
if (null == value) continue;
ret[key] = value;
}
return ret;
}
}, {"analytics.js-integration":83,"global-queue":167,"object":174,"canonical":175,"use-https":85,"facade":124,"callback":88,"load-script":120,"obj-case":138,"each":4,"type":7,"url":176,"is":86}],
174: [function(require, module, exports) {
/**
* HOP ref.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Return own keys in `obj`.
*
* @param {Object} obj
* @return {Array}
* @api public
*/
exports.keys = Object.keys || function(obj){
var keys = [];
for (var key in obj) {
if (has.call(obj, key)) {
keys.push(key);
}
}
return keys;
};
/**
* Return own values in `obj`.
*
* @param {Object} obj
* @return {Array}
* @api public
*/
exports.values = function(obj){
var vals = [];
for (var key in obj) {
if (has.call(obj, key)) {
vals.push(obj[key]);
}
}
return vals;
};
/**
* Merge `b` into `a`.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api public
*/
exports.merge = function(a, b){
for (var key in b) {
if (has.call(b, key)) {
a[key] = b[key];
}
}
return a;
};
/**
* Return length of `obj`.
*
* @param {Object} obj
* @return {Number}
* @api public
*/
exports.length = function(obj){
return exports.keys(obj).length;
};
/**
* Check if `obj` is empty.
*
* @param {Object} obj
* @return {Boolean}
* @api public
*/
exports.isEmpty = function(obj){
return 0 == exports.length(obj);
};
}, {}],
175: [function(require, module, exports) {
module.exports = function canonical () {
var tags = document.getElementsByTagName('link');
for (var i = 0, tag; tag = tags[i]; i++) {
if ('canonical' == tag.getAttribute('rel')) return tag.getAttribute('href');
}
};
}, {}],
176: [function(require, module, exports) {
/**
* Parse the given `url`.
*
* @param {String} str
* @return {Object}
* @api public
*/
exports.parse = function(url){
var a = document.createElement('a');
a.href = url;
return {
href: a.href,
host: a.host,
port: a.port,
hash: a.hash,
hostname: a.hostname,
pathname: a.pathname,
protocol: a.protocol,
search: a.search,
query: a.search.slice(1)
}
};
/**
* Check if `url` is absolute.
*
* @param {String} url
* @return {Boolean}
* @api public
*/
exports.isAbsolute = function(url){
if (0 == url.indexOf('//')) return true;
if (~url.indexOf('://')) return true;
return false;
};
/**
* Check if `url` is relative.
*
* @param {String} url
* @return {Boolean}
* @api public
*/
exports.isRelative = function(url){
return ! exports.isAbsolute(url);
};
/**
* Check if `url` is cross domain.
*
* @param {String} url
* @return {Boolean}
* @api public
*/
exports.isCrossDomain = function(url){
url = exports.parse(url);
return url.hostname != location.hostname
|| url.port != location.port
|| url.protocol != location.protocol;
};
}, {}],
36: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('dataLayer', { wrap: false });
var integration = require('analytics.js-integration');
/**
* Expose `GTM`.
*/
var GTM = module.exports = integration('Google Tag Manager')
.assumesPageview()
.global('dataLayer')
.global('google_tag_manager')
.option('containerId', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//www.googletagmanager.com/gtm.js?id={{ containerId }}&l=dataLayer">');
/**
* Initialize.
*
* https://developers.google.com/tag-manager
*
* @param {Object} page
*/
GTM.prototype.initialize = function(){
push({ 'gtm.start': +new Date, event: 'gtm.js' });
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
GTM.prototype.loaded = function(){
return !! (window.dataLayer && [].push != window.dataLayer.push);
};
/**
* Page.
*
* @param {Page} page
* @api public
*/
GTM.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
var opts = this.options;
var track;
// all
if (opts.trackAllPages) {
this.track(page.track());
}
// categorized
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Track.
*
* https://developers.google.com/tag-manager/devguide#events
*
* @param {Track} track
* @api public
*/
GTM.prototype.track = function(track){
var props = track.properties();
props.event = track.event();
push(props);
};
}, {"global-queue":167,"analytics.js-integration":83}],
37: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var Identify = require('facade').Identify;
var Track = require('facade').Track;
var callback = require('callback');
var load = require('load-script');
var onBody = require('on-body');
var each = require('each');
/**
* Expose `GoSquared` integration.
*/
var GoSquared = module.exports = integration('GoSquared')
.assumesPageview()
.global('_gs')
.option('siteToken', '')
.option('anonymizeIP', false)
.option('cookieDomain', null)
.option('useCookies', true)
.option('trackHash', false)
.option('trackLocal', false)
.option('trackParams', true)
.tag('<script src="//d1l6p2sc9645hc.cloudfront.net/tracker.js">');
/**
* Initialize.
*
* https://www.gosquared.com/developer/tracker
* Options: https://www.gosquared.com/developer/tracker/configuration
*
* @param {Object} page
*/
GoSquared.prototype.initialize = function(page){
var self = this;
var options = this.options;
var user = this.analytics.user();
push(options.siteToken);
each(options, function(name, value){
if ('siteToken' == name) return;
if (null == value) return;
push('set', name, value);
});
self.identify(new Identify({
traits: user.traits(),
userId: user.id()
}));
self.load(this.ready);
};
/**
* Loaded? (checks if the tracker version is set)
*
* @return {Boolean}
*/
GoSquared.prototype.loaded = function(){
return !! (window._gs && window._gs.v);
};
/**
* Page.
*
* https://www.gosquared.com/developer/tracker/pageviews
*
* @param {Page} page
*/
GoSquared.prototype.page = function(page){
var props = page.properties();
var name = page.fullName();
push('track', props.path, name || props.title)
};
/**
* Identify.
*
* https://www.gosquared.com/developer/tracker/tagging
*
* @param {Identify} identify
*/
GoSquared.prototype.identify = function(identify){
var traits = identify.traits({ userId: 'userID' });
var username = identify.username();
var email = identify.email();
var id = identify.userId();
if (id) push('set', 'visitorID', id);
var name = email || username || id;
if (name) push('set', 'visitorName', name);
push('set', 'visitor', traits);
};
/**
* Track.
*
* https://www.gosquared.com/developer/tracker/events
*
* @param {Track} track
*/
GoSquared.prototype.track = function(track){
push('event', track.event(), track.properties());
};
/**
* Checked out.
*
* @param {Track} track
* @api private
*/
GoSquared.prototype.completedOrder = function(track){
var products = track.products();
var items = [];
each(products, function(product){
var track = new Track({ properties: product });
items.push({
category: track.category(),
quantity: track.quantity(),
price: track.price(),
name: track.name(),
});
})
push('transaction', track.orderId(), {
revenue: track.total(),
track: true
}, items);
};
/**
* Push to `_gs.q`.
*
* @param {...} args
* @api private
*/
function push(){
var _gs = window._gs = window._gs || function(){
(_gs.q = _gs.q || []).push(arguments);
};
_gs.apply(null, arguments);
}
}, {"analytics.js-integration":83,"facade":124,"callback":88,"load-script":120,"on-body":121,"each":4}],
38: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
/**
* Expose `Heap` integration.
*/
var Heap = module.exports = integration('Heap')
.assumesPageview()
.global('heap')
.global('_heapid')
.option('apiKey', '')
.tag('<script src="//d36lvucg9kzous.cloudfront.net">');
/**
* Initialize.
*
* https://heapanalytics.com/docs#installWeb
*
* @param {Object} page
*/
Heap.prototype.initialize = function(page){
window.heap=window.heap||[];window.heap.load=function(a){window._heapid=a;var d=function(a){return function(){window.heap.push([a].concat(Array.prototype.slice.call(arguments,0)));};},e=["identify","track"];for (var f=0;f<e.length;f++)window.heap[e[f]]=d(e[f]);};
window.heap.load(this.options.apiKey);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Heap.prototype.loaded = function(){
return (window.heap && window.heap.appid);
};
/**
* Identify.
*
* https://heapanalytics.com/docs#identify
*
* @param {Identify} identify
*/
Heap.prototype.identify = function(identify){
var traits = identify.traits();
var username = identify.username();
var id = identify.userId();
var handle = username || id;
if (handle) traits.handle = handle;
delete traits.username;
window.heap.identify(traits);
};
/**
* Track.
*
* https://heapanalytics.com/docs#track
*
* @param {Track} track
*/
Heap.prototype.track = function(track){
window.heap.track(track.event(), track.properties());
};
}, {"analytics.js-integration":83,"alias":172}],
39: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `hellobar.com` integration.
*/
var Hellobar = module.exports = integration('Hello Bar')
.assumesPageview()
.global('_hbq')
.option('apiKey', '')
.tag('<script src="//s3.amazonaws.com/scripts.hellobar.com/{{ apiKey }}.js">');
/**
* Initialize.
*
* https://s3.amazonaws.com/scripts.hellobar.com/bb900665a3090a79ee1db98c3af21ea174bbc09f.js
*
* @param {Object} page
*/
Hellobar.prototype.initialize = function(page){
window._hbq = window._hbq || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Hellobar.prototype.loaded = function(){
return !! (window._hbq && window._hbq.push !== Array.prototype.push);
};
}, {"analytics.js-integration":83}],
40: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `HitTail` integration.
*/
var HitTail = module.exports = integration('HitTail')
.assumesPageview()
.global('htk')
.option('siteId', '')
.tag('<script src="//{{ siteId }}.hittail.com/mlt.js">');
/**
* Initialize.
*
* @param {Object} page
*/
HitTail.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
HitTail.prototype.loaded = function(){
return is.fn(window.htk);
};
}, {"analytics.js-integration":83,"is":86}],
41: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `hublo.com` integration.
*/
var Hublo = module.exports = integration('Hublo')
.assumesPageview()
.global('_hublo_')
.option('apiKey', null)
.tag('<script src="//cdn.hublo.co/{{ apiKey }}.js">');
/**
* Initialize.
*
* https://cdn.hublo.co/5353a2e62b26c1277b000004.js
*
* @param {Object} page
*/
Hublo.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Hublo.prototype.loaded = function(){
return !! (window._hublo_ && typeof window._hublo_.setup === 'function');
};
}, {"analytics.js-integration":83}],
42: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_hsq');
var convert = require('convert-dates');
/**
* Expose `HubSpot` integration.
*/
var HubSpot = module.exports = integration('HubSpot')
.assumesPageview()
.global('_hsq')
.option('portalId', null)
.tag('<script id="hs-analytics" src="https://js.hs-analytics.net/analytics/{{ cache }}/{{ portalId }}.js">');
/**
* Initialize.
*
* @param {Object} page
*/
HubSpot.prototype.initialize = function(page){
window._hsq = [];
var cache = Math.ceil(new Date() / 300000) * 300000;
this.load({ cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
HubSpot.prototype.loaded = function(){
return !! (window._hsq && window._hsq.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {String} category (optional)
* @param {String} name (optional)
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
HubSpot.prototype.page = function(page){
push('_trackPageview');
};
/**
* Identify.
*
* @param {Identify} identify
*/
HubSpot.prototype.identify = function(identify){
if (!identify.email()) return;
var traits = identify.traits();
traits = convertDates(traits);
push('identify', traits);
};
/**
* Track.
*
* @param {Track} track
*/
HubSpot.prototype.track = function(track){
var props = track.properties();
props = convertDates(props);
push('trackEvent', track.event(), props);
};
/**
* Convert all the dates in the HubSpot properties to millisecond times
*
* @param {Object} properties
*/
function convertDates(properties){
return convert(properties, function(date){ return date.getTime(); });
}
}, {"analytics.js-integration":83,"global-queue":167,"convert-dates":173}],
43: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
/**
* Expose `Improvely` integration.
*/
var Improvely = module.exports = integration('Improvely')
.assumesPageview()
.global('_improvely')
.global('improvely')
.option('domain', '')
.option('projectId', null)
.tag('<script src="//{{ domain }}.iljmp.com/improvely.js">');
/**
* Initialize.
*
* http://www.improvely.com/docs/landing-page-code
*
* @param {Object} page
*/
Improvely.prototype.initialize = function(page){
window._improvely = [];
window.improvely = { init: function(e, t){ window._improvely.push(["init", e, t]); }, goal: function(e){ window._improvely.push(["goal", e]); }, label: function(e){ window._improvely.push(["label", e]); }};
var domain = this.options.domain;
var id = this.options.projectId;
window.improvely.init(domain, id);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Improvely.prototype.loaded = function(){
return !! (window.improvely && window.improvely.identify);
};
/**
* Identify.
*
* http://www.improvely.com/docs/labeling-visitors
*
* @param {Identify} identify
*/
Improvely.prototype.identify = function(identify){
var id = identify.userId();
if (id) window.improvely.label(id);
};
/**
* Track.
*
* http://www.improvely.com/docs/conversion-code
*
* @param {Track} track
*/
Improvely.prototype.track = function(track){
var props = track.properties({ revenue: 'amount' });
props.type = track.event();
window.improvely.goal(props);
};
}, {"analytics.js-integration":83,"alias":172}],
44: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_iva');
var Track = require('facade').Track;
var is = require('is');
/**
* HOP.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `InsideVault` integration.
*/
var InsideVault = module.exports = integration('InsideVault')
.global('_iva')
.option('clientId', '')
.option('domain', '')
.tag('<script src="//analytics.staticiv.com/iva.js">')
.mapping('events');
/**
* Initialize.
*
* @param page
*/
InsideVault.prototype.initialize = function(page){
var domain = this.options.domain;
window._iva = window._iva || [];
push('setClientId', this.options.clientId);
if (domain) push('setDomain', domain);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
InsideVault.prototype.loaded = function(){
return !! (window._iva && window._iva.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
InsideVault.prototype.page = function(page){
// they want every landing page to send a "click" event.
push('trackEvent', 'click');
};
/**
* Track.
*
* Tracks everything except 'sale' events.
*
* @param {Track} track
*/
InsideVault.prototype.track = function(track){
var user = this.analytics.user();
var events = this.options.events;
var event = track.event();
var value = track.revenue() || track.value() || 0;
var eventId = track.orderId() || user.id() || '';
if (!has.call(events, event)) return;
event = events[event];
// 'sale' is a special event that will be routed to a table that is deprecated on InsideVault's end.
// They don't want a generic 'sale' event to go to their deprecated table.
if (event != 'sale') {
push('trackEvent', event, value, eventId);
}
};
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"is":86}],
45: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('__insp');
var alias = require('alias');
var clone = require('clone');
/**
* Expose `Inspectlet` integration.
*/
var Inspectlet = module.exports = integration('Inspectlet')
.assumesPageview()
.global('__insp')
.global('__insp_')
.option('wid', '')
.tag('<script src="//www.inspectlet.com/inspectlet.js">');
/**
* Initialize.
*
* https://www.inspectlet.com/dashboard/embedcode/1492461759/initial
*
* @param {Object} page
*/
Inspectlet.prototype.initialize = function(page){
push('wid', this.options.wid);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Inspectlet.prototype.loaded = function(){
return !! window.__insp_;
};
/**
* Identify.
*
* http://www.inspectlet.com/docs#tagging
*
* @param {Identify} identify
*/
Inspectlet.prototype.identify = function (identify) {
var traits = identify.traits({ id: 'userid' });
push('tagSession', traits);
};
/**
* Track.
*
* http://www.inspectlet.com/docs/tags
*
* @param {Track} track
*/
Inspectlet.prototype.track = function(track){
push('tagSession', track.event());
};
}, {"analytics.js-integration":83,"global-queue":167,"alias":172,"clone":171}],
46: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var convertDates = require('convert-dates');
var defaults = require('defaults');
var isEmail = require('is-email');
var load = require('load-script');
var empty = require('is-empty');
var alias = require('alias');
var each = require('each');
var when = require('when');
var is = require('is');
/**
* Expose `Intercom` integration.
*/
var Intercom = module.exports = integration('Intercom')
.assumesPageview()
.global('Intercom')
.option('activator', '#IntercomDefaultWidget')
.option('appId', '')
.option('inbox', false)
.tag('<script src="https://static.intercomcdn.com/intercom.v1.js">');
/**
* Initialize.
*
* http://docs.intercom.io/
* http://docs.intercom.io/#IntercomJS
*
* @param {Object} page
*/
Intercom.prototype.initialize = function(page){
var self = this;
this.load(function(){
when(function(){ return self.loaded(); }, self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Intercom.prototype.loaded = function(){
return is.fn(window.Intercom);
};
/**
* Page.
*
* @param {Page} page
*/
Intercom.prototype.page = function(page){
window.Intercom('update');
};
/**
* Identify.
*
* http://docs.intercom.io/#IntercomJS
*
* @param {Identify} identify
*/
Intercom.prototype.identify = function(identify){
var traits = identify.traits({ userId: 'user_id' });
var activator = this.options.activator;
var opts = identify.options(this.name);
var companyCreated = identify.companyCreated();
var created = identify.created();
var email = identify.email();
var name = identify.name();
var id = identify.userId();
var group = this.analytics.group();
if (!id && !traits.email) return; // one is required
traits.app_id = this.options.appId;
// intercom requires `company` to be an object. default it with group traits
// so that we guarantee an `id` is there, since they require it
if (null != traits.company && !is.object(traits.company)) delete traits.company;
if (traits.company) defaults(traits.company, group.traits());
// name
if (name) traits.name = name;
// handle dates
if (traits.company && companyCreated) traits.company.created = companyCreated;
if (created) traits.created = created;
// convert dates
traits = convertDates(traits, formatDate);
traits = alias(traits, { created: 'created_at'});
if (traits.company) traits.company = alias(traits.company, { created: 'created_at' });
// handle options
if (opts.increments) traits.increments = opts.increments;
if (opts.userHash) traits.user_hash = opts.userHash;
if (opts.user_hash) traits.user_hash = opts.user_hash;
// Intercom, will force the widget to appear
// if the selector is #IntercomDefaultWidget
// so no need to check inbox, just need to check
// that the selector isn't #IntercomDefaultWidget.
if ('#IntercomDefaultWidget' != activator) {
traits.widget = { activator: activator };
}
var method = this._id !== id ? 'boot': 'update';
this._id = id; // cache for next time
window.Intercom(method, traits);
};
/**
* Group.
*
* @param {Group} group
*/
Intercom.prototype.group = function(group){
var props = group.properties();
var id = group.groupId();
if (id) props.id = id;
window.Intercom('update', { company: props });
};
/**
* Track.
*
* @param {Track} track
*/
Intercom.prototype.track = function(track){
window.Intercom('trackEvent', track.event(), track.properties());
};
/**
* Format a date to Intercom's liking.
*
* @param {Date} date
* @return {Number}
*/
function formatDate(date) {
return Math.floor(date / 1000);
}
}, {"analytics.js-integration":83,"convert-dates":173,"defaults":166,"is-email":162,"load-script":120,"is-empty":118,"alias":172,"each":4,"when":123,"is":86}],
47: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `Keen IO` integration.
*/
var Keen = module.exports = integration('Keen IO')
.global('Keen')
.option('projectId', '')
.option('readKey', '')
.option('writeKey', '')
.option('ipAddon', false)
.option('uaAddon', false)
.option('urlAddon', false)
.option('referrerAddon', false)
.option('trackNamedPages', true)
.option('trackAllPages', false)
.option('trackCategorizedPages', true)
.tag('<script src="//d26b395fwzu5fz.cloudfront.net/3.0.7/{{ lib }}.min.js">');
/**
* Initialize.
*
* https://keen.io/docs/
*/
Keen.prototype.initialize = function(){
var options = this.options;
!function(a,b){if(void 0===b[a]){b["_"+a]={},b[a]=function(c){b["_"+a].clients=b["_"+a].clients||{},b["_"+a].clients[c.projectId]=this,this._config=c},b[a].ready=function(c){b["_"+a].ready=b["_"+a].ready||[],b["_"+a].ready.push(c)};for(var c=["addEvent","setGlobalProperties","trackExternalLink","on"],d=0;d<c.length;d++){var e=c[d],f=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};b[a].prototype[e]=f(e)}}}("Keen",window);
this.client = new window.Keen({
projectId: options.projectId,
writeKey: options.writeKey,
readKey: options.readKey
});
// if you have a read-key, then load the full keen library
var lib = this.options.readKey ? 'keen' : 'keen-tracker';
this.load({ lib: lib }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Keen.prototype.loaded = function(){
return !!(window.Keen && window.Keen.prototype.configure);
};
/**
* Page.
*
* @param {Page} page
*/
Keen.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
var opts = this.options;
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Identify.
*
* TODO: migrate from old `userId` to simpler `id`
* https://keen.io/docs/data-collection/data-enrichment/#add-ons
*
* Set up the Keen addons object. These must be specifically
* enabled by the settings in order to include the plugins, or else
* Keen will reject the request.
*
* @param {Identify} identify
*/
Keen.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
var user = {};
var options = this.options;
if (id) user.userId = id;
if (traits) user.traits = traits;
var props = { user: user };
var addons = [];
if (options.ipAddon) {
addons.push({
name: 'keen:ip_to_geo',
input: { ip: 'ip_address' },
output: 'ip_geo_info'
});
props.ip_address = '${keen.ip}';
}
if (options.uaAddon) {
addons.push({
name: 'keen:ua_parser',
input: { ua_string: 'user_agent' },
output: 'parsed_user_agent'
});
props.user_agent = '${keen.user_agent}';
}
if (options.urlAddon) {
addons.push({
name: 'keen:url_parser',
input: { url: 'page_url' },
output: 'parsed_page_url'
});
props.page_url = document.location.href;
}
if (options.referrerAddon) {
addons.push({
name: 'keen:referrer_parser',
input: {
referrer_url: 'referrer_url',
page_url: 'page_url'
},
output: 'referrer_info'
});
props.referrer_url = document.referrer;
props.page_url = document.location.href;
}
props.keen = {
timestamp: identify.timestamp(),
addons: addons
};
this.client.setGlobalProperties(function(){
return props;
});
};
/**
* Track.
*
* @param {Track} track
*/
Keen.prototype.track = function(track){
this.client.addEvent(track.event(), track.properties());
};
}, {"analytics.js-integration":83}],
48: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var indexof = require('indexof');
var is = require('is');
/**
* Expose `Kenshoo` integration.
*/
var Kenshoo = module.exports = integration('Kenshoo')
.global('k_trackevent')
.option('cid', '')
.option('subdomain', '')
.option('events', [])
.tag('<script src="//{{ subdomain }}.xg4ken.com/media/getpx.php?cid={{ cid }}">');
/**
* Initialize.
*
* See https://gist.github.com/justinboyle/7875832
*
* @param {Object} page
*/
Kenshoo.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded? (checks if the tracking function is set)
*
* @return {Boolean}
*/
Kenshoo.prototype.loaded = function(){
return is.fn(window.k_trackevent);
};
/**
* Track.
*
* Only tracks events if they are listed in the events array option.
* We've asked for docs a few times but no go :/
*
* https://github.com/jorgegorka/the_tracker/blob/master/lib/the_tracker/trackers/kenshoo.rb
*
* @param {Track} event
*/
Kenshoo.prototype.track = function(track){
var events = this.options.events;
var traits = track.traits();
var event = track.event();
var revenue = track.revenue() || 0;
if (!~indexof(events, event)) return;
var params = [
'id=' + this.options.cid,
'type=conv',
'val=' + revenue,
'orderId=' + track.orderId(),
'promoCode=' + track.coupon(),
'valueCurrency=' + track.currency(),
// Live tracking fields. Ignored for now (until we get documentation).
'GCID=',
'kw=',
'product='
];
window.k_trackevent(params, this.options.subdomain);
};
}, {"analytics.js-integration":83,"indexof":109,"is":86}],
49: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_kmq');
var Track = require('facade').Track;
var alias = require('alias');
var Batch = require('batch');
var each = require('each');
var is = require('is');
/**
* Expose `KISSmetrics` integration.
*/
var KISSmetrics = module.exports = integration('KISSmetrics')
.assumesPageview()
.global('_kmq')
.global('KM')
.global('_kmil')
.option('apiKey', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.option('prefixProperties', true)
.tag('useless', '<script src="//i.kissmetrics.com/i.js">')
.tag('library', '<script src="//doug1izaerwt3.cloudfront.net/{{ apiKey }}.1.js">');
/**
* Check if browser is mobile, for kissmetrics.
*
* http://support.kissmetrics.com/how-tos/browser-detection.html#mobile-vs-non-mobile
*/
exports.isMobile = navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/iPhone|iPod/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/Opera Mini/i)
|| navigator.userAgent.match(/IEMobile/i);
/**
* Initialize.
*
* http://support.kissmetrics.com/apis/javascript
*
* @param {Object} page
*/
KISSmetrics.prototype.initialize = function(page){
var self = this;
window._kmq = [];
if (exports.isMobile) push('set', { 'Mobile Session': 'Yes' });
var batch = new Batch();
batch.push(function(done){ self.load('useless', done); }) // :)
batch.push(function(done){ self.load('library', done); })
batch.end(function(){
self.trackPage(page);
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
KISSmetrics.prototype.loaded = function(){
return is.object(window.KM);
};
/**
* Page.
*
* @param {Page} page
*/
KISSmetrics.prototype.page = function(page){
if (!window.KM_SKIP_PAGE_VIEW) window.KM.pageView();
this.trackPage(page);
};
/**
* Track page.
*
* @param {Page} page
*/
KISSmetrics.prototype.trackPage = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Identify.
*
* @param {Identify} identify
*/
KISSmetrics.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
if (id) push('identify', id);
if (traits) push('set', traits);
};
/**
* Track.
*
* @param {Track} track
*/
KISSmetrics.prototype.track = function(track){
var mapping = { revenue: 'Billing Amount' };
var event = track.event();
var properties = track.properties(mapping);
if (this.options.prefixProperties) properties = prefix(event, properties);
push('record', event, properties);
};
/**
* Alias.
*
* @param {Alias} to
*/
KISSmetrics.prototype.alias = function(alias){
push('alias', alias.to(), alias.from());
};
/**
* Completed order.
*
* @param {Track} track
* @api private
*/
KISSmetrics.prototype.completedOrder = function(track){
var products = track.products();
var event = track.event();
// transaction
push('record', event, prefix(event, track.properties()));
// items
window._kmq.push(function(){
var km = window.KM;
each(products, function(product, i){
var temp = new Track({ event: event, properties: product });
var item = prefix(event, product);
item._t = km.ts() + i;
item._d = 1;
km.set(item);
});
});
};
/**
* Prefix properties with the event name.
*
* @param {String} event
* @param {Object} properties
* @return {Object} prefixed
* @api private
*/
function prefix(event, properties){
var prefixed = {};
each(properties, function(key, val){
if (key === 'Billing Amount') {
prefixed[key] = val;
} else {
prefixed[event + ' - ' + key] = val;
}
});
return prefixed;
}
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"alias":172,"batch":177,"each":4,"is":86}],
177: [function(require, module, exports) {
/**
* Module dependencies.
*/
try {
var EventEmitter = require('events').EventEmitter;
} catch (err) {
var Emitter = require('emitter');
}
/**
* Noop.
*/
function noop(){}
/**
* Expose `Batch`.
*/
module.exports = Batch;
/**
* Create a new Batch.
*/
function Batch() {
if (!(this instanceof Batch)) return new Batch;
this.fns = [];
this.concurrency(Infinity);
this.throws(true);
for (var i = 0, len = arguments.length; i < len; ++i) {
this.push(arguments[i]);
}
}
/**
* Inherit from `EventEmitter.prototype`.
*/
if (EventEmitter) {
Batch.prototype.__proto__ = EventEmitter.prototype;
} else {
Emitter(Batch.prototype);
}
/**
* Set concurrency to `n`.
*
* @param {Number} n
* @return {Batch}
* @api public
*/
Batch.prototype.concurrency = function(n){
this.n = n;
return this;
};
/**
* Queue a function.
*
* @param {Function} fn
* @return {Batch}
* @api public
*/
Batch.prototype.push = function(fn){
this.fns.push(fn);
return this;
};
/**
* Set wether Batch will or will not throw up.
*
* @param {Boolean} throws
* @return {Batch}
* @api public
*/
Batch.prototype.throws = function(throws) {
this.e = !!throws;
return this;
};
/**
* Execute all queued functions in parallel,
* executing `cb(err, results)`.
*
* @param {Function} cb
* @return {Batch}
* @api public
*/
Batch.prototype.end = function(cb){
var self = this
, total = this.fns.length
, pending = total
, results = []
, errors = []
, cb = cb || noop
, fns = this.fns
, max = this.n
, throws = this.e
, index = 0
, done;
// empty
if (!fns.length) return cb(null, results);
// process
function next() {
var i = index++;
var fn = fns[i];
if (!fn) return;
var start = new Date;
try {
fn(callback);
} catch (err) {
callback(err);
}
function callback(err, res){
if (done) return;
if (err && throws) return done = true, cb(err);
var complete = total - pending + 1;
var end = new Date;
results[i] = res;
errors[i] = err;
self.emit('progress', {
index: i,
value: res,
error: err,
pending: pending,
total: total,
complete: complete,
percent: complete / total * 100 | 0,
start: start,
end: end,
duration: end - start
});
if (--pending) next()
else if(!throws) cb(errors, results);
else cb(null, results);
}
}
// concurrency
for (var i = 0; i < fns.length; i++) {
if (i == max) break;
next();
}
return this;
};
}, {"emitter":178}],
178: [function(require, module, exports) {
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
var self = this;
this._callbacks = this._callbacks || {};
function on() {
self.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return this;
}
// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = [].slice.call(arguments, 1)
, callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
}, {}],
50: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_learnq');
var tick = require('next-tick');
var alias = require('alias');
/**
* Trait aliases.
*/
var aliases = {
id: '$id',
email: '$email',
firstName: '$first_name',
lastName: '$last_name',
phone: '$phone_number',
title: '$title'
};
/**
* Expose `Klaviyo` integration.
*/
var Klaviyo = module.exports = integration('Klaviyo')
.assumesPageview()
.global('_learnq')
.option('apiKey', '')
.tag('<script src="//a.klaviyo.com/media/js/learnmarklet.js">');
/**
* Initialize.
*
* https://www.klaviyo.com/docs/getting-started
*
* @param {Object} page
*/
Klaviyo.prototype.initialize = function(page){
var self = this;
push('account', this.options.apiKey);
this.load(function(){
tick(self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Klaviyo.prototype.loaded = function(){
return !! (window._learnq && window._learnq.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Klaviyo.prototype.identify = function(identify){
var traits = identify.traits(aliases);
if (!traits.$id && !traits.$email) return;
push('identify', traits);
};
/**
* Group.
*
* @param {Group} group
*/
Klaviyo.prototype.group = function(group){
var props = group.properties();
if (!props.name) return;
push('identify', { $organization: props.name });
};
/**
* Track.
*
* @param {Track} track
*/
Klaviyo.prototype.track = function(track){
push('track', track.event(), track.properties({
revenue: '$value'
}));
};
}, {"analytics.js-integration":83,"global-queue":167,"next-tick":97,"alias":172}],
51: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `LeadLander` integration.
*/
var LeadLander = module.exports = integration('LeadLander')
.assumesPageview()
.global('llactid')
.global('trackalyzer')
.option('accountId', null)
.tag('<script src="http://t6.trackalyzer.com/trackalyze-nodoc.js">');
/**
* Initialize.
*
* @param {Object} page
*/
LeadLander.prototype.initialize = function(page){
window.llactid = this.options.accountId;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
LeadLander.prototype.loaded = function(){
return !! window.trackalyzer;
};
}, {"analytics.js-integration":83}],
52: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var clone = require('clone');
var each = require('each');
var Identify = require('facade').Identify;
var when = require('when');
/**
* Expose `LiveChat` integration.
*/
var LiveChat = module.exports = integration('LiveChat')
.assumesPageview()
.global('__lc')
.global('__lc_inited')
.global('LC_API')
.global('LC_Invite')
.option('group', 0)
.option('license', '')
.tag('<script src="//cdn.livechatinc.com/tracking.js">');
/**
* Initialize.
*
* http://www.livechatinc.com/api/javascript-api
*
* @param {Object} page
*/
LiveChat.prototype.initialize = function(page){
var self = this;
var user = this.analytics.user();
var identify = new Identify({
userId: user.id(),
traits: user.traits()
});
window.__lc = clone(this.options);
window.__lc.visitor = {
name: identify.name(),
email: identify.email()
};
this.load(function(){
when(function(){ return self.loaded(); }, self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
LiveChat.prototype.loaded = function(){
return !!(window.LC_API && window.LC_Invite);
};
/**
* Identify.
*
* @param {Identify} identify
*/
LiveChat.prototype.identify = function(identify){
var traits = identify.traits({ userId: 'User ID' });
window.LC_API.set_custom_variables(convert(traits));
};
/**
* Convert a traits object into the format LiveChat requires.
*
* @param {Object} traits
* @return {Array}
*/
function convert(traits){
var arr = [];
each(traits, function(key, value){
arr.push({ name: key, value: value });
});
return arr;
}
}, {"analytics.js-integration":83,"clone":171,"each":4,"facade":124,"when":123}],
53: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var Identify = require('facade').Identify;
var useHttps = require('use-https');
/**
* Expose `LuckyOrange` integration.
*/
var LuckyOrange = module.exports = integration('Lucky Orange')
.assumesPageview()
.global('_loq')
.global('__wtw_watcher_added')
.global('__wtw_lucky_site_id')
.global('__wtw_lucky_is_segment_io')
.global('__wtw_custom_user_data')
.option('siteId', null)
.tag('http', '<script src="http://www.luckyorange.com/w.js?{{ cache }}">')
.tag('https', '<script src="https://ssl.luckyorange.com/w.js?{{ cache }}">');
/**
* Initialize.
*
* @param {Object} page
*/
LuckyOrange.prototype.initialize = function(page){
var user = this.analytics.user();
window._loq || (window._loq = []);
window.__wtw_lucky_site_id = this.options.siteId;
this.identify(new Identify({
traits: user.traits(),
userId: user.id()
}));
var cache = Math.floor(new Date().getTime() / 60000);
var name = useHttps() ? 'https' : 'http';
this.load(name, { cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
LuckyOrange.prototype.loaded = function(){
return !! window.__wtw_watcher_added;
};
/**
* Identify.
*
* @param {Identify} identify
*/
LuckyOrange.prototype.identify = function(identify){
var traits = identify.traits();
var email = identify.email();
var name = identify.name();
if (name) traits.name = name;
if (email) traits.email = email;
window.__wtw_custom_user_data = traits;
};
}, {"analytics.js-integration":83,"facade":124,"use-https":85}],
54: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
/**
* Expose `Lytics` integration.
*/
var Lytics = module.exports = integration('Lytics')
.global('jstag')
.option('cid', '')
.option('cookie', 'seerid')
.option('delay', 2000)
.option('sessionTimeout', 1800)
.option('url', '//c.lytics.io')
.tag('<script src="//c.lytics.io/static/io.min.js">');
/**
* Options aliases.
*/
var aliases = {
sessionTimeout: 'sessecs'
};
/**
* Initialize.
*
* http://admin.lytics.io/doc#jstag
*
* @param {Object} page
*/
Lytics.prototype.initialize = function(page){
var options = alias(this.options, aliases);
window.jstag = (function(){var t = { _q: [], _c: options, ts: (new Date()).getTime() }; t.send = function(){this._q.push(['ready', 'send', Array.prototype.slice.call(arguments)]); return this; }; return t; })();
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Lytics.prototype.loaded = function(){
return !! (window.jstag && window.jstag.bind);
};
/**
* Page.
*
* @param {Page} page
*/
Lytics.prototype.page = function(page){
window.jstag.send(page.properties());
};
/**
* Idenfity.
*
* @param {Identify} identify
*/
Lytics.prototype.identify = function(identify){
var traits = identify.traits({ userId: '_uid' });
window.jstag.send(traits);
};
/**
* Track.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Lytics.prototype.track = function(track){
var props = track.properties();
props._e = track.event();
window.jstag.send(props);
};
}, {"analytics.js-integration":83,"alias":172}],
55: [function(require, module, exports) {
/**
* Module dependencies.
*/
var alias = require('alias');
var clone = require('clone');
var dates = require('convert-dates');
var integration = require('analytics.js-integration');
var is = require('is');
var iso = require('to-iso-string');
var indexof = require('indexof');
var del = require('obj-case').del;
var some = require('some');
/**
* Expose `Mixpanel` integration.
*/
var Mixpanel = module.exports = integration('Mixpanel')
.global('mixpanel')
.option('increments', [])
.option('cookieName', '')
.option('nameTag', true)
.option('pageview', false)
.option('people', false)
.option('token', '')
.option('trackAllPages', false)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//cdn.mxpnl.com/libs/mixpanel-2.2.min.js">');
/**
* Options aliases.
*/
var optionsAliases = {
cookieName: 'cookie_name'
};
/**
* Initialize.
*
* https://mixpanel.com/help/reference/javascript#installing
* https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.init
*/
Mixpanel.prototype.initialize = function(){
(function(c, a){window.mixpanel = a; var b, d, h, e; a._i = []; a.init = function(b, c, f){function d(a, b){var c = b.split('.'); 2 == c.length && (a = a[c[0]], b = c[1]); a[b] = function(){a.push([b].concat(Array.prototype.slice.call(arguments, 0))); }; } var g = a; 'undefined' !== typeof f ? g = a[f] = [] : f = 'mixpanel'; g.people = g.people || []; h = ['disable', 'track', 'track_pageview', 'track_links', 'track_forms', 'register', 'register_once', 'unregister', 'identify', 'alias', 'name_tag', 'set_config', 'people.set', 'people.increment', 'people.track_charge', 'people.append']; for (e = 0; e < h.length; e++) d(g, h[e]); a._i.push([b, c, f]); }; a.__SV = 1.2; })(document, window.mixpanel || []);
this.options.increments = lowercase(this.options.increments);
var options = alias(this.options, optionsAliases);
window.mixpanel.init(options.token, options);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Mixpanel.prototype.loaded = function(){
return !! (window.mixpanel && window.mixpanel.config);
};
/**
* Page.
*
* https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.track_pageview
*
* @param {String} category (optional)
* @param {String} name (optional)
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Mixpanel.prototype.page = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Trait aliases.
*/
var traitAliases = {
created: '$created',
email: '$email',
firstName: '$first_name',
lastName: '$last_name',
lastSeen: '$last_seen',
name: '$name',
username: '$username',
phone: '$phone'
};
/**
* Identify.
*
* https://mixpanel.com/help/reference/javascript#super-properties
* https://mixpanel.com/help/reference/javascript#user-identity
* https://mixpanel.com/help/reference/javascript#storing-user-profiles
*
* @param {Identify} identify
*/
Mixpanel.prototype.identify = function(identify){
var username = identify.username();
var email = identify.email();
var id = identify.userId();
// id
if (id) window.mixpanel.identify(id);
// name tag
var nametag = email || username || id;
if (nametag) window.mixpanel.name_tag(nametag);
// traits
var traits = identify.traits(traitAliases);
if (traits.$created) del(traits, 'createdAt');
window.mixpanel.register(dates(traits, iso));
if (this.options.people) window.mixpanel.people.set(traits);
};
/**
* Track.
*
* https://mixpanel.com/help/reference/javascript#sending-events
* https://mixpanel.com/help/reference/javascript#tracking-revenue
*
* @param {Track} track
*/
Mixpanel.prototype.track = function(track){
var increments = this.options.increments;
var increment = track.event().toLowerCase();
var people = this.options.people;
var props = track.properties();
var revenue = track.revenue();
// delete mixpanel's reserved properties, so they don't conflict
delete props.distinct_id;
delete props.ip;
delete props.mp_name_tag;
delete props.mp_note;
delete props.token;
// convert arrays of objects to length, since mixpanel doesn't support object arrays
for (var key in props) {
var val = props[key];
if (is.array(val) && some(val, is.object)) props[key] = val.length;
}
// increment properties in mixpanel people
if (people && ~indexof(increments, increment)) {
window.mixpanel.people.increment(track.event());
window.mixpanel.people.set('Last ' + track.event(), new Date);
}
// track the event
props = dates(props, iso);
window.mixpanel.track(track.event(), props);
// track revenue specifically
if (revenue && people) {
window.mixpanel.people.track_charge(revenue);
}
};
/**
* Alias.
*
* https://mixpanel.com/help/reference/javascript#user-identity
* https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.alias
*
* @param {Alias} alias
*/
Mixpanel.prototype.alias = function(alias){
var mp = window.mixpanel;
var to = alias.to();
if (mp.get_distinct_id && mp.get_distinct_id() === to) return;
// HACK: internal mixpanel API to ensure we don't overwrite
if (mp.get_property && mp.get_property('$people_distinct_id') === to) return;
// although undocumented, mixpanel takes an optional original id
mp.alias(to, alias.from());
};
/**
* Lowercase the given `arr`.
*
* @param {Array} arr
* @return {Array}
* @api private
*/
function lowercase(arr){
var ret = new Array(arr.length);
for (var i = 0; i < arr.length; ++i) {
ret[i] = String(arr[i]).toLowerCase();
}
return ret;
}
}, {"alias":172,"clone":171,"convert-dates":173,"analytics.js-integration":83,"is":86,"to-iso-string":170,"indexof":109,"obj-case":138,"some":179}],
179: [function(require, module, exports) {
/**
* some
*/
var some = [].some;
/**
* test whether some elements in
* the array pass the test implemented
* by `fn`.
*
* example:
*
* some([1, 'foo', 'bar'], function (el, i) {
* return 'string' == typeof el;
* });
* // > true
*
* @param {Array} arr
* @param {Function} fn
* @return {bool}
*/
module.exports = function (arr, fn) {
if (some) return some.call(arr, fn);
for (var i = 0, l = arr.length; i < l; ++i) {
if (fn(arr[i], i)) return true;
}
return false;
};
}, {}],
56: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var bind = require('bind');
var when = require('when');
var is = require('is');
/**
* Expose `Mojn`
*/
var Mojn = module.exports = integration('Mojn')
.option('customerCode', '')
.global('_mojnTrack')
.tag('<script src="https://track.idtargeting.com/{{ customerCode }}/track.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Mojn.prototype.initialize = function(){
window._mojnTrack = window._mojnTrack || [];
window._mojnTrack.push({ cid: this.options.customerCode });
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Mojn.prototype.loaded = function(){
return is.object(window._mojnTrack);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Mojn.prototype.identify = function(identify){
var email = identify.email();
if (!email) return;
var img = new Image();
img.src = '//matcher.idtargeting.com/analytics.gif?cid=' + this.options.customerCode + '&_mjnctid='+email;
img.width = 1;
img.height = 1;
return img;
};
/**
* Track.
*
* @param {Track} event
*/
Mojn.prototype.track = function(track){
var properties = track.properties();
var revenue = properties.revenue;
var currency = properties.currency || '';
var conv = currency + revenue;
if (!revenue) return;
window._mojnTrack.push({ conv: conv });
return conv;
};
}, {"analytics.js-integration":83,"bind":95,"when":123,"is":86}],
57: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('_mfq');
var integration = require('analytics.js-integration');
var each = require('each');
/**
* Expose `Mouseflow`.
*/
var Mouseflow = module.exports = integration('Mouseflow')
.assumesPageview()
.global('mouseflow')
.global('_mfq')
.option('apiKey', '')
.option('mouseflowHtmlDelay', 0)
.tag('<script src="//cdn.mouseflow.com/projects/{{ apiKey }}.js">');
/**
* Initalize.
*
* @param {Object} page
*/
Mouseflow.prototype.initialize = function(page){
window.mouseflowHtmlDelay = this.options.mouseflowHtmlDelay;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Mouseflow.prototype.loaded = function(){
return !! window.mouseflow;
};
/**
* Page.
*
* http://mouseflow.zendesk.com/entries/22528817-Single-page-websites
*
* @param {Page} page
*/
Mouseflow.prototype.page = function(page){
if (!window.mouseflow) return;
if ('function' != typeof mouseflow.newPageView) return;
mouseflow.newPageView();
};
/**
* Identify.
*
* http://mouseflow.zendesk.com/entries/24643603-Custom-Variables-Tagging
*
* @param {Identify} identify
*/
Mouseflow.prototype.identify = function(identify){
set(identify.traits());
};
/**
* Track.
*
* http://mouseflow.zendesk.com/entries/24643603-Custom-Variables-Tagging
*
* @param {Track} track
*/
Mouseflow.prototype.track = function(track){
var props = track.properties();
props.event = track.event();
set(props);
};
/**
* Push each key and value in the given `obj` onto the queue.
*
* @param {Object} obj
*/
function set(obj){
each(obj, function(key, value){
push('setVariable', key, value);
});
}
}, {"global-queue":167,"analytics.js-integration":83,"each":4}],
58: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
var each = require('each');
var is = require('is');
/**
* Expose `MouseStats` integration.
*/
var MouseStats = module.exports = integration('MouseStats')
.assumesPageview()
.global('msaa')
.global('MouseStatsVisitorPlaybacks')
.option('accountNumber', '')
.tag('http', '<script src="http://www2.mousestats.com/js/{{ path }}.js?{{ cache }}">')
.tag('https', '<script src="https://ssl.mousestats.com/js/{{ path }}.js?{{ cache }}">');
/**
* Initialize.
*
* http://www.mousestats.com/docs/pages/allpages
*
* @param {Object} page
*/
MouseStats.prototype.initialize = function(page){
var number = this.options.accountNumber;
var path = number.slice(0,1) + '/' + number.slice(1,2) + '/' + number;
var cache = Math.floor(new Date().getTime() / 60000);
var name = useHttps() ? 'https' : 'http';
this.load(name, { path: path, cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
MouseStats.prototype.loaded = function(){
return is.array(window.MouseStatsVisitorPlaybacks);
};
/**
* Identify.
*
* http://www.mousestats.com/docs/wiki/7/how-to-add-custom-data-to-visitor-playbacks
*
* @param {Identify} identify
*/
MouseStats.prototype.identify = function(identify){
each(identify.traits(), function (key, value) {
window.MouseStatsVisitorPlaybacks.customVariable(key, value);
});
};
}, {"analytics.js-integration":83,"use-https":85,"each":4,"is":86}],
59: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('__nls');
/**
* Expose `Navilytics` integration.
*/
var Navilytics = module.exports = integration('Navilytics')
.assumesPageview()
.global('__nls')
.option('memberId', '')
.option('projectId', '')
.tag('<script src="//www.navilytics.com/nls.js?mid={{ memberId }}&pid={{ projectId }}">');
/**
* Initialize.
*
* https://www.navilytics.com/member/code_settings
*
* @param {Object} page
*/
Navilytics.prototype.initialize = function(page){
window.__nls = window.__nls || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Navilytics.prototype.loaded = function(){
return !! (window.__nls && [].push != window.__nls.push);
};
/**
* Track.
*
* https://www.navilytics.com/docs#tags
*
* @param {Track} track
*/
Navilytics.prototype.track = function(track){
push('tagRecording', track.event());
};
}, {"analytics.js-integration":83,"global-queue":167}],
60: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var https = require('use-https');
var tick = require('next-tick');
/**
* Expose `Olark` integration.
*/
var Olark = module.exports = integration('Olark')
.assumesPageview()
.global('olark')
.option('identify', true)
.option('page', true)
.option('siteId', '')
.option('groupId', '')
.option('track', false);
/**
* Initialize.
*
* http://www.olark.com/documentation
* https://www.olark.com/documentation/javascript/api.chat.setOperatorGroup
*
* @param {Object} page
*/
Olark.prototype.initialize = function(page){
var self = this;
this.load(function(){
tick(self.ready);
});
// assign chat to a specific site
var groupId = this.options.groupId;
if (groupId) {
chat('setOperatorGroup', { group: groupId });
}
// keep track of the widget's open state
var self = this;
box('onExpand', function(){ self._open = true; });
box('onShrink', function(){ self._open = false; });
};
/**
* Loaded?
*
* @return {Boolean}
*/
Olark.prototype.loaded = function(){
return !! window.olark;
};
/**
* Load.
*
* @param {Function} callback
*/
Olark.prototype.load = function(callback){
var el = document.getElementById('olark');
//if (!el) {
window.olark||(function(c){var f=window,d=document,l=https()?"https:":"http:",z=c.name,r="load";var nt=function(){f[z]=function(){(a.s=a.s||[]).push(arguments)};var a=f[z]._={},q=c.methods.length;while (q--) {(function(n){f[z][n]=function(){f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={ 0:+new Date() };a.P=function(u){a.p[u]=new Date()-a.p[0]};function s(){a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){hd="head";return ["<",hd,"></",hd,"><",i,' onl' + 'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',"></",i,">"].join("")}var i="body",m=d[i];if (!m) {return setTimeout(ld,100)}a.P(1);var j="appendChild",h="createElement",k="src",n=d[h]("div"),v=n[j](d[h](z)),b=d[h]("iframe"),g="document",e="domain",o;n.style.display="none";m.insertBefore(n,m.firstChild).id=z;b.frameBorder="0";b.id=z+"-loader";if (/MSIE[ ]+6/.test(navigator.userAgent)) {b.src="javascript:false"}b.allowTransparency="true";v[j](b);try {b.contentWindow[g].open()}catch (w) {c[e]=d[e];o="javascript:var d="+g+".open();d.domain='"+d.domain+"';";b[k]=o+"void(0);"}try {var t=b.contentWindow[g];t.write(p());t.close()}catch (x) {b[k]=o+'d.write("'+p().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};ld()};nt()})({ loader: "static.olark.com/jsclient/loader0.js", name:"olark", methods:["configure","extend","declare","identify"] });
window.olark.identify(this.options.siteId);
//}
callback();
};
/**
* Page.
*
* @param {Page} page
*/
Olark.prototype.page = function(page){
if (!this.options.page || !this._open) return;
var props = page.properties();
var name = page.fullName();
if (!name && !props.url) return;
var msg = name ? name.toLowerCase() + ' page' : props.url;
chat('sendNotificationToOperator', {
body: 'looking at ' + msg // lowercase since olark does
});
};
/**
* Identify.
*
* @param {String} id (optional)
* @param {Object} traits (optional)
* @param {Object} options (optional)
*/
Olark.prototype.identify = function(identify){
if (!this.options.identify) return;
var username = identify.username();
var traits = identify.traits();
var id = identify.userId();
var email = identify.email();
var phone = identify.phone();
var name = identify.name()
|| identify.firstName();
visitor('updateCustomFields', traits);
if (email) visitor('updateEmailAddress', { emailAddress: email });
if (phone) visitor('updatePhoneNumber', { phoneNumber: phone });
// figure out best name
if (name) visitor('updateFullName', { fullName: name });
// figure out best nickname
var nickname = name || email || username || id;
if (name && email) nickname += ' (' + email + ')';
if (nickname) chat('updateVisitorNickname', { snippet: nickname });
};
/**
* Track.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Olark.prototype.track = function(track){
if (!this.options.track || !this._open) return;
chat('sendNotificationToOperator', {
body: 'visitor triggered "' + track.event() + '"' // lowercase since olark does
});
};
/**
* Helper method for Olark box API calls.
*
* @param {String} action
* @param {Object} value
*/
function box(action, value){
window.olark('api.box.' + action, value);
}
/**
* Helper method for Olark visitor API calls.
*
* @param {String} action
* @param {Object} value
*/
function visitor(action, value){
window.olark('api.visitor.' + action, value);
}
/**
* Helper method for Olark chat API calls.
*
* @param {String} action
* @param {Object} value
*/
function chat(action, value){
window.olark('api.chat.' + action, value);
}
}, {"analytics.js-integration":83,"use-https":85,"next-tick":97}],
61: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('optimizely');
var callback = require('callback');
var tick = require('next-tick');
var bind = require('bind');
var each = require('each');
/**
* Expose `Optimizely` integration.
*/
var Optimizely = module.exports = integration('Optimizely')
.option('variations', true)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true);
/**
* Initialize.
*
* https://www.optimizely.com/docs/api#function-calls
*/
Optimizely.prototype.initialize = function(){
if (this.options.variations) {
var self = this;
tick(function(){
self.replay();
});
}
this.ready();
};
/**
* Track.
*
* https://www.optimizely.com/docs/api#track-event
*
* @param {Track} track
*/
Optimizely.prototype.track = function(track){
var props = track.properties();
if (props.revenue) props.revenue *= 100;
push('trackEvent', track.event(), props);
};
/**
* Page.
*
* https://www.optimizely.com/docs/api#track-event
*
* @param {Page} page
*/
Optimizely.prototype.page = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Replay experiment data as traits to other enabled providers.
*
* https://www.optimizely.com/docs/api#data-object
*/
Optimizely.prototype.replay = function(){
if (!window.optimizely) return; // in case the snippet isnt on the page
var data = window.optimizely.data;
if (!data) return;
var experiments = data.experiments;
var map = data.state.variationNamesMap;
var traits = {};
each(map, function(experimentId, variation){
var experiment = experiments[experimentId].name;
traits['Experiment: ' + experiment] = variation;
});
this.analytics.identify(traits);
};
}, {"analytics.js-integration":83,"global-queue":167,"callback":88,"next-tick":97,"bind":95,"each":4}],
62: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `PerfectAudience` integration.
*/
var PerfectAudience = module.exports = integration('Perfect Audience')
.assumesPageview()
.global('_pa')
.option('siteId', '')
.tag('<script src="//tag.perfectaudience.com/serve/{{ siteId }}.js">');
/**
* Initialize.
*
* https://www.perfectaudience.com/docs#javascript_api_autoopen
*
* @param {Object} page
*/
PerfectAudience.prototype.initialize = function(page){
window._pa = window._pa || {};
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
PerfectAudience.prototype.loaded = function(){
return !! (window._pa && window._pa.track);
};
/**
* Track.
*
* @param {Track} event
*/
PerfectAudience.prototype.track = function(track){
window._pa.track(track.event(), track.properties());
};
}, {"analytics.js-integration":83}],
63: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_prum');
var date = require('load-date');
/**
* Expose `Pingdom` integration.
*/
var Pingdom = module.exports = integration('Pingdom')
.assumesPageview()
.global('_prum')
.global('PRUM_EPISODES')
.option('id', '')
.tag('<script src="//rum-static.pingdom.net/prum.min.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Pingdom.prototype.initialize = function(page){
window._prum = window._prum || [];
push('id', this.options.id);
push('mark', 'firstbyte', date.getTime());
var self = this;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Pingdom.prototype.loaded = function(){
return !! (window._prum && window._prum.push !== Array.prototype.push);
};
}, {"analytics.js-integration":83,"global-queue":167,"load-date":168}],
64: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_paq');
var each = require('each');
/**
* Expose `Piwik` integration.
*/
var Piwik = module.exports = integration('Piwik')
.global('_paq')
.option('url', null)
.option('siteId', '')
.mapping('goals')
.tag('<script src="{{ url }}/piwik.js">');
/**
* Initialize.
*
* http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking
*/
Piwik.prototype.initialize = function(){
window._paq = window._paq || [];
push('setSiteId', this.options.siteId);
push('setTrackerUrl', this.options.url + '/piwik.php');
push('enableLinkTracking');
this.load(this.ready);
};
/**
* Check if Piwik is loaded
*/
Piwik.prototype.loaded = function(){
return !! (window._paq && window._paq.push != [].push);
};
/**
* Page
*
* @param {Page} page
*/
Piwik.prototype.page = function(page){
push('trackPageView');
};
/**
* Track.
*
* @param {Track} track
*/
Piwik.prototype.track = function(track){
var goals = this.goals(track.event());
var revenue = track.revenue() || 0;
each(goals, function(goal){
push('trackGoal', goal, revenue);
});
};
}, {"analytics.js-integration":83,"global-queue":167,"each":4}],
65: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var convertDates = require('convert-dates');
var push = require('global-queue')('_lnq');
var alias = require('alias');
/**
* Expose `Preact` integration.
*/
var Preact = module.exports = integration('Preact')
.assumesPageview()
.global('_lnq')
.option('projectCode', '')
.tag('<script src="//d2bbvl6dq48fa6.cloudfront.net/js/ln-2.4.min.js">');
/**
* Initialize.
*
* http://www.preact.io/api/javascript
*
* @param {Object} page
*/
Preact.prototype.initialize = function(page){
window._lnq = window._lnq || [];
push('_setCode', this.options.projectCode);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Preact.prototype.loaded = function(){
return !! (window._lnq && window._lnq.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Preact.prototype.identify = function(identify){
if (!identify.userId()) return;
var traits = identify.traits({ created: 'created_at' });
traits = convertDates(traits, convertDate);
push('_setPersonData', {
name: identify.name(),
email: identify.email(),
uid: identify.userId(),
properties: traits
});
};
/**
* Group.
*
* @param {String} id
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Preact.prototype.group = function(group){
if (!group.groupId()) return;
push('_setAccount', group.traits());
};
/**
* Track.
*
* @param {Track} track
*/
Preact.prototype.track = function(track){
var props = track.properties();
var revenue = track.revenue();
var event = track.event();
var special = { name: event };
if (revenue) {
special.revenue = revenue * 100;
delete props.revenue;
}
if (props.note) {
special.note = props.note;
delete props.note;
}
push('_logEvent', special, props);
};
/**
* Convert a `date` to a format Preact supports.
*
* @param {Date} date
* @return {Number}
*/
function convertDate(date){
return Math.floor(date / 1000);
}
}, {"analytics.js-integration":83,"convert-dates":173,"global-queue":167,"alias":172}],
66: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_kiq');
var Facade = require('facade');
var Identify = Facade.Identify;
var bind = require('bind');
var when = require('when');
/**
* Expose `Qualaroo` integration.
*/
var Qualaroo = module.exports = integration('Qualaroo')
.assumesPageview()
.global('_kiq')
.option('customerId', '')
.option('siteToken', '')
.option('track', false)
.tag('<script src="//s3.amazonaws.com/ki.js/{{ customerId }}/{{ siteToken }}.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Qualaroo.prototype.initialize = function(page){
window._kiq = window._kiq || [];
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Qualaroo.prototype.loaded = function(){
return !! (window._kiq && window._kiq.push !== Array.prototype.push);
};
/**
* Identify.
*
* http://help.qualaroo.com/customer/portal/articles/731085-identify-survey-nudge-takers
* http://help.qualaroo.com/customer/portal/articles/731091-set-additional-user-properties
*
* @param {Identify} identify
*/
Qualaroo.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
var email = identify.email();
if (email) id = email;
if (id) push('identify', id);
if (traits) push('set', traits);
};
/**
* Track.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Qualaroo.prototype.track = function(track){
if (!this.options.track) return;
var event = track.event();
var traits = {};
traits['Triggered: ' + event] = true;
this.identify(new Identify({ traits: traits }));
};
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"bind":95,"when":123}],
67: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('_qevents', { wrap: false });
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
/**
* Expose `Quantcast` integration.
*/
var Quantcast = module.exports = integration('Quantcast')
.assumesPageview()
.global('_qevents')
.global('__qc')
.option('pCode', null)
.option('advertise', false)
.tag('http', '<script src="http://edge.quantserve.com/quant.js">')
.tag('https', '<script src="https://secure.quantserve.com/quant.js">');
/**
* Initialize.
*
* https://www.quantcast.com/learning-center/guides/using-the-quantcast-asynchronous-tag/
* https://www.quantcast.com/help/cross-platform-audience-measurement-guide/
*
* @param {Page} page
*/
Quantcast.prototype.initialize = function(page){
window._qevents = window._qevents || [];
var opts = this.options;
var settings = { qacct: opts.pCode };
var user = this.analytics.user();
if (user.id()) settings.uid = user.id();
if (page) {
settings.labels = this.labels('page', page.category(), page.name());
}
push(settings);
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Quantcast.prototype.loaded = function(){
return !! window.__qc;
};
/**
* Page.
*
* https://cloudup.com/cBRRFAfq6mf
*
* @param {Page} page
*/
Quantcast.prototype.page = function(page){
var category = page.category();
var name = page.name();
var settings = {
event: 'refresh',
labels: this.labels('page', category, name),
qacct: this.options.pCode,
};
var user = this.analytics.user();
if (user.id()) settings.uid = user.id();
push(settings);
};
/**
* Identify.
*
* https://www.quantcast.com/help/cross-platform-audience-measurement-guide/
*
* @param {String} id (optional)
*/
Quantcast.prototype.identify = function(identify){
// edit the initial quantcast settings
// TODO: could be done in a cleaner way
var id = identify.userId();
if (id) {
window._qevents[0] = window._qevents[0] || {};
window._qevents[0].uid = id;
}
};
/**
* Track.
*
* https://cloudup.com/cBRRFAfq6mf
*
* @param {Track} track
*/
Quantcast.prototype.track = function(track){
var name = track.event();
var revenue = track.revenue();
var settings = {
event: 'click',
labels: this.labels('event', name),
qacct: this.options.pCode
};
var user = this.analytics.user();
if (null != revenue) settings.revenue = (revenue+''); // convert to string
if (user.id()) settings.uid = user.id();
push(settings);
};
/**
* Completed Order.
*
* @param {Track} track
* @api private
*/
Quantcast.prototype.completedOrder = function(track){
var name = track.event();
var revenue = track.total();
var labels = this.labels('event', name);
var category = track.category();
if (this.options.advertise && category) {
labels += ',' + this.labels('pcat', category);
}
var settings = {
event: 'refresh', // the example Quantcast sent has completed order send refresh not click
labels: labels,
revenue: (revenue+''), // convert to string
orderid: track.orderId(),
qacct: this.options.pCode
};
push(settings);
};
/**
* Generate quantcast labels.
*
* Example:
*
* options.advertise = false;
* labels('event', 'my event');
* // => "event.my event"
*
* options.advertise = true;
* labels('event', 'my event');
* // => "_fp.event.my event"
*
* @param {String} type
* @param {String} ...
* @return {String}
* @api private
*/
Quantcast.prototype.labels = function(type){
var args = [].slice.call(arguments, 1);
var advertise = this.options.advertise;
var ret = [];
if (advertise && 'page' == type) type = 'event';
if (advertise) type = '_fp.' + type;
for (var i = 0; i < args.length; ++i) {
if (null == args[i]) continue;
var value = String(args[i]);
ret.push(value.replace(/,/g, ';'));
}
ret = advertise ? ret.join(' ') : ret.join('.');
return [type, ret].join('.');
};
}, {"global-queue":167,"analytics.js-integration":83,"use-https":85}],
68: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var extend = require('extend');
var is = require('is');
/**
* Expose `Rollbar` integration.
*/
var RollbarIntegration = module.exports = integration('Rollbar')
.global('Rollbar')
.option('identify', true)
.option('accessToken', '')
.option('environment', 'unknown')
.option('captureUncaught', true);
/**
* Initialize.
*
* @param {Object} page
*/
RollbarIntegration.prototype.initialize = function(page){
var _rollbarConfig = this.config = {
accessToken: this.options.accessToken,
captureUncaught: this.options.captureUncaught,
payload: {
environment: this.options.environment
}
};
(function(a){function b(b){this.shimId=++g,this.notifier=null,this.parentShim=b,this.logger=function(){},a.console&&void 0 === a.console.shimId&&(this.logger=a.console.log)}function c(b,c,d){!d[4]&&a._rollbarWrappedError&&(d[4]=a._rollbarWrappedError,a._rollbarWrappedError=null),b.uncaughtError.apply(b,d),c&&c.apply(a,d)}function d(c){var d=b;return f(function(){if (this.notifier)return this.notifier[c].apply(this.notifier,arguments);var b=this,e="scope"===c;e&&(b=new d(this));var f=Array.prototype.slice.call(arguments,0),g={ shim:b, method:c, args:f, ts:new Date };return a._rollbarShimQueue.push(g),e?b:void 0})}function e(a,b){if (b.hasOwnProperty&&b.hasOwnProperty("addEventListener")){var c=b.addEventListener;b.addEventListener=function(b,d,e){c.call(this,b,a.wrap(d),e)};var d=b.removeEventListener;b.removeEventListener=function(a,b,c){d.call(this,a,b._wrapped||b,c)}}}function f(a,b){return b=b||this.logger,function(){try {return a.apply(this,arguments)} catch (c) {b("Rollbar internal error:",c)}}}var g=0;b.init=function(a,d){var g=d.globalAlias||"Rollbar";if ("object"==typeof a[g])return a[g];a._rollbarShimQueue=[],a._rollbarWrappedError=null,d=d||{};var h=new b;return f(function(){if (h.configure(d),d.captureUncaught){var b=a.onerror;a.onerror=function(){var a=Array.prototype.slice.call(arguments,0);c(h,b,a)};var f,i,j=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];for (f=0;f<j.length;++f)i=j[f],a[i]&&a[i].prototype&&e(h,a[i].prototype)}return a[g]=h,h},h.logger)()},b.prototype.loadFull=function(a,b,c,d,e){var g=f(function(){var a=b.createElement("script"),e=b.getElementsByTagName("script")[0];a.src=d.rollbarJsUrl,a.async=!c,a.onload=h,e.parentNode.insertBefore(a,e)},this.logger),h=f(function(){var b;if (void 0===a._rollbarPayloadQueue){var c,d,f,g;for (b=new Error("rollbar.js did not load");c=a._rollbarShimQueue.shift();)for (f=c.args,g=0;g<f.length;++g)if (d=f[g],"function"==typeof d){d(b);break}}e&&e(b)},this.logger);f(function(){c?g():a.addEventListener?a.addEventListener("load",g,!1):a.attachEvent("onload",g)},this.logger)()},b.prototype.wrap=function(b){if ("function"!=typeof b)return b;if (b._isWrap)return b;if (!b._wrapped){b._wrapped=function(){try {return b.apply(this,arguments)} catch (c) {throw a._rollbarWrappedError=c,c}},b._wrapped._isWrap=!0;for (var c in b)b.hasOwnProperty(c)&&(b._wrapped[c]=b[c])}return b._wrapped};for (var h="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError".split(","),i=0;i<h.length;++i)b.prototype[h[i]]=d(h[i]);var j="//d37gvrvc0wt4s1.cloudfront.net/js/v1.0/rollbar.min.js";_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||j,b.init(a,_rollbarConfig)})(window,document);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
RollbarIntegration.prototype.loaded = function(){
return is.object(window.Rollbar) && null == window.Rollbar.shimId;
};
/**
* Load.
*
* @param {Function} callback
*/
RollbarIntegration.prototype.load = function(callback){
window.Rollbar.loadFull(window, document, true, this.config, callback);
};
/**
* Identify.
*
* @param {Identify} identify
*/
RollbarIntegration.prototype.identify = function(identify){
// do stuff with `id` or `traits`
if (!this.options.identify) return;
// Don't allow identify without a user id
var uid = identify.userId();
if (uid === null || uid === undefined) return;
var rollbar = window.Rollbar;
var person = { id: uid };
extend(person, identify.traits());
rollbar.configure({ payload: { person: person }});
};
}, {"analytics.js-integration":83,"extend":122,"is":86}],
69: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `SaaSquatch` integration.
*/
var SaaSquatch = module.exports = integration('SaaSquatch')
.option('tenantAlias', '')
.global('_sqh')
.tag('<script src="//d2rcp9ak152ke1.cloudfront.net/assets/javascripts/squatch.min.js">');
/**
* Initialize.
*
* @param {Page} page
*/
SaaSquatch.prototype.initialize = function(page){
window._sqh = window._sqh || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
SaaSquatch.prototype.loaded = function(){
return window._sqh && window._sqh.push != [].push;
};
/**
* Identify.
*
* @param {Facade} identify
*/
SaaSquatch.prototype.identify = function(identify){
var sqh = window._sqh;
var accountId = identify.proxy('traits.accountId');
var image = identify.proxy('traits.referralImage');
var opts = identify.options(this.name);
var id = identify.userId();
var email = identify.email();
if (!(id || email)) return;
if (this.called) return;
var init = {
tenant_alias: this.options.tenantAlias,
first_name: identify.firstName(),
last_name: identify.lastName(),
user_image: identify.avatar(),
email: email,
user_id: id,
};
if (accountId) init.account_id = accountId;
if (opts.checksum) init.checksum = opts.checksum;
if (image) init.fb_share_image = image;
sqh.push(['init', init]);
this.called = true;
this.load();
};
}, {"analytics.js-integration":83}],
70: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `Sentry` integration.
*/
var Sentry = module.exports = integration('Sentry')
.global('Raven')
.option('config', '')
.tag('<script src="//cdn.ravenjs.com/1.1.10/native/raven.min.js">');
/**
* Initialize.
*
* http://raven-js.readthedocs.org/en/latest/config/index.html
*/
Sentry.prototype.initialize = function(){
var config = this.options.config;
var self = this;
this.load(function(){
// for now, raven basically requires `install` to be called
// https://github.com/getsentry/raven-js/blob/master/src/raven.js#L113
window.Raven.config(config).install();
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Sentry.prototype.loaded = function(){
return is.object(window.Raven);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Sentry.prototype.identify = function(identify){
window.Raven.setUser(identify.traits());
};
}, {"analytics.js-integration":83,"is":86}],
71: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `SnapEngage` integration.
*/
var SnapEngage = module.exports = integration('SnapEngage')
.assumesPageview()
.global('SnapABug')
.option('apiKey', '')
.tag('<script src="//commondatastorage.googleapis.com/code.snapengage.com/js/{{ apiKey }}.js">');
/**
* Initialize.
*
* http://help.snapengage.com/installation-guide-getting-started-in-a-snap/
*
* @param {Object} page
*/
SnapEngage.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
SnapEngage.prototype.loaded = function(){
return is.object(window.SnapABug);
};
/**
* Identify.
*
* @param {Identify} identify
*/
SnapEngage.prototype.identify = function(identify){
var email = identify.email();
if (!email) return;
window.SnapABug.setUserEmail(email);
};
}, {"analytics.js-integration":83,"is":86}],
72: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var bind = require('bind');
var when = require('when');
/**
* Expose `Spinnakr` integration.
*/
var Spinnakr = module.exports = integration('Spinnakr')
.assumesPageview()
.global('_spinnakr_site_id')
.global('_spinnakr')
.option('siteId', '')
.tag('<script src="//d3ojzyhbolvoi5.cloudfront.net/js/so.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Spinnakr.prototype.initialize = function(page){
window._spinnakr_site_id = this.options.siteId;
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Spinnakr.prototype.loaded = function(){
return !! window._spinnakr;
};
}, {"analytics.js-integration":83,"bind":95,"when":123}],
73: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var slug = require('slug');
var push = require('global-queue')('_tsq');
/**
* Expose `Tapstream` integration.
*/
var Tapstream = module.exports = integration('Tapstream')
.assumesPageview()
.global('_tsq')
.option('accountName', '')
.option('trackAllPages', true)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//cdn.tapstream.com/static/js/tapstream.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Tapstream.prototype.initialize = function(page){
window._tsq = window._tsq || [];
push('setAccountName', this.options.accountName);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Tapstream.prototype.loaded = function(){
return !! (window._tsq && window._tsq.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
Tapstream.prototype.page = function(page){
var category = page.category();
var opts = this.options;
var name = page.fullName();
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Track.
*
* @param {Track} track
*/
Tapstream.prototype.track = function(track){
var props = track.properties();
push('fireHit', slug(track.event()), [props.url]); // needs events as slugs
};
}, {"analytics.js-integration":83,"slug":93,"global-queue":167}],
74: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
var clone = require('clone');
/**
* Expose `Trakio` integration.
*/
var Trakio = module.exports = integration('trak.io')
.assumesPageview()
.global('trak')
.option('token', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//d29p64779x43zo.cloudfront.net/v1/trak.io.min.js">');
/**
* Options aliases.
*/
var optionsAliases = {
initialPageview: 'auto_track_page_view'
};
/**
* Initialize.
*
* https://docs.trak.io
*
* @param {Object} page
*/
Trakio.prototype.initialize = function(page){
var options = this.options;
window.trak = window.trak || [];
window.trak.io = window.trak.io || {};
window.trak.push = window.trak.push || function(){};
window.trak.io.load = window.trak.io.load || function(e){var r = function(e){return function(){window.trak.push([e].concat(Array.prototype.slice.call(arguments,0))); }; } ,i=["initialize","identify","track","alias","channel","source","host","protocol","page_view"]; for (var s=0;s<i.length;s++) window.trak.io[i[s]]=r(i[s]); window.trak.io.initialize.apply(window.trak.io,arguments); };
window.trak.io.load(options.token, alias(options, optionsAliases));
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Trakio.prototype.loaded = function(){
return !! (window.trak && window.trak.loaded);
};
/**
* Page.
*
* @param {Page} page
*/
Trakio.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
window.trak.io.page_view(props.path, name || props.title);
// named pages
if (name && this.options.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && this.options.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Trait aliases.
*
* http://docs.trak.io/properties.html#special
*/
var traitAliases = {
avatar: 'avatar_url',
firstName: 'first_name',
lastName: 'last_name'
};
/**
* Identify.
*
* @param {Identify} identify
*/
Trakio.prototype.identify = function(identify){
var traits = identify.traits(traitAliases);
var id = identify.userId();
if (id) {
window.trak.io.identify(id, traits);
} else {
window.trak.io.identify(traits);
}
};
/**
* Group.
*
* @param {String} id (optional)
* @param {Object} properties (optional)
* @param {Object} options (optional)
*
* TODO: add group
* TODO: add `trait.company/organization` from trak.io docs http://docs.trak.io/properties.html#special
*/
/**
* Track.
*
* @param {Track} track
*/
Trakio.prototype.track = function(track){
window.trak.io.track(track.event(), track.properties());
};
/**
* Alias.
*
* @param {Alias} alias
*/
Trakio.prototype.alias = function(alias){
if (!window.trak.io.distinct_id) return;
var from = alias.from();
var to = alias.to();
if (to === window.trak.io.distinct_id()) return;
if (from) {
window.trak.io.alias(from, to);
} else {
window.trak.io.alias(to);
}
};
}, {"analytics.js-integration":83,"alias":172,"clone":171}],
75: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var each = require('each');
/**
* HOP.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `TwitterAds`.
*/
var TwitterAds = module.exports = integration('Twitter Ads')
.option('page', '')
.tag('<img src="//analytics.twitter.com/i/adsct?txn_id={{ pixelId }}&p_id=Twitter"/>')
.mapping('events');
/**
* Initialize.
*
* @param {Object} page
*/
TwitterAds.prototype.initialize = function(){
this.ready();
};
/**
* Page.
*
* @param {Page} page
*/
TwitterAds.prototype.page = function(page){
if (this.options.page) {
this.load({ pixelId: this.options.page });
}
};
/**
* Track.
*
* @param {Track} track
*/
TwitterAds.prototype.track = function(track){
var events = this.events(track.event());
var self = this;
each(events, function(pixelId){
self.load({ pixelId: pixelId });
});
};
}, {"analytics.js-integration":83,"each":4}],
76: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_uc');
/**
* Expose `Usercycle` integration.
*/
var Usercycle = module.exports = integration('USERcycle')
.assumesPageview()
.global('_uc')
.option('key', '')
.tag('<script src="//api.usercycle.com/javascripts/track.js">');
/**
* Initialize.
*
* http://docs.usercycle.com/javascript_api
*
* @param {Object} page
*/
Usercycle.prototype.initialize = function(page){
push('_key', this.options.key);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Usercycle.prototype.loaded = function(){
return !! (window._uc && window._uc.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Usercycle.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
if (id) push('uid', id);
// there's a special `came_back` event used for retention and traits
push('action', 'came_back', traits);
};
/**
* Track.
*
* @param {Track} track
*/
Usercycle.prototype.track = function(track){
push('action', track.event(), track.properties({
revenue: 'revenue_amount'
}));
};
}, {"analytics.js-integration":83,"global-queue":167}],
77: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('UserVoice');
var convertDates = require('convert-dates');
var unix = require('to-unix-timestamp');
var alias = require('alias');
var clone = require('clone');
/**
* Expose `UserVoice` integration.
*/
var UserVoice = module.exports = integration('UserVoice')
.assumesPageview()
.global('UserVoice')
.global('showClassicWidget')
.option('apiKey', '')
.option('classic', false)
.option('forumId', null)
.option('showWidget', true)
.option('mode', 'contact')
.option('accentColor', '#448dd6')
.option('smartvote', true)
.option('trigger', null)
.option('triggerPosition', 'bottom-right')
.option('triggerColor', '#ffffff')
.option('triggerBackgroundColor', 'rgba(46, 49, 51, 0.6)')
// BACKWARDS COMPATIBILITY: classic options
.option('classicMode', 'full')
.option('primaryColor', '#cc6d00')
.option('linkColor', '#007dbf')
.option('defaultMode', 'support')
.option('tabLabel', 'Feedback & Support')
.option('tabColor', '#cc6d00')
.option('tabPosition', 'middle-right')
.option('tabInverted', false)
.tag('<script src="//widget.uservoice.com/{{ apiKey }}.js">');
/**
* When in "classic" mode, on `construct` swap all of the method to point to
* their classic counterparts.
*/
UserVoice.on('construct', function(integration){
if (!integration.options.classic) return;
integration.group = undefined;
integration.identify = integration.identifyClassic;
integration.initialize = integration.initializeClassic;
});
/**
* Initialize.
*
* @param {Object} page
*/
UserVoice.prototype.initialize = function(page){
var options = this.options;
var opts = formatOptions(options);
push('set', opts);
push('autoprompt', {});
if (options.showWidget) {
options.trigger
? push('addTrigger', options.trigger, opts)
: push('addTrigger', opts);
}
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
UserVoice.prototype.loaded = function(){
return !! (window.UserVoice && window.UserVoice.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
UserVoice.prototype.identify = function(identify){
var traits = identify.traits({ created: 'created_at' });
traits = convertDates(traits, unix);
push('identify', traits);
};
/**
* Group.
*
* @param {Group} group
*/
UserVoice.prototype.group = function(group){
var traits = group.traits({ created: 'created_at' });
traits = convertDates(traits, unix);
push('identify', { account: traits });
};
/**
* Initialize (classic).
*
* @param {Object} options
* @param {Function} ready
*/
UserVoice.prototype.initializeClassic = function(){
var options = this.options;
window.showClassicWidget = showClassicWidget; // part of public api
if (options.showWidget) showClassicWidget('showTab', formatClassicOptions(options));
this.load(this.ready);
};
/**
* Identify (classic).
*
* @param {Identify} identify
*/
UserVoice.prototype.identifyClassic = function(identify){
push('setCustomFields', identify.traits());
};
/**
* Format the options for UserVoice.
*
* @param {Object} options
* @return {Object}
*/
function formatOptions(options){
return alias(options, {
forumId: 'forum_id',
accentColor: 'accent_color',
smartvote: 'smartvote_enabled',
triggerColor: 'trigger_color',
triggerBackgroundColor: 'trigger_background_color',
triggerPosition: 'trigger_position'
});
}
/**
* Format the classic options for UserVoice.
*
* @param {Object} options
* @return {Object}
*/
function formatClassicOptions(options){
return alias(options, {
forumId: 'forum_id',
classicMode: 'mode',
primaryColor: 'primary_color',
tabPosition: 'tab_position',
tabColor: 'tab_color',
linkColor: 'link_color',
defaultMode: 'default_mode',
tabLabel: 'tab_label',
tabInverted: 'tab_inverted'
});
}
/**
* Show the classic version of the UserVoice widget. This method is usually part
* of UserVoice classic's public API.
*
* @param {String} type ('showTab' or 'showLightbox')
* @param {Object} options (optional)
*/
function showClassicWidget(type, options){
type = type || 'showLightbox';
push(type, 'classic_widget', options);
}
}, {"analytics.js-integration":83,"global-queue":167,"convert-dates":173,"to-unix-timestamp":180,"alias":172,"clone":171}],
180: [function(require, module, exports) {
/**
* Expose `toUnixTimestamp`.
*/
module.exports = toUnixTimestamp;
/**
* Convert a `date` into a Unix timestamp.
*
* @param {Date}
* @return {Number}
*/
function toUnixTimestamp (date) {
return Math.floor(date.getTime() / 1000);
}
}, {}],
78: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_veroq');
var cookie = require('component/cookie');
/**
* Expose `Vero` integration.
*/
var Vero = module.exports = integration('Vero')
.global('_veroq')
.option('apiKey', '')
.tag('<script src="//d3qxef4rp70elm.cloudfront.net/m.js">');
/**
* Initialize.
*
* https://github.com/getvero/vero-api/blob/master/sections/js.md
*
* @param {Object} page
*/
Vero.prototype.initialize = function(page){
// clear default cookie so vero parses correctly.
// this is for the tests.
// basically, they have window.addEventListener('unload')
// which then saves their "command_store", which is an array.
// so we just want to create that initially so we can reload the tests.
if (!cookie('__veroc4')) cookie('__veroc4', '[]');
push('init', { api_key: this.options.apiKey });
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Vero.prototype.loaded = function(){
return !! (window._veroq && window._veroq.push !== Array.prototype.push);
};
/**
* Page.
*
* https://www.getvero.com/knowledge-base#/questions/71768-Does-Vero-track-pageviews
*
* @param {Page} page
*/
Vero.prototype.page = function(page){
push('trackPageview');
};
/**
* Identify.
*
* https://github.com/getvero/vero-api/blob/master/sections/js.md#user-identification
*
* @param {Identify} identify
*/
Vero.prototype.identify = function(identify){
var traits = identify.traits();
var email = identify.email();
var id = identify.userId();
if (!id || !email) return; // both required
push('user', traits);
};
/**
* Track.
*
* https://github.com/getvero/vero-api/blob/master/sections/js.md#tracking-events
*
* @param {Track} track
*/
Vero.prototype.track = function(track){
push('track', track.event(), track.properties());
};
}, {"analytics.js-integration":83,"global-queue":167,"component/cookie":181}],
181: [function(require, module, exports) {
/**
* Encode.
*/
var encode = encodeURIComponent;
/**
* Decode.
*/
var decode = decodeURIComponent;
/**
* Set or get cookie `name` with `value` and `options` object.
*
* @param {String} name
* @param {String} value
* @param {Object} options
* @return {Mixed}
* @api public
*/
module.exports = function(name, value, options){
switch (arguments.length) {
case 3:
case 2:
return set(name, value, options);
case 1:
return get(name);
default:
return all();
}
};
/**
* Set cookie `name` to `value`.
*
* @param {String} name
* @param {String} value
* @param {Object} options
* @api private
*/
function set(name, value, options) {
options = options || {};
var str = encode(name) + '=' + encode(value);
if (null == value) options.maxage = -1;
if (options.maxage) {
options.expires = new Date(+new Date + options.maxage);
}
if (options.path) str += '; path=' + options.path;
if (options.domain) str += '; domain=' + options.domain;
if (options.expires) str += '; expires=' + options.expires.toGMTString();
if (options.secure) str += '; secure';
document.cookie = str;
}
/**
* Return all cookies.
*
* @return {Object}
* @api private
*/
function all() {
return parse(document.cookie);
}
/**
* Get cookie `name`.
*
* @param {String} name
* @return {String}
* @api private
*/
function get(name) {
return all()[name];
}
/**
* Parse cookie `str`.
*
* @param {String} str
* @return {Object}
* @api private
*/
function parse(str) {
var obj = {};
var pairs = str.split(/ *; */);
var pair;
if ('' == pairs[0]) return obj;
for (var i = 0; i < pairs.length; ++i) {
pair = pairs[i].split('=');
obj[decode(pair[0])] = decode(pair[1]);
}
return obj;
}
}, {}],
79: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var tick = require('next-tick');
var each = require('each');
/**
* Expose `VWO` integration.
*/
var VWO = module.exports = integration('Visual Website Optimizer')
.option('replay', true);
/**
* Initialize.
*
* http://v2.visualwebsiteoptimizer.com/tools/get_tracking_code.php
*/
VWO.prototype.initialize = function(){
if (this.options.replay) this.replay();
this.ready();
};
/**
* Replay the experiments the user has seen as traits to all other integrations.
* Wait for the next tick to replay so that the `analytics` object and all of
* the integrations are fully initialized.
*/
VWO.prototype.replay = function(){
var analytics = this.analytics;
tick(function(){
experiments(function(err, traits){
if (traits) analytics.identify(traits);
});
});
};
/**
* Get dictionary of experiment keys and variations.
*
* http://visualwebsiteoptimizer.com/knowledge/integration-of-vwo-with-kissmetrics/
*
* @param {Function} fn
* @return {Object}
*/
function experiments(fn){
enqueue(function(){
var data = {};
var ids = window._vwo_exp_ids;
if (!ids) return fn();
each(ids, function(id){
var name = variation(id);
if (name) data['Experiment: ' + id] = name;
});
fn(null, data);
});
}
/**
* Add a `fn` to the VWO queue, creating one if it doesn't exist.
*
* @param {Function} fn
*/
function enqueue(fn){
window._vis_opt_queue = window._vis_opt_queue || [];
window._vis_opt_queue.push(fn);
}
/**
* Get the chosen variation's name from an experiment `id`.
*
* http://visualwebsiteoptimizer.com/knowledge/integration-of-vwo-with-kissmetrics/
*
* @param {String} id
* @return {String}
*/
function variation(id){
var experiments = window._vwo_exp;
if (!experiments) return null;
var experiment = experiments[id];
var variationId = experiment.combination_chosen;
return variationId ? experiment.comb_n[variationId] : null;
}
}, {"analytics.js-integration":83,"next-tick":97,"each":4}],
80: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
/**
* Expose `WebEngage` integration.
*/
var WebEngage = module.exports = integration('WebEngage')
.assumesPageview()
.global('_weq')
.global('webengage')
.option('widgetVersion', '4.0')
.option('licenseCode', '')
.tag('http', '<script src="http://cdn.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">')
.tag('https', '<script src="https://ssl.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">');
/**
* Initialize.
*
* @param {Object} page
*/
WebEngage.prototype.initialize = function(page){
var _weq = window._weq = window._weq || {};
_weq['webengage.licenseCode'] = this.options.licenseCode;
_weq['webengage.widgetVersion'] = this.options.widgetVersion;
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
WebEngage.prototype.loaded = function(){
return !! window.webengage;
};
}, {"analytics.js-integration":83,"use-https":85}],
81: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var snake = require('to-snake-case');
var isEmail = require('is-email');
var extend = require('extend');
var each = require('each');
var type = require('type');
/**
* Expose `Woopra` integration.
*/
var Woopra = module.exports = integration('Woopra')
.global('woopra')
.option('domain', '')
.option('cookieName', 'wooTracker')
.option('cookieDomain', null)
.option('cookiePath', '/')
.option('ping', true)
.option('pingInterval', 12000)
.option('idleTimeout', 300000)
.option('downloadTracking', true)
.option('outgoingTracking', true)
.option('outgoingIgnoreSubdomain', true)
.option('downloadPause', 200)
.option('outgoingPause', 400)
.option('ignoreQueryUrl', true)
.option('hideCampaign', false)
.tag('<script src="//static.woopra.com/js/w.js">');
/**
* Initialize.
*
* http://www.woopra.com/docs/setup/javascript-tracking/
*
* @param {Object} page
*/
Woopra.prototype.initialize = function(page){
(function () {var i, s, z, w = window, d = document, a = arguments, q = 'script', f = ['config', 'track', 'identify', 'visit', 'push', 'call'], c = function () {var i, self = this; self._e = []; for (i = 0; i < f.length; i++) {(function (f) {self[f] = function () {self._e.push([f].concat(Array.prototype.slice.call(arguments, 0))); return self; }; })(f[i]); } }; w._w = w._w || {}; for (i = 0; i < a.length; i++) { w._w[a[i]] = w[a[i]] = w[a[i]] || new c(); } })('woopra');
this.load(this.ready);
each(this.options, function(key, value){
key = snake(key);
if (null == value) return;
if ('' === value) return;
window.woopra.config(key, value);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Woopra.prototype.loaded = function(){
return !! (window.woopra && window.woopra.loaded);
};
/**
* Page.
*
* @param {String} category (optional)
*/
Woopra.prototype.page = function(page){
var props = page.properties();
var name = page.fullName();
if (name) props.title = name;
window.woopra.track('pv', props);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Woopra.prototype.identify = function(identify){
var traits = identify.traits();
if (identify.name()) traits.name = identify.name();
window.woopra.identify(traits).push(); // `push` sends it off async
};
/**
* Track.
*
* @param {Track} track
*/
Woopra.prototype.track = function(track){
window.woopra.track(track.event(), track.properties());
};
}, {"analytics.js-integration":83,"to-snake-case":84,"is-email":162,"extend":122,"each":4,"type":7}],
82: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var tick = require('next-tick');
var bind = require('bind');
var when = require('when');
/**
* Expose `Yandex` integration.
*/
var Yandex = module.exports = integration('Yandex Metrica')
.assumesPageview()
.global('yandex_metrika_callbacks')
.global('Ya')
.option('counterId', null)
.option('clickmap', false)
.option('webvisor', false)
.tag('<script src="//mc.yandex.ru/metrika/watch.js">');
/**
* Initialize.
*
* http://api.yandex.com/metrika/
* https://metrica.yandex.com/22522351?step=2#tab=code
*
* @param {Object} page
*/
Yandex.prototype.initialize = function(page){
var id = this.options.counterId;
var clickmap = this.options.clickmap;
var webvisor = this.options.webvisor;
push(function(){
window['yaCounter' + id] = new window.Ya.Metrika({
id: id,
clickmap: clickmap,
webvisor: webvisor
});
});
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, function(){
tick(ready);
});
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Yandex.prototype.loaded = function(){
return !! (window.Ya && window.Ya.Metrika);
};
/**
* Push a new callback on the global Yandex queue.
*
* @param {Function} callback
*/
function push(callback){
window.yandex_metrika_callbacks = window.yandex_metrika_callbacks || [];
window.yandex_metrika_callbacks.push(callback);
}
}, {"analytics.js-integration":83,"next-tick":97,"bind":95,"when":123}],
3: [function(require, module, exports) {
var after = require('after');
var bind = require('bind');
var callback = require('callback');
var canonical = require('canonical');
var clone = require('clone');
var cookie = require('./cookie');
var debug = require('debug');
var defaults = require('defaults');
var each = require('each');
var Emitter = require('emitter');
var group = require('./group');
var is = require('is');
var isEmail = require('is-email');
var isMeta = require('is-meta');
var newDate = require('new-date');
var on = require('event').bind;
var prevent = require('prevent');
var querystring = require('querystring');
var size = require('object').length;
var store = require('./store');
var url = require('url');
var user = require('./user');
var Facade = require('facade');
var Identify = Facade.Identify;
var Group = Facade.Group;
var Alias = Facade.Alias;
var Track = Facade.Track;
var Page = Facade.Page;
/**
* Expose `Analytics`.
*/
exports = module.exports = Analytics;
/**
* Expose `cookie`
*/
exports.cookie = cookie;
exports.store = store;
/**
* Initialize a new `Analytics` instance.
*/
function Analytics () {
this.Integrations = {};
this._integrations = {};
this._readied = false;
this._timeout = 300;
this._user = user; // BACKWARDS COMPATIBILITY
bind.all(this);
var self = this;
this.on('initialize', function (settings, options) {
if (options.initialPageview) self.page();
});
this.on('initialize', function () {
self._parseQuery();
});
}
/**
* Event Emitter.
*/
Emitter(Analytics.prototype);
/**
* Use a `plugin`.
*
* @param {Function} plugin
* @return {Analytics}
*/
Analytics.prototype.use = function (plugin) {
plugin(this);
return this;
};
/**
* Define a new `Integration`.
*
* @param {Function} Integration
* @return {Analytics}
*/
Analytics.prototype.addIntegration = function (Integration) {
var name = Integration.prototype.name;
if (!name) throw new TypeError('attempted to add an invalid integration');
this.Integrations[name] = Integration;
return this;
};
/**
* Initialize with the given integration `settings` and `options`. Aliased to
* `init` for convenience.
*
* @param {Object} settings
* @param {Object} options (optional)
* @return {Analytics}
*/
Analytics.prototype.init =
Analytics.prototype.initialize = function (settings, options) {
settings = settings || {};
options = options || {};
this._options(options);
this._readied = false;
// clean unknown integrations from settings
var self = this;
each(settings, function (name) {
var Integration = self.Integrations[name];
if (!Integration) delete settings[name];
});
// add integrations
each(settings, function (name, opts) {
var Integration = self.Integrations[name];
var integration = new Integration(clone(opts));
self.add(integration);
});
var integrations = this._integrations;
// load user now that options are set
user.load();
group.load();
// make ready callback
var ready = after(size(integrations), function () {
self._readied = true;
self.emit('ready');
});
// initialize integrations, passing ready
each(integrations, function (name, integration) {
if (options.initialPageview && integration.options.initialPageview === false) {
integration.page = after(2, integration.page);
}
integration.analytics = self;
integration.once('ready', ready);
integration.initialize();
});
// backwards compat with angular plugin.
// TODO: remove
this.initialized = true;
this.emit('initialize', settings, options);
return this;
};
/**
* Add an integration.
*
* @param {Integration} integration
*/
Analytics.prototype.add = function(integration){
this._integrations[integration.name] = integration;
return this;
};
/**
* Identify a user by optional `id` and `traits`.
*
* @param {String} id (optional)
* @param {Object} traits (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.identify = function (id, traits, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(traits)) fn = traits, options = null, traits = null;
if (is.object(id)) options = traits, traits = id, id = user.id();
// clone traits before we manipulate so we don't do anything uncouth, and take
// from `user` so that we carryover anonymous traits
user.identify(id, traits);
id = user.id();
traits = user.traits();
this._invoke('identify', message(Identify, {
options: options,
traits: traits,
userId: id
}));
// emit
this.emit('identify', id, traits, options);
this._callback(fn);
return this;
};
/**
* Return the current user.
*
* @return {Object}
*/
Analytics.prototype.user = function () {
return user;
};
/**
* Identify a group by optional `id` and `traits`. Or, if no arguments are
* supplied, return the current group.
*
* @param {String} id (optional)
* @param {Object} traits (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics or Object}
*/
Analytics.prototype.group = function (id, traits, options, fn) {
if (0 === arguments.length) return group;
if (is.fn(options)) fn = options, options = null;
if (is.fn(traits)) fn = traits, options = null, traits = null;
if (is.object(id)) options = traits, traits = id, id = group.id();
// grab from group again to make sure we're taking from the source
group.identify(id, traits);
id = group.id();
traits = group.traits();
this._invoke('group', message(Group, {
options: options,
traits: traits,
groupId: id
}));
this.emit('group', id, traits, options);
this._callback(fn);
return this;
};
/**
* Track an `event` that a user has triggered with optional `properties`.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.track = function (event, properties, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(properties)) fn = properties, options = null, properties = null;
this._invoke('track', message(Track, {
properties: properties,
options: options,
event: event
}));
this.emit('track', event, properties, options);
this._callback(fn);
return this;
};
/**
* Helper method to track an outbound link that would normally navigate away
* from the page before the analytics calls were sent.
*
* BACKWARDS COMPATIBILITY: aliased to `trackClick`.
*
* @param {Element or Array} links
* @param {String or Function} event
* @param {Object or Function} properties (optional)
* @return {Analytics}
*/
Analytics.prototype.trackClick =
Analytics.prototype.trackLink = function (links, event, properties) {
if (!links) return this;
if (is.element(links)) links = [links]; // always arrays, handles jquery
var self = this;
each(links, function (el) {
if (!is.element(el)) throw new TypeError('Must pass HTMLElement to `analytics.trackLink`.');
on(el, 'click', function (e) {
var ev = is.fn(event) ? event(el) : event;
var props = is.fn(properties) ? properties(el) : properties;
self.track(ev, props);
if (el.href && el.target !== '_blank' && !isMeta(e)) {
prevent(e);
self._callback(function () {
window.location.href = el.href;
});
}
});
});
return this;
};
/**
* Helper method to track an outbound form that would normally navigate away
* from the page before the analytics calls were sent.
*
* BACKWARDS COMPATIBILITY: aliased to `trackSubmit`.
*
* @param {Element or Array} forms
* @param {String or Function} event
* @param {Object or Function} properties (optional)
* @return {Analytics}
*/
Analytics.prototype.trackSubmit =
Analytics.prototype.trackForm = function (forms, event, properties) {
if (!forms) return this;
if (is.element(forms)) forms = [forms]; // always arrays, handles jquery
var self = this;
each(forms, function (el) {
if (!is.element(el)) throw new TypeError('Must pass HTMLElement to `analytics.trackForm`.');
function handler (e) {
prevent(e);
var ev = is.fn(event) ? event(el) : event;
var props = is.fn(properties) ? properties(el) : properties;
self.track(ev, props);
self._callback(function () {
el.submit();
});
}
// support the events happening through jQuery or Zepto instead of through
// the normal DOM API, since `el.submit` doesn't bubble up events...
var $ = window.jQuery || window.Zepto;
if ($) {
$(el).submit(handler);
} else {
on(el, 'submit', handler);
}
});
return this;
};
/**
* Trigger a pageview, labeling the current page with an optional `category`,
* `name` and `properties`.
*
* @param {String} category (optional)
* @param {String} name (optional)
* @param {Object or String} properties (or path) (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.page = function (category, name, properties, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(properties)) fn = properties, options = properties = null;
if (is.fn(name)) fn = name, options = properties = name = null;
if (is.object(category)) options = name, properties = category, name = category = null;
if (is.object(name)) options = properties, properties = name, name = null;
if (is.string(category) && !is.string(name)) name = category, category = null;
var defs = {
path: canonicalPath(),
referrer: document.referrer,
title: document.title,
search: location.search
};
if (name) defs.name = name;
if (category) defs.category = category;
properties = clone(properties) || {};
defaults(properties, defs);
properties.url = properties.url || canonicalUrl(properties.search);
this._invoke('page', message(Page, {
properties: properties,
category: category,
options: options,
name: name
}));
this.emit('page', category, name, properties, options);
this._callback(fn);
return this;
};
/**
* BACKWARDS COMPATIBILITY: convert an old `pageview` to a `page` call.
*
* @param {String} url (optional)
* @param {Object} options (optional)
* @return {Analytics}
* @api private
*/
Analytics.prototype.pageview = function (url, options) {
var properties = {};
if (url) properties.path = url;
this.page(properties);
return this;
};
/**
* Merge two previously unassociated user identities.
*
* @param {String} to
* @param {String} from (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.alias = function (to, from, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(from)) fn = from, options = null, from = null;
if (is.object(from)) options = from, from = null;
this._invoke('alias', message(Alias, {
options: options,
from: from,
to: to
}));
this.emit('alias', to, from, options);
this._callback(fn);
return this;
};
/**
* Register a `fn` to be fired when all the analytics services are ready.
*
* @param {Function} fn
* @return {Analytics}
*/
Analytics.prototype.ready = function (fn) {
if (!is.fn(fn)) return this;
this._readied
? callback.async(fn)
: this.once('ready', fn);
return this;
};
/**
* Set the `timeout` (in milliseconds) used for callbacks.
*
* @param {Number} timeout
*/
Analytics.prototype.timeout = function (timeout) {
this._timeout = timeout;
};
/**
* Enable or disable debug.
*
* @param {String or Boolean} str
*/
Analytics.prototype.debug = function(str){
if (0 == arguments.length || str) {
debug.enable('analytics:' + (str || '*'));
} else {
debug.disable();
}
};
/**
* Apply options.
*
* @param {Object} options
* @return {Analytics}
* @api private
*/
Analytics.prototype._options = function (options) {
options = options || {};
cookie.options(options.cookie);
store.options(options.localStorage);
user.options(options.user);
group.options(options.group);
return this;
};
/**
* Callback a `fn` after our defined timeout period.
*
* @param {Function} fn
* @return {Analytics}
* @api private
*/
Analytics.prototype._callback = function (fn) {
callback.async(fn, this._timeout);
return this;
};
/**
* Call `method` with `facade` on all enabled integrations.
*
* @param {String} method
* @param {Facade} facade
* @return {Analytics}
* @api private
*/
Analytics.prototype._invoke = function (method, facade) {
var options = facade.options();
this.emit('invoke', facade);
each(this._integrations, function (name, integration) {
if (!facade.enabled(name)) return;
integration.invoke.call(integration, method, facade);
});
return this;
};
/**
* Push `args`.
*
* @param {Array} args
* @api private
*/
Analytics.prototype.push = function(args){
var method = args.shift();
if (!this[method]) return;
this[method].apply(this, args);
};
/**
* Parse the query string for callable methods.
*
* @return {Analytics}
* @api private
*/
Analytics.prototype._parseQuery = function () {
// Identify and track any `ajs_uid` and `ajs_event` parameters in the URL.
var q = querystring.parse(window.location.search);
if (q.ajs_uid) this.identify(q.ajs_uid);
if (q.ajs_event) this.track(q.ajs_event);
return this;
};
/**
* Return the canonical path for the page.
*
* @return {String}
*/
function canonicalPath () {
var canon = canonical();
if (!canon) return window.location.pathname;
var parsed = url.parse(canon);
return parsed.pathname;
}
/**
* Return the canonical URL for the page concat the given `search`
* and strip the hash.
*
* @param {String} search
* @return {String}
*/
function canonicalUrl (search) {
var canon = canonical();
if (canon) return ~canon.indexOf('?') ? canon : canon + search;
var url = window.location.href;
var i = url.indexOf('#');
return -1 == i ? url : url.slice(0, i);
}
/**
* Create a new message with `Type` and `msg`
*
* the function will make sure that the `msg.options`
* is merged to `msg` and deletes `msg.options` if it
* has `.context / .timestamp / .integrations`.
*
* Example:
*
* message(Identify, {
* options: { timestamp: Date, context: Object, integrations: Object },
* traits: { trait: true },
* userId: 123
* });
*
* // =>
*
* {
* userId: 123,
* context: Object,
* timestamp: Date,
* integrations: Object
* traits: { trait: true }
* }
*
* @param {Function} Type
* @param {Object} msg
* @return {Facade}
*/
function message(Type, msg){
var ctx = msg.options || {};
if (ctx.timestamp || ctx.integrations || ctx.context) {
msg = defaults(ctx, msg);
delete msg.options;
}
return new Type(msg);
}
}, {"after":105,"bind":182,"callback":88,"canonical":175,"clone":89,"./cookie":183,"debug":184,"defaults":91,"each":4,"emitter":102,"./group":185,"is":86,"is-email":162,"is-meta":186,"new-date":139,"event":187,"prevent":188,"querystring":189,"object":174,"./store":190,"url":176,"./user":191,"facade":124}],
182: [function(require, module, exports) {
try {
var bind = require('bind');
} catch (e) {
var bind = require('bind-component');
}
var bindAll = require('bind-all');
/**
* Expose `bind`.
*/
module.exports = exports = bind;
/**
* Expose `bindAll`.
*/
exports.all = bindAll;
/**
* Expose `bindMethods`.
*/
exports.methods = bindMethods;
/**
* Bind `methods` on `obj` to always be called with the `obj` as context.
*
* @param {Object} obj
* @param {String} methods...
*/
function bindMethods (obj, methods) {
methods = [].slice.call(arguments, 1);
for (var i = 0, method; method = methods[i]; i++) {
obj[method] = bind(obj, obj[method]);
}
return obj;
}
}, {"bind":95,"bind-all":96}],
183: [function(require, module, exports) {
var debug = require('debug')('analytics.js:cookie');
var bind = require('bind');
var cookie = require('cookie');
var clone = require('clone');
var defaults = require('defaults');
var json = require('json');
var topDomain = require('top-domain');
/**
* Initialize a new `Cookie` with `options`.
*
* @param {Object} options
*/
function Cookie (options) {
this.options(options);
}
/**
* Get or set the cookie options.
*
* @param {Object} options
* @field {Number} maxage (1 year)
* @field {String} domain
* @field {String} path
* @field {Boolean} secure
*/
Cookie.prototype.options = function (options) {
if (arguments.length === 0) return this._options;
options = options || {};
var domain = '.' + topDomain(window.location.href);
this._options = defaults(options, {
maxage: 31536000000, // default to a year
path: '/',
domain: domain
});
// http://curl.haxx.se/rfc/cookie_spec.html
// https://publicsuffix.org/list/effective_tld_names.dat
//
// try setting a dummy cookie with the options
// if the cookie isn't set, it probably means
// that the domain is on the public suffix list
// like myapp.herokuapp.com or localhost / ip.
this.set('ajs:test', true);
if (!this.get('ajs:test')) {
debug('fallback to domain=null');
this._options.domain = null;
}
this.remove('ajs:test');
};
/**
* Set a `key` and `value` in our cookie.
*
* @param {String} key
* @param {Object} value
* @return {Boolean} saved
*/
Cookie.prototype.set = function (key, value) {
try {
value = json.stringify(value);
cookie(key, value, clone(this._options));
return true;
} catch (e) {
return false;
}
};
/**
* Get a value from our cookie by `key`.
*
* @param {String} key
* @return {Object} value
*/
Cookie.prototype.get = function (key) {
try {
var value = cookie(key);
value = value ? json.parse(value) : null;
return value;
} catch (e) {
return null;
}
};
/**
* Remove a value from our cookie by `key`.
*
* @param {String} key
* @return {Boolean} removed
*/
Cookie.prototype.remove = function (key) {
try {
cookie(key, null, clone(this._options));
return true;
} catch (e) {
return false;
}
};
/**
* Expose the cookie singleton.
*/
module.exports = bind.all(new Cookie());
/**
* Expose the `Cookie` constructor.
*/
module.exports.Cookie = Cookie;
}, {"debug":184,"bind":182,"cookie":181,"clone":89,"defaults":91,"json":192,"top-domain":193}],
184: [function(require, module, exports) {
if ('undefined' == typeof window) {
module.exports = require('./lib/debug');
} else {
module.exports = require('./debug');
}
}, {"./lib/debug":194,"./debug":195}],
194: [function(require, module, exports) {
/**
* Module dependencies.
*/
var tty = require('tty');
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Enabled debuggers.
*/
var names = []
, skips = [];
(process.env.DEBUG || '')
.split(/[\s,]+/)
.forEach(function(name){
name = name.replace('*', '.*?');
if (name[0] === '-') {
skips.push(new RegExp('^' + name.substr(1) + '$'));
} else {
names.push(new RegExp('^' + name + '$'));
}
});
/**
* Colors.
*/
var colors = [6, 2, 3, 4, 5, 1];
/**
* Previous debug() call.
*/
var prev = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Is stdout a TTY? Colored output is disabled when `true`.
*/
var isatty = tty.isatty(2);
/**
* Select a color.
*
* @return {Number}
* @api private
*/
function color() {
return colors[prevColor++ % colors.length];
}
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
function humanize(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
}
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
function disabled(){}
disabled.enabled = false;
var match = skips.some(function(re){
return re.test(name);
});
if (match) return disabled;
match = names.some(function(re){
return re.test(name);
});
if (!match) return disabled;
var c = color();
function colored(fmt) {
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (prev[name] || curr);
prev[name] = curr;
fmt = ' \u001b[9' + c + 'm' + name + ' '
+ '\u001b[3' + c + 'm\u001b[90m'
+ fmt + '\u001b[3' + c + 'm'
+ ' +' + humanize(ms) + '\u001b[0m';
console.error.apply(this, arguments);
}
function plain(fmt) {
fmt = coerce(fmt);
fmt = new Date().toUTCString()
+ ' ' + name + ' ' + fmt;
console.error.apply(this, arguments);
}
colored.enabled = plain.enabled = true;
return isatty || process.env.DEBUG_COLORS
? colored
: plain;
}
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
}, {}],
195: [function(require, module, exports) {
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
if (!debug.enabled(name)) return function(){};
return function(fmt){
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (debug[name] || curr);
debug[name] = curr;
fmt = name
+ ' '
+ fmt
+ ' +' + debug.humanize(ms);
// This hackery is required for IE8
// where `console.log` doesn't have 'apply'
window.console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
}
/**
* The currently active debug mode names.
*/
debug.names = [];
debug.skips = [];
/**
* Enables a debug mode by name. This can include modes
* separated by a colon and wildcards.
*
* @param {String} name
* @api public
*/
debug.enable = function(name) {
try {
localStorage.debug = name;
} catch(e){}
var split = (name || '').split(/[\s,]+/)
, len = split.length;
for (var i = 0; i < len; i++) {
name = split[i].replace('*', '.*?');
if (name[0] === '-') {
debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
}
else {
debug.names.push(new RegExp('^' + name + '$'));
}
}
};
/**
* Disable debug output.
*
* @api public
*/
debug.disable = function(){
debug.enable('');
};
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
debug.humanize = function(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
};
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
debug.enabled = function(name) {
for (var i = 0, len = debug.skips.length; i < len; i++) {
if (debug.skips[i].test(name)) {
return false;
}
}
for (var i = 0, len = debug.names.length; i < len; i++) {
if (debug.names[i].test(name)) {
return true;
}
}
return false;
};
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
// persist
try {
if (window.localStorage) debug.enable(localStorage.debug);
} catch(e){}
}, {}],
192: [function(require, module, exports) {
var json = window.JSON || {};
var stringify = json.stringify;
var parse = json.parse;
module.exports = parse && stringify
? JSON
: require('json-fallback');
}, {"json-fallback":196}],
196: [function(require, module, exports) {
/*
json2.js
2014-02-04
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
(function () {
'use strict';
var JSON = module.exports = {};
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function () {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function () {
return this.valueOf();
};
}
var cx,
escapable,
gap,
indent,
meta,
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
};
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
}, {}],
193: [function(require, module, exports) {
/**
* Module dependencies.
*/
var parse = require('url').parse;
/**
* Expose `domain`
*/
module.exports = domain;
/**
* RegExp
*/
var regexp = /[a-z0-9][a-z0-9\-]*[a-z0-9]\.[a-z\.]{2,6}$/i;
/**
* Get the top domain.
*
* Official Grammar: http://tools.ietf.org/html/rfc883#page-56
* Look for tlds with up to 2-6 characters.
*
* Example:
*
* domain('http://localhost:3000/baz');
* // => ''
* domain('http://dev:3000/baz');
* // => ''
* domain('http://127.0.0.1:3000/baz');
* // => ''
* domain('http://segment.io/baz');
* // => 'segment.io'
*
* @param {String} url
* @return {String}
* @api public
*/
function domain(url){
var host = parse(url).hostname;
var match = host.match(regexp);
return match ? match[0] : '';
};
}, {"url":176}],
185: [function(require, module, exports) {
var debug = require('debug')('analytics:group');
var Entity = require('./entity');
var inherit = require('inherit');
var bind = require('bind');
/**
* Group defaults
*/
Group.defaults = {
persist: true,
cookie: {
key: 'ajs_group_id'
},
localStorage: {
key: 'ajs_group_properties'
}
};
/**
* Initialize a new `Group` with `options`.
*
* @param {Object} options
*/
function Group (options) {
this.defaults = Group.defaults;
this.debug = debug;
Entity.call(this, options);
}
/**
* Inherit `Entity`
*/
inherit(Group, Entity);
/**
* Expose the group singleton.
*/
module.exports = bind.all(new Group());
/**
* Expose the `Group` constructor.
*/
module.exports.Group = Group;
}, {"debug":184,"./entity":197,"inherit":198,"bind":182}],
197: [function(require, module, exports) {
var traverse = require('isodate-traverse');
var defaults = require('defaults');
var cookie = require('./cookie');
var store = require('./store');
var extend = require('extend');
var clone = require('clone');
/**
* Expose `Entity`
*/
module.exports = Entity;
/**
* Initialize new `Entity` with `options`.
*
* @param {Object} options
*/
function Entity(options){
this.protocol = window.location.protocol;
this.options(options);
}
/**
* Get the storage.
*
* When .protocol is `file:` or `chrome-extension:`
* the method will return the localstorage (store)
* otherwise it will return the cookie.
*
* @return {Object}
*/
Entity.prototype.storage = function(){
return 'file:' == this.protocol
|| 'chrome-extension:' == this.protocol
? store
: cookie;
};
/**
* Get or set storage `options`.
*
* @param {Object} options
* @property {Object} cookie
* @property {Object} localStorage
* @property {Boolean} persist (default: `true`)
*/
Entity.prototype.options = function (options) {
if (arguments.length === 0) return this._options;
options || (options = {});
defaults(options, this.defaults || {});
this._options = options;
};
/**
* Get or set the entity's `id`.
*
* @param {String} id
*/
Entity.prototype.id = function (id) {
switch (arguments.length) {
case 0: return this._getId();
case 1: return this._setId(id);
}
};
/**
* Get the entity's id.
*
* @return {String}
*/
Entity.prototype._getId = function () {
var storage = this.storage();
var ret = this._options.persist
? storage.get(this._options.cookie.key)
: this._id;
return ret === undefined ? null : ret;
};
/**
* Set the entity's `id`.
*
* @param {String} id
*/
Entity.prototype._setId = function (id) {
var storage = this.storage();
if (this._options.persist) {
storage.set(this._options.cookie.key, id);
} else {
this._id = id;
}
};
/**
* Get or set the entity's `traits`.
*
* BACKWARDS COMPATIBILITY: aliased to `properties`
*
* @param {Object} traits
*/
Entity.prototype.properties =
Entity.prototype.traits = function (traits) {
switch (arguments.length) {
case 0: return this._getTraits();
case 1: return this._setTraits(traits);
}
};
/**
* Get the entity's traits. Always convert ISO date strings into real dates,
* since they aren't parsed back from local storage.
*
* @return {Object}
*/
Entity.prototype._getTraits = function () {
var ret = this._options.persist
? store.get(this._options.localStorage.key)
: this._traits;
return ret ? traverse(clone(ret)) : {};
};
/**
* Set the entity's `traits`.
*
* @param {Object} traits
*/
Entity.prototype._setTraits = function (traits) {
traits || (traits = {});
if (this._options.persist) {
store.set(this._options.localStorage.key, traits);
} else {
this._traits = traits;
}
};
/**
* Identify the entity with an `id` and `traits`. If we it's the same entity,
* extend the existing `traits` instead of overwriting.
*
* @param {String} id
* @param {Object} traits
*/
Entity.prototype.identify = function (id, traits) {
traits || (traits = {});
var current = this.id();
if (current === null || current === id) traits = extend(this.traits(), traits);
if (id) this.id(id);
this.debug('identify %o, %o', id, traits);
this.traits(traits);
this.save();
};
/**
* Save the entity to local storage and the cookie.
*
* @return {Boolean}
*/
Entity.prototype.save = function () {
if (!this._options.persist) return false;
cookie.set(this._options.cookie.key, this.id());
store.set(this._options.localStorage.key, this.traits());
return true;
};
/**
* Log the entity out, reseting `id` and `traits` to defaults.
*/
Entity.prototype.logout = function () {
this.id(null);
this.traits({});
cookie.remove(this._options.cookie.key);
store.remove(this._options.localStorage.key);
};
/**
* Reset all entity state, logging out and returning options to defaults.
*/
Entity.prototype.reset = function () {
this.logout();
this.options({});
};
/**
* Load saved entity `id` or `traits` from storage.
*/
Entity.prototype.load = function () {
this.id(cookie.get(this._options.cookie.key));
this.traits(store.get(this._options.localStorage.key));
};
}, {"isodate-traverse":134,"defaults":91,"./cookie":183,"./store":190,"extend":122,"clone":89}],
190: [function(require, module, exports) {
var bind = require('bind');
var defaults = require('defaults');
var store = require('store.js');
/**
* Initialize a new `Store` with `options`.
*
* @param {Object} options
*/
function Store (options) {
this.options(options);
}
/**
* Set the `options` for the store.
*
* @param {Object} options
* @field {Boolean} enabled (true)
*/
Store.prototype.options = function (options) {
if (arguments.length === 0) return this._options;
options = options || {};
defaults(options, { enabled : true });
this.enabled = options.enabled && store.enabled;
this._options = options;
};
/**
* Set a `key` and `value` in local storage.
*
* @param {String} key
* @param {Object} value
*/
Store.prototype.set = function (key, value) {
if (!this.enabled) return false;
return store.set(key, value);
};
/**
* Get a value from local storage by `key`.
*
* @param {String} key
* @return {Object}
*/
Store.prototype.get = function (key) {
if (!this.enabled) return null;
return store.get(key);
};
/**
* Remove a value from local storage by `key`.
*
* @param {String} key
*/
Store.prototype.remove = function (key) {
if (!this.enabled) return false;
return store.remove(key);
};
/**
* Expose the store singleton.
*/
module.exports = bind.all(new Store());
/**
* Expose the `Store` constructor.
*/
module.exports.Store = Store;
}, {"bind":182,"defaults":91,"store.js":199}],
199: [function(require, module, exports) {
var json = require('json')
, store = {}
, win = window
, doc = win.document
, localStorageName = 'localStorage'
, namespace = '__storejs__'
, storage;
store.disabled = false
store.set = function(key, value) {}
store.get = function(key) {}
store.remove = function(key) {}
store.clear = function() {}
store.transact = function(key, defaultVal, transactionFn) {
var val = store.get(key)
if (transactionFn == null) {
transactionFn = defaultVal
defaultVal = null
}
if (typeof val == 'undefined') { val = defaultVal || {} }
transactionFn(val)
store.set(key, val)
}
store.getAll = function() {}
store.serialize = function(value) {
return json.stringify(value)
}
store.deserialize = function(value) {
if (typeof value != 'string') { return undefined }
try { return json.parse(value) }
catch(e) { return value || undefined }
}
// Functions to encapsulate questionable FireFox 3.6.13 behavior
// when about.config::dom.storage.enabled === false
// See https://github.com/marcuswestin/store.js/issues#issue/13
function isLocalStorageNameSupported() {
try { return (localStorageName in win && win[localStorageName]) }
catch(err) { return false }
}
if (isLocalStorageNameSupported()) {
storage = win[localStorageName]
store.set = function(key, val) {
if (val === undefined) { return store.remove(key) }
storage.setItem(key, store.serialize(val))
return val
}
store.get = function(key) { return store.deserialize(storage.getItem(key)) }
store.remove = function(key) { storage.removeItem(key) }
store.clear = function() { storage.clear() }
store.getAll = function() {
var ret = {}
for (var i=0; i<storage.length; ++i) {
var key = storage.key(i)
ret[key] = store.get(key)
}
return ret
}
} else if (doc.documentElement.addBehavior) {
var storageOwner,
storageContainer
// Since #userData storage applies only to specific paths, we need to
// somehow link our data to a specific path. We choose /favicon.ico
// as a pretty safe option, since all browsers already make a request to
// this URL anyway and being a 404 will not hurt us here. We wrap an
// iframe pointing to the favicon in an ActiveXObject(htmlfile) object
// (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)
// since the iframe access rules appear to allow direct access and
// manipulation of the document element, even for a 404 page. This
// document can be used instead of the current document (which would
// have been limited to the current path) to perform #userData storage.
try {
storageContainer = new ActiveXObject('htmlfile')
storageContainer.open()
storageContainer.write('<s' + 'cript>document.w=window</s' + 'cript><iframe src="/favicon.ico"></iframe>')
storageContainer.close()
storageOwner = storageContainer.w.frames[0].document
storage = storageOwner.createElement('div')
} catch(e) {
// somehow ActiveXObject instantiation failed (perhaps some special
// security settings or otherwse), fall back to per-path storage
storage = doc.createElement('div')
storageOwner = doc.body
}
function withIEStorage(storeFunction) {
return function() {
var args = Array.prototype.slice.call(arguments, 0)
args.unshift(storage)
// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx
// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx
storageOwner.appendChild(storage)
storage.addBehavior('#default#userData')
storage.load(localStorageName)
var result = storeFunction.apply(store, args)
storageOwner.removeChild(storage)
return result
}
}
// In IE7, keys may not contain special chars. See all of https://github.com/marcuswestin/store.js/issues/40
var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g")
function ieKeyFix(key) {
return key.replace(forbiddenCharsRegex, '___')
}
store.set = withIEStorage(function(storage, key, val) {
key = ieKeyFix(key)
if (val === undefined) { return store.remove(key) }
storage.setAttribute(key, store.serialize(val))
storage.save(localStorageName)
return val
})
store.get = withIEStorage(function(storage, key) {
key = ieKeyFix(key)
return store.deserialize(storage.getAttribute(key))
})
store.remove = withIEStorage(function(storage, key) {
key = ieKeyFix(key)
storage.removeAttribute(key)
storage.save(localStorageName)
})
store.clear = withIEStorage(function(storage) {
var attributes = storage.XMLDocument.documentElement.attributes
storage.load(localStorageName)
for (var i=0, attr; attr=attributes[i]; i++) {
storage.removeAttribute(attr.name)
}
storage.save(localStorageName)
})
store.getAll = withIEStorage(function(storage) {
var attributes = storage.XMLDocument.documentElement.attributes
var ret = {}
for (var i=0, attr; attr=attributes[i]; ++i) {
var key = ieKeyFix(attr.name)
ret[attr.name] = store.deserialize(storage.getAttribute(key))
}
return ret
})
}
try {
store.set(namespace, namespace)
if (store.get(namespace) != namespace) { store.disabled = true }
store.remove(namespace)
} catch(e) {
store.disabled = true
}
store.enabled = !store.disabled
module.exports = store;
}, {"json":192}],
198: [function(require, module, exports) {
module.exports = function(a, b){
var fn = function(){};
fn.prototype = b.prototype;
a.prototype = new fn;
a.prototype.constructor = a;
};
}, {}],
186: [function(require, module, exports) {
module.exports = function isMeta (e) {
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return true;
// Logic that handles checks for the middle mouse button, based
// on [jQuery](https://github.com/jquery/jquery/blob/master/src/event.js#L466).
var which = e.which, button = e.button;
if (!which && button !== undefined) {
return (!button & 1) && (!button & 2) && (button & 4);
} else if (which === 2) {
return true;
}
return false;
};
}, {}],
187: [function(require, module, exports) {
/**
* Bind `el` event `type` to `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
exports.bind = function(el, type, fn, capture){
if (el.addEventListener) {
el.addEventListener(type, fn, capture || false);
} else {
el.attachEvent('on' + type, fn);
}
return fn;
};
/**
* Unbind `el` event `type`'s callback `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
exports.unbind = function(el, type, fn, capture){
if (el.removeEventListener) {
el.removeEventListener(type, fn, capture || false);
} else {
el.detachEvent('on' + type, fn);
}
return fn;
};
}, {}],
188: [function(require, module, exports) {
/**
* prevent default on the given `e`.
*
* examples:
*
* anchor.onclick = prevent;
* anchor.onclick = function(e){
* if (something) return prevent(e);
* };
*
* @param {Event} e
*/
module.exports = function(e){
e = e || window.event
return e.preventDefault
? e.preventDefault()
: e.returnValue = false;
};
}, {}],
189: [function(require, module, exports) {
/**
* Module dependencies.
*/
var encode = encodeURIComponent;
var decode = decodeURIComponent;
var trim = require('trim');
var type = require('type');
/**
* Parse the given query `str`.
*
* @param {String} str
* @return {Object}
* @api public
*/
exports.parse = function(str){
if ('string' != typeof str) return {};
str = trim(str);
if ('' == str) return {};
if ('?' == str.charAt(0)) str = str.slice(1);
var obj = {};
var pairs = str.split('&');
for (var i = 0; i < pairs.length; i++) {
var parts = pairs[i].split('=');
var key = decode(parts[0]);
var m;
if (m = /(\w+)\[(\d+)\]/.exec(key)) {
obj[m[1]] = obj[m[1]] || [];
obj[m[1]][m[2]] = decode(parts[1]);
continue;
}
obj[parts[0]] = null == parts[1]
? ''
: decode(parts[1]);
}
return obj;
};
/**
* Stringify the given `obj`.
*
* @param {Object} obj
* @return {String}
* @api public
*/
exports.stringify = function(obj){
if (!obj) return '';
var pairs = [];
for (var key in obj) {
var value = obj[key];
if ('array' == type(value)) {
for (var i = 0; i < value.length; ++i) {
pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
}
continue;
}
pairs.push(encode(key) + '=' + encode(obj[key]));
}
return pairs.join('&');
};
}, {"trim":163,"type":7}],
191: [function(require, module, exports) {
var debug = require('debug')('analytics:user');
var Entity = require('./entity');
var inherit = require('inherit');
var bind = require('bind');
var cookie = require('./cookie');
/**
* User defaults
*/
User.defaults = {
persist: true,
cookie: {
key: 'ajs_user_id',
oldKey: 'ajs_user'
},
localStorage: {
key: 'ajs_user_traits'
}
};
/**
* Initialize a new `User` with `options`.
*
* @param {Object} options
*/
function User (options) {
this.defaults = User.defaults;
this.debug = debug;
Entity.call(this, options);
}
/**
* Inherit `Entity`
*/
inherit(User, Entity);
/**
* Load saved user `id` or `traits` from storage.
*/
User.prototype.load = function () {
if (this._loadOldCookie()) return;
Entity.prototype.load.call(this);
};
/**
* BACKWARDS COMPATIBILITY: Load the old user from the cookie.
*
* @return {Boolean}
* @api private
*/
User.prototype._loadOldCookie = function () {
var user = cookie.get(this._options.cookie.oldKey);
if (!user) return false;
this.id(user.id);
this.traits(user.traits);
cookie.remove(this._options.cookie.oldKey);
return true;
};
/**
* Expose the user singleton.
*/
module.exports = bind.all(new User());
/**
* Expose the `User` constructor.
*/
module.exports.User = User;
}, {"debug":184,"./entity":197,"inherit":198,"bind":182,"./cookie":183}],
5: [function(require, module, exports) {
module.exports = '2.3.16';
}, {}]}, {}, {"1":"analytics"})
|
examples/cra-storybook/src/stories/index.js | enjoylife/storybook | import React from 'react';
import EventEmiter from 'eventemitter3';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';
import WithEvents from '@storybook/addon-events';
import Button from './Button';
import Welcome from './Welcome';
import App from '../App';
import Logger from './Logger';
const EVENTS = {
TEST_EVENT_1: 'test-event-1',
TEST_EVENT_2: 'test-event-2',
TEST_EVENT_3: 'test-event-3',
TEST_EVENT_4: 'test-event-4',
};
const emiter = new EventEmiter();
const emit = emiter.emit.bind(emiter);
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
storiesOf('Button', module)
.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)
.add('with some emoji', () => <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>);
storiesOf('App', module)
.add('with text', () => <App />)
.add('with some emoji', () => <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>);
storiesOf('WithEvents', module)
.addDecorator(getStory =>
<WithEvents
emit={emit}
events={[
{
name: EVENTS.TEST_EVENT_1,
title: 'Test event 1',
payload: 0,
},
{
name: EVENTS.TEST_EVENT_2,
title: 'Test event 2',
payload: 'Test event 2',
},
{
name: EVENTS.TEST_EVENT_3,
title: 'Test event 3',
payload: {
string: 'value',
number: 123,
array: [1, 2, 3],
object: {
string: 'value',
number: 123,
array: [1, 2, 3],
},
},
},
{
name: EVENTS.TEST_EVENT_4,
title: 'Test event 4',
payload: [
{
string: 'value',
number: 123,
array: [1, 2, 3],
},
{
string: 'value',
number: 123,
array: [1, 2, 3],
},
{
string: 'value',
number: 123,
array: [1, 2, 3],
},
],
},
]}
>
{getStory()}
</WithEvents>
)
.add('Logger', () => <Logger emiter={emiter} />);
|
src/js/components/common/forms/formcheckbox.js | michaelatmender/gui | import React from 'react';
import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel';
export default class FormCheckbox extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
checked: this.props.checked,
// the following is needed for the form validation to work if the field is not required
isValid: true, // lgtm [js/react/unused-or-undefined-state-property]
value: this.props.checked ? this.props.value : ''
};
}
componentDidMount() {
this.props.attachToForm(this); // Attaching the component to the form
if (this.props.value) {
this.props.validate(this, this.props.value);
}
if (this.props.setControlRef) {
this.props.setControlRef(this.input);
}
}
componentWillUnmount() {
this.props.detachFromForm(this); // Detaching if unmounting
}
updateCheck(checked) {
const value = checked ? this.props.value : '';
this.setState({ checked, value });
this.props.validate(this, value);
}
render() {
return (
<FormControlLabel
className={this.props.className}
control={
<Checkbox
id={this.props.id}
name={this.props.id}
ref={this.props.id}
onChange={(e, checked) => this.updateCheck(checked)}
onClick={this.props.handleClick}
style={this.props.style}
color="primary"
checked={this.state.checked}
/>
}
label={this.props.label}
/>
);
}
}
|
actor-apps/app-web/src/app/components/modals/invite-user/ContactItem.react.js | it33/actor-platform | import React from 'react';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
import classnames from 'classnames';
import AvatarItem from 'components/common/AvatarItem.react';
const {addons: { PureRenderMixin }} = addons;
@ReactMixin.decorate(PureRenderMixin)
class ContactItem extends React.Component {
static propTypes = {
contact: React.PropTypes.object,
onSelect: React.PropTypes.func,
member: React.PropTypes.bool
};
constructor(props) {
super(props);
}
onSelect = () => {
this.props.onSelect(this.props.contact);
};
render() {
const contact = this.props.contact;
const contactClassName = classnames('contacts__list__item row', {
'contacts__list__item--member': this.props.member
});
let controls;
if (!this.props.member) {
controls = <a className="material-icons" onClick={this.onSelect}>person_add</a>;
} else {
controls = <i className="material-icons">check</i>;
}
return (
<li className={contactClassName}>
<AvatarItem image={contact.avatar}
placeholder={contact.placeholder}
size="small"
title={contact.name}/>
<div className="col-xs">
<span className="title">
{contact.name}
</span>
</div>
<div className="controls">
{controls}
</div>
</li>
);
}
}
export default ContactItem;
|
src/components/Users/Users.js | caijinchun/hsweb-antd | import React from 'react';
import { connect } from 'dva';
import { Table, Pagination, Popconfirm, Button } from 'antd';
import { routerRedux } from 'dva/router';
import styles from './Users.css';
import { PAGE_SIZE } from '../../constants';
import UserModal from './UserModal';
function Users({ dispatch, list: dataSource, loading, total, page: current }) {
function deleteHandler(id) {
dispatch({
type: 'users/remove',
payload: id,
});
}
function pageChangeHandler(page) {
dispatch(routerRedux.push({
pathname: '/users',
query: { page },
}));
}
function editHandler(id, values) {
dispatch({
type: 'users/patch',
payload: { id, values },
});
}
function createHandler(values) {
dispatch({
type: 'users/create',
payload: values,
});
}
const columns = [
{
title: '用户名',
dataIndex: 'name',
key: 'name',
render: text => <a href="">{text}</a>,
},{
title: '姓名',
dataIndex: 'username',
key: 'username',
render: text => <a href="">{text}</a>,
},{
title: '操作',
key: 'operation',
render: (text, record) => (
<span className={styles.operation}>
<UserModal record={record} onOk={editHandler.bind(null, record.id)}>
<a>编辑</a>
</UserModal>
<Popconfirm title="Confirm to delete?" onConfirm={deleteHandler.bind(null, record.id)}>
<a href="">删除</a>
</Popconfirm>
</span>
),
},
];
return (
<div className={styles.normal}>
<div>
<div className={styles.create}>
<UserModal record={{}} onOk={createHandler}>
<Button type="primary">新增</Button>
</UserModal>
</div>
<Table
columns={columns}
dataSource={dataSource}
loading={loading}
rowKey={record => record.id}
pagination={false}
/>
<Pagination
className="ant-table-pagination"
total={total}
current={current}
pageSize={PAGE_SIZE}
onChange={pageChangeHandler}
/>
</div>
</div>
);
}
function mapStateToProps(state) {
const { list, total, page } = state.users;
return {
loading: state.loading.models.users,
list,
total,
page,
};
}
export default connect(mapStateToProps)(Users);
|
src/icons/font/LinkIcon.js | skystebnicki/chamel | import React from 'react';
import PropTypes from 'prop-types';
import FontIcon from '../../FontIcon';
import ThemeService from '../../styles/ChamelThemeService';
/**
* Link button
*
* @param props
* @param context
* @returns {ReactDOM}
* @constructor
*/
const LinkIcon = (props, context) => {
let theme =
context.chamelTheme && context.chamelTheme.fontIcon
? context.chamelTheme.fontIcon
: ThemeService.defaultTheme.fontIcon;
return (
<FontIcon {...props} className={theme.iconLink}>
{'insert_link'}
</FontIcon>
);
};
/**
* An alternate theme may be passed down by a provider
*/
LinkIcon.contextTypes = {
chamelTheme: PropTypes.object,
};
export default LinkIcon;
|
src/svg-icons/communication/chat.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationChat = (props) => (
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 9h12v2H6V9zm8 5H6v-2h8v2zm4-6H6V6h12v2z"/>
</SvgIcon>
);
CommunicationChat = pure(CommunicationChat);
CommunicationChat.displayName = 'CommunicationChat';
CommunicationChat.muiName = 'SvgIcon';
export default CommunicationChat;
|
app/javascript/mastodon/features/notifications/components/notification.js | nonoz/mastodon | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import StatusContainer from '../../../containers/status_container';
import AccountContainer from '../../../containers/account_container';
import { FormattedMessage } from 'react-intl';
import Permalink from '../../../components/permalink';
import emojify from '../../../emoji';
import escapeTextContentForBrowser from 'escape-html';
import ImmutablePureComponent from 'react-immutable-pure-component';
export default class Notification extends ImmutablePureComponent {
static propTypes = {
notification: ImmutablePropTypes.map.isRequired,
};
renderFollow (account, link) {
return (
<div className='notification notification-follow'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-user-plus' />
</div>
<FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} />
</div>
<AccountContainer id={account.get('id')} withNote={false} />
</div>
);
}
renderMention (notification) {
return <StatusContainer id={notification.get('status')} withDismiss />;
}
renderFavourite (notification, link) {
return (
<div className='notification notification-favourite'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-star star-icon' />
</div>
<FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} />
</div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss />
</div>
);
}
renderReblog (notification, link) {
return (
<div className='notification notification-reblog'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-retweet' />
</div>
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
</div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss />
</div>
);
}
render () {
const { notification } = this.props;
const account = notification.get('account');
const displayName = account.get('display_name').length > 0 ? account.get('display_name') : account.get('username');
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
const link = <Permalink className='notification__display-name' href={account.get('url')} title={account.get('acct')} to={`/accounts/${account.get('id')}`} dangerouslySetInnerHTML={displayNameHTML} />;
switch(notification.get('type')) {
case 'follow':
return this.renderFollow(account, link);
case 'mention':
return this.renderMention(notification);
case 'favourite':
return this.renderFavourite(notification, link);
case 'reblog':
return this.renderReblog(notification, link);
}
return null;
}
}
|
app/containers/NotFoundPage/index.js | brobey8/toomanynotes | /**
* NotFoundPage
*
* This is the page we show when the user visits a url that doesn't have a route
*/
import React from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import Button from 'components/Button';
import H1 from 'components/H1';
export function NotFound(props) {
return (
<article>
<H1>Page not found.</H1>
<Button
handleRoute={function redirect() {
props.changeRoute('/');
}}
>
Home
</Button>
</article>
);
}
NotFound.propTypes = {
changeRoute: React.PropTypes.func,
};
// react-redux stuff
function mapDispatchToProps(dispatch) {
return {
changeRoute: (url) => dispatch(push(url)),
};
}
// Wrap the component to inject dispatch and state into it
export default connect(null, mapDispatchToProps)(NotFound);
|
ajax/libs/yui/3.14.0/event-custom-base/event-custom-base-coverage.js | extend1994/cdnjs | if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
if (!__coverage__['build/event-custom-base/event-custom-base.js']) {
__coverage__['build/event-custom-base/event-custom-base.js'] = {"path":"build/event-custom-base/event-custom-base.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0,"238":0,"239":0,"240":0,"241":0,"242":0,"243":0,"244":0,"245":0,"246":0,"247":0,"248":0,"249":0,"250":0,"251":0,"252":0,"253":0,"254":0,"255":0,"256":0,"257":0,"258":0,"259":0,"260":0,"261":0,"262":0,"263":0,"264":0,"265":0,"266":0,"267":0,"268":0,"269":0,"270":0,"271":0,"272":0,"273":0,"274":0,"275":0,"276":0,"277":0,"278":0,"279":0,"280":0,"281":0,"282":0,"283":0,"284":0,"285":0,"286":0,"287":0,"288":0,"289":0,"290":0,"291":0,"292":0,"293":0,"294":0,"295":0,"296":0,"297":0,"298":0,"299":0,"300":0,"301":0,"302":0,"303":0,"304":0,"305":0,"306":0,"307":0,"308":0,"309":0,"310":0,"311":0,"312":0,"313":0,"314":0,"315":0,"316":0,"317":0,"318":0,"319":0,"320":0,"321":0,"322":0,"323":0,"324":0,"325":0,"326":0,"327":0,"328":0,"329":0,"330":0,"331":0,"332":0,"333":0,"334":0,"335":0,"336":0,"337":0,"338":0,"339":0,"340":0,"341":0,"342":0,"343":0,"344":0,"345":0,"346":0,"347":0,"348":0,"349":0,"350":0,"351":0,"352":0,"353":0,"354":0,"355":0,"356":0,"357":0,"358":0,"359":0,"360":0,"361":0,"362":0,"363":0,"364":0,"365":0,"366":0,"367":0,"368":0,"369":0,"370":0,"371":0,"372":0,"373":0,"374":0,"375":0,"376":0,"377":0,"378":0,"379":0,"380":0,"381":0,"382":0,"383":0,"384":0,"385":0,"386":0,"387":0,"388":0,"389":0,"390":0,"391":0,"392":0,"393":0,"394":0,"395":0,"396":0,"397":0,"398":0,"399":0,"400":0,"401":0,"402":0,"403":0,"404":0,"405":0,"406":0,"407":0,"408":0,"409":0,"410":0,"411":0,"412":0,"413":0,"414":0,"415":0,"416":0,"417":0,"418":0,"419":0,"420":0,"421":0,"422":0,"423":0,"424":0,"425":0,"426":0,"427":0,"428":0,"429":0,"430":0,"431":0,"432":0,"433":0,"434":0,"435":0,"436":0,"437":0,"438":0,"439":0,"440":0,"441":0,"442":0,"443":0,"444":0,"445":0,"446":0,"447":0,"448":0,"449":0,"450":0,"451":0,"452":0,"453":0,"454":0,"455":0,"456":0,"457":0,"458":0,"459":0,"460":0,"461":0,"462":0,"463":0,"464":0,"465":0,"466":0,"467":0,"468":0,"469":0,"470":0,"471":0,"472":0,"473":0,"474":0,"475":0,"476":0,"477":0,"478":0,"479":0,"480":0,"481":0,"482":0,"483":0,"484":0,"485":0,"486":0,"487":0,"488":0,"489":0,"490":0,"491":0,"492":0,"493":0,"494":0,"495":0,"496":0,"497":0,"498":0,"499":0,"500":0,"501":0,"502":0,"503":0,"504":0,"505":0,"506":0,"507":0,"508":0,"509":0,"510":0,"511":0,"512":0,"513":0,"514":0,"515":0,"516":0,"517":0,"518":0,"519":0,"520":0,"521":0,"522":0,"523":0,"524":0,"525":0,"526":0,"527":0,"528":0,"529":0,"530":0,"531":0,"532":0,"533":0,"534":0,"535":0,"536":0,"537":0,"538":0,"539":0,"540":0,"541":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0,0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0,0],"54":[0,0],"55":[0,0],"56":[0,0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0],"77":[0,0],"78":[0,0],"79":[0,0],"80":[0,0],"81":[0,0],"82":[0,0],"83":[0,0],"84":[0,0],"85":[0,0],"86":[0,0],"87":[0,0],"88":[0,0,0],"89":[0,0],"90":[0,0],"91":[0,0],"92":[0,0],"93":[0,0],"94":[0,0],"95":[0,0],"96":[0,0],"97":[0,0],"98":[0,0],"99":[0,0],"100":[0,0],"101":[0,0],"102":[0,0],"103":[0,0],"104":[0,0],"105":[0,0],"106":[0,0],"107":[0,0,0],"108":[0,0],"109":[0,0],"110":[0,0],"111":[0,0],"112":[0,0],"113":[0,0],"114":[0,0],"115":[0,0],"116":[0,0],"117":[0,0],"118":[0,0],"119":[0,0],"120":[0,0],"121":[0,0],"122":[0,0],"123":[0,0],"124":[0,0],"125":[0,0],"126":[0,0],"127":[0,0],"128":[0,0],"129":[0,0],"130":[0,0],"131":[0,0,0],"132":[0,0],"133":[0,0],"134":[0,0],"135":[0,0],"136":[0,0],"137":[0,0],"138":[0,0],"139":[0,0],"140":[0,0],"141":[0,0],"142":[0,0],"143":[0,0],"144":[0,0],"145":[0,0],"146":[0,0],"147":[0,0],"148":[0,0],"149":[0,0],"150":[0,0],"151":[0,0],"152":[0,0],"153":[0,0],"154":[0,0],"155":[0,0],"156":[0,0],"157":[0,0],"158":[0,0],"159":[0,0],"160":[0,0],"161":[0,0],"162":[0,0],"163":[0,0],"164":[0,0],"165":[0,0],"166":[0,0],"167":[0,0,0],"168":[0,0],"169":[0,0],"170":[0,0],"171":[0,0],"172":[0,0,0,0],"173":[0,0],"174":[0,0],"175":[0,0],"176":[0,0],"177":[0,0],"178":[0,0],"179":[0,0],"180":[0,0,0,0],"181":[0,0],"182":[0,0],"183":[0,0],"184":[0,0],"185":[0,0],"186":[0,0],"187":[0,0,0,0,0],"188":[0,0],"189":[0,0],"190":[0,0],"191":[0,0],"192":[0,0],"193":[0,0],"194":[0,0],"195":[0,0],"196":[0,0],"197":[0,0],"198":[0,0],"199":[0,0],"200":[0,0,0,0,0],"201":[0,0],"202":[0,0],"203":[0,0],"204":[0,0],"205":[0,0],"206":[0,0],"207":[0,0],"208":[0,0],"209":[0,0],"210":[0,0],"211":[0,0,0,0],"212":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":48}}},"2":{"name":"(anonymous_2)","line":75,"loc":{"start":{"line":75,"column":12},"end":{"line":75,"column":38}}},"3":{"name":"(anonymous_3)","line":112,"loc":{"start":{"line":112,"column":11},"end":{"line":112,"column":37}}},"4":{"name":"(anonymous_4)","line":136,"loc":{"start":{"line":136,"column":13},"end":{"line":136,"column":42}}},"5":{"name":"(anonymous_5)","line":152,"loc":{"start":{"line":152,"column":23},"end":{"line":152,"column":34}}},"6":{"name":"(anonymous_6)","line":173,"loc":{"start":{"line":173,"column":12},"end":{"line":173,"column":29}}},"7":{"name":"(anonymous_7)","line":212,"loc":{"start":{"line":212,"column":12},"end":{"line":212,"column":31}}},"8":{"name":"(anonymous_8)","line":227,"loc":{"start":{"line":227,"column":31},"end":{"line":227,"column":56}}},"9":{"name":"(anonymous_9)","line":242,"loc":{"start":{"line":242,"column":30},"end":{"line":242,"column":45}}},"10":{"name":"(anonymous_10)","line":261,"loc":{"start":{"line":261,"column":27},"end":{"line":261,"column":39}}},"11":{"name":"(anonymous_11)","line":329,"loc":{"start":{"line":329,"column":15},"end":{"line":329,"column":38}}},"12":{"name":"(anonymous_12)","line":343,"loc":{"start":{"line":343,"column":17},"end":{"line":343,"column":42}}},"13":{"name":"(anonymous_13)","line":358,"loc":{"start":{"line":358,"column":10},"end":{"line":358,"column":32}}},"14":{"name":"(anonymous_14)","line":371,"loc":{"start":{"line":371,"column":13},"end":{"line":371,"column":27}}},"15":{"name":"(anonymous_15)","line":432,"loc":{"start":{"line":432,"column":17},"end":{"line":432,"column":36}}},"16":{"name":"(anonymous_16)","line":468,"loc":{"start":{"line":468,"column":16},"end":{"line":468,"column":41}}},"17":{"name":"(anonymous_17)","line":701,"loc":{"start":{"line":701,"column":13},"end":{"line":701,"column":28}}},"18":{"name":"(anonymous_18)","line":744,"loc":{"start":{"line":744,"column":13},"end":{"line":744,"column":28}}},"19":{"name":"(anonymous_19)","line":757,"loc":{"start":{"line":757,"column":13},"end":{"line":757,"column":24}}},"20":{"name":"(anonymous_20)","line":808,"loc":{"start":{"line":808,"column":17},"end":{"line":808,"column":36}}},"21":{"name":"(anonymous_21)","line":825,"loc":{"start":{"line":825,"column":9},"end":{"line":825,"column":43}}},"22":{"name":"(anonymous_22)","line":879,"loc":{"start":{"line":879,"column":15},"end":{"line":879,"column":37}}},"23":{"name":"(anonymous_23)","line":893,"loc":{"start":{"line":893,"column":8},"end":{"line":893,"column":30}}},"24":{"name":"(anonymous_24)","line":915,"loc":{"start":{"line":915,"column":11},"end":{"line":915,"column":33}}},"25":{"name":"(anonymous_25)","line":928,"loc":{"start":{"line":928,"column":12},"end":{"line":928,"column":34}}},"26":{"name":"(anonymous_26)","line":971,"loc":{"start":{"line":971,"column":17},"end":{"line":971,"column":28}}},"27":{"name":"(anonymous_27)","line":982,"loc":{"start":{"line":982,"column":13},"end":{"line":982,"column":35}}},"28":{"name":"(anonymous_28)","line":1002,"loc":{"start":{"line":1002,"column":9},"end":{"line":1002,"column":28}}},"29":{"name":"(anonymous_29)","line":1022,"loc":{"start":{"line":1022,"column":10},"end":{"line":1022,"column":21}}},"30":{"name":"(anonymous_30)","line":1044,"loc":{"start":{"line":1044,"column":11},"end":{"line":1044,"column":26}}},"31":{"name":"(anonymous_31)","line":1075,"loc":{"start":{"line":1075,"column":16},"end":{"line":1075,"column":31}}},"32":{"name":"(anonymous_32)","line":1090,"loc":{"start":{"line":1090,"column":17},"end":{"line":1090,"column":32}}},"33":{"name":"(anonymous_33)","line":1107,"loc":{"start":{"line":1107,"column":15},"end":{"line":1107,"column":40}}},"34":{"name":"(anonymous_34)","line":1133,"loc":{"start":{"line":1133,"column":16},"end":{"line":1133,"column":31}}},"35":{"name":"(anonymous_35)","line":1155,"loc":{"start":{"line":1155,"column":20},"end":{"line":1155,"column":31}}},"36":{"name":"(anonymous_36)","line":1164,"loc":{"start":{"line":1164,"column":15},"end":{"line":1164,"column":26}}},"37":{"name":"(anonymous_37)","line":1178,"loc":{"start":{"line":1178,"column":13},"end":{"line":1178,"column":34}}},"38":{"name":"(anonymous_38)","line":1222,"loc":{"start":{"line":1222,"column":15},"end":{"line":1222,"column":49}}},"39":{"name":"(anonymous_39)","line":1273,"loc":{"start":{"line":1273,"column":13},"end":{"line":1273,"column":35}}},"40":{"name":"(anonymous_40)","line":1314,"loc":{"start":{"line":1314,"column":12},"end":{"line":1314,"column":31}}},"41":{"name":"(anonymous_41)","line":1346,"loc":{"start":{"line":1346,"column":14},"end":{"line":1346,"column":36}}},"42":{"name":"(anonymous_42)","line":1354,"loc":{"start":{"line":1354,"column":14},"end":{"line":1354,"column":25}}},"43":{"name":"(anonymous_43)","line":1366,"loc":{"start":{"line":1366,"column":16},"end":{"line":1366,"column":35}}},"44":{"name":"(anonymous_44)","line":1386,"loc":{"start":{"line":1386,"column":11},"end":{"line":1386,"column":26}}},"45":{"name":"(anonymous_45)","line":1389,"loc":{"start":{"line":1389,"column":35},"end":{"line":1389,"column":47}}},"46":{"name":"(anonymous_46)","line":1400,"loc":{"start":{"line":1400,"column":12},"end":{"line":1400,"column":23}}},"47":{"name":"(anonymous_47)","line":1425,"loc":{"start":{"line":1425,"column":13},"end":{"line":1425,"column":28}}},"48":{"name":"(anonymous_48)","line":1460,"loc":{"start":{"line":1460,"column":25},"end":{"line":1460,"column":40}}},"49":{"name":"(anonymous_49)","line":1471,"loc":{"start":{"line":1471,"column":15},"end":{"line":1471,"column":35}}},"50":{"name":"(anonymous_50)","line":1487,"loc":{"start":{"line":1487,"column":26},"end":{"line":1487,"column":46}}},"51":{"name":"(anonymous_51)","line":1516,"loc":{"start":{"line":1516,"column":9},"end":{"line":1516,"column":24}}},"52":{"name":"(anonymous_52)","line":1564,"loc":{"start":{"line":1564,"column":10},"end":{"line":1564,"column":21}}},"53":{"name":"(anonymous_53)","line":1566,"loc":{"start":{"line":1566,"column":21},"end":{"line":1566,"column":36}}},"54":{"name":"(anonymous_54)","line":1586,"loc":{"start":{"line":1586,"column":15},"end":{"line":1586,"column":26}}},"55":{"name":"(anonymous_55)","line":1588,"loc":{"start":{"line":1588,"column":21},"end":{"line":1588,"column":36}}},"56":{"name":"(anonymous_56)","line":1612,"loc":{"start":{"line":1612,"column":15},"end":{"line":1612,"column":35}}},"57":{"name":"(anonymous_57)","line":1645,"loc":{"start":{"line":1645,"column":8},"end":{"line":1645,"column":36}}},"58":{"name":"(anonymous_58)","line":1677,"loc":{"start":{"line":1677,"column":25},"end":{"line":1677,"column":40}}},"59":{"name":"(anonymous_59)","line":1767,"loc":{"start":{"line":1767,"column":15},"end":{"line":1767,"column":26}}},"60":{"name":"(anonymous_60)","line":1787,"loc":{"start":{"line":1787,"column":12},"end":{"line":1787,"column":40}}},"61":{"name":"(anonymous_61)","line":1814,"loc":{"start":{"line":1814,"column":22},"end":{"line":1814,"column":50}}},"62":{"name":"(anonymous_62)","line":1889,"loc":{"start":{"line":1889,"column":17},"end":{"line":1889,"column":28}}},"63":{"name":"(anonymous_63)","line":1900,"loc":{"start":{"line":1900,"column":15},"end":{"line":1900,"column":30}}},"64":{"name":"(anonymous_64)","line":1912,"loc":{"start":{"line":1912,"column":20},"end":{"line":1912,"column":31}}},"65":{"name":"(anonymous_65)","line":1982,"loc":{"start":{"line":1982,"column":13},"end":{"line":1982,"column":34}}},"66":{"name":"(anonymous_66)","line":1997,"loc":{"start":{"line":1997,"column":25},"end":{"line":1997,"column":40}}},"67":{"name":"(anonymous_67)","line":2022,"loc":{"start":{"line":2022,"column":19},"end":{"line":2022,"column":34}}},"68":{"name":"(anonymous_68)","line":2046,"loc":{"start":{"line":2046,"column":15},"end":{"line":2046,"column":50}}},"69":{"name":"(anonymous_69)","line":2098,"loc":{"start":{"line":2098,"column":14},"end":{"line":2098,"column":43}}},"70":{"name":"(anonymous_70)","line":2146,"loc":{"start":{"line":2146,"column":10},"end":{"line":2146,"column":25}}},"71":{"name":"(anonymous_71)","line":2221,"loc":{"start":{"line":2221,"column":16},"end":{"line":2221,"column":35}}},"72":{"name":"(anonymous_72)","line":2246,"loc":{"start":{"line":2246,"column":14},"end":{"line":2246,"column":39}}},"73":{"name":"(anonymous_73)","line":2271,"loc":{"start":{"line":2271,"column":11},"end":{"line":2271,"column":30}}},"74":{"name":"(anonymous_74)","line":2309,"loc":{"start":{"line":2309,"column":12},"end":{"line":2309,"column":23}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":2460,"column":39}},"2":{"start":{"line":9,"column":0},"end":{"line":12,"column":2}},"3":{"start":{"line":29,"column":0},"end":{"line":178,"column":2}},"4":{"start":{"line":76,"column":8},"end":{"line":76,"column":22}},"5":{"start":{"line":77,"column":8},"end":{"line":80,"column":9}},"6":{"start":{"line":78,"column":12},"end":{"line":78,"column":60}},"7":{"start":{"line":79,"column":12},"end":{"line":79,"column":36}},"8":{"start":{"line":82,"column":8},"end":{"line":82,"column":52}},"9":{"start":{"line":113,"column":8},"end":{"line":113,"column":22}},"10":{"start":{"line":114,"column":8},"end":{"line":117,"column":9}},"11":{"start":{"line":115,"column":12},"end":{"line":115,"column":60}},"12":{"start":{"line":116,"column":12},"end":{"line":116,"column":36}},"13":{"start":{"line":119,"column":8},"end":{"line":119,"column":51}},"14":{"start":{"line":138,"column":8},"end":{"line":138,"column":38}},"15":{"start":{"line":140,"column":8},"end":{"line":143,"column":9}},"16":{"start":{"line":142,"column":12},"end":{"line":142,"column":29}},"17":{"start":{"line":145,"column":8},"end":{"line":145,"column":24}},"18":{"start":{"line":147,"column":8},"end":{"line":155,"column":9}},"19":{"start":{"line":149,"column":12},"end":{"line":149,"column":47}},"20":{"start":{"line":152,"column":12},"end":{"line":154,"column":14}},"21":{"start":{"line":153,"column":16},"end":{"line":153,"column":60}},"22":{"start":{"line":158,"column":8},"end":{"line":158,"column":37}},"23":{"start":{"line":161,"column":8},"end":{"line":161,"column":39}},"24":{"start":{"line":163,"column":8},"end":{"line":163,"column":46}},"25":{"start":{"line":174,"column":8},"end":{"line":176,"column":9}},"26":{"start":{"line":175,"column":12},"end":{"line":175,"column":28}},"27":{"start":{"line":180,"column":0},"end":{"line":180,"column":10}},"28":{"start":{"line":212,"column":0},"end":{"line":218,"column":2}},"29":{"start":{"line":213,"column":4},"end":{"line":213,"column":19}},"30":{"start":{"line":214,"column":4},"end":{"line":214,"column":26}},"31":{"start":{"line":215,"column":4},"end":{"line":215,"column":27}},"32":{"start":{"line":216,"column":4},"end":{"line":216,"column":21}},"33":{"start":{"line":217,"column":4},"end":{"line":217,"column":20}},"34":{"start":{"line":227,"column":0},"end":{"line":233,"column":2}},"35":{"start":{"line":228,"column":4},"end":{"line":232,"column":5}},"36":{"start":{"line":229,"column":8},"end":{"line":229,"column":29}},"37":{"start":{"line":231,"column":8},"end":{"line":231,"column":30}},"38":{"start":{"line":242,"column":0},"end":{"line":245,"column":2}},"39":{"start":{"line":243,"column":4},"end":{"line":243,"column":28}},"40":{"start":{"line":244,"column":4},"end":{"line":244,"column":27}},"41":{"start":{"line":261,"column":0},"end":{"line":314,"column":2}},"42":{"start":{"line":263,"column":4},"end":{"line":267,"column":26}},"43":{"start":{"line":270,"column":4},"end":{"line":287,"column":5}},"44":{"start":{"line":271,"column":8},"end":{"line":286,"column":9}},"45":{"start":{"line":272,"column":12},"end":{"line":272,"column":46}},"46":{"start":{"line":273,"column":12},"end":{"line":285,"column":13}},"47":{"start":{"line":274,"column":16},"end":{"line":284,"column":17}},"48":{"start":{"line":276,"column":24},"end":{"line":276,"column":42}},"49":{"start":{"line":278,"column":24},"end":{"line":278,"column":43}},"50":{"start":{"line":279,"column":24},"end":{"line":279,"column":30}},"51":{"start":{"line":281,"column":24},"end":{"line":281,"column":41}},"52":{"start":{"line":282,"column":24},"end":{"line":282,"column":30}},"53":{"start":{"line":290,"column":4},"end":{"line":292,"column":5}},"54":{"start":{"line":291,"column":8},"end":{"line":291,"column":48}},"55":{"start":{"line":294,"column":4},"end":{"line":294,"column":28}},"56":{"start":{"line":295,"column":4},"end":{"line":295,"column":27}},"57":{"start":{"line":298,"column":4},"end":{"line":311,"column":5}},"58":{"start":{"line":299,"column":8},"end":{"line":310,"column":9}},"59":{"start":{"line":300,"column":12},"end":{"line":300,"column":49}},"60":{"start":{"line":302,"column":12},"end":{"line":309,"column":13}},"61":{"start":{"line":303,"column":16},"end":{"line":303,"column":37}},"62":{"start":{"line":305,"column":19},"end":{"line":309,"column":13}},"63":{"start":{"line":306,"column":16},"end":{"line":306,"column":39}},"64":{"start":{"line":308,"column":16},"end":{"line":308,"column":39}},"65":{"start":{"line":313,"column":4},"end":{"line":313,"column":15}},"66":{"start":{"line":329,"column":0},"end":{"line":332,"column":2}},"67":{"start":{"line":330,"column":4},"end":{"line":330,"column":19}},"68":{"start":{"line":331,"column":4},"end":{"line":331,"column":27}},"69":{"start":{"line":343,"column":0},"end":{"line":346,"column":2}},"70":{"start":{"line":344,"column":4},"end":{"line":344,"column":19}},"71":{"start":{"line":345,"column":4},"end":{"line":345,"column":31}},"72":{"start":{"line":358,"column":0},"end":{"line":361,"column":2}},"73":{"start":{"line":359,"column":4},"end":{"line":359,"column":19}},"74":{"start":{"line":360,"column":4},"end":{"line":360,"column":25}},"75":{"start":{"line":371,"column":0},"end":{"line":373,"column":2}},"76":{"start":{"line":372,"column":4},"end":{"line":372,"column":19}},"77":{"start":{"line":385,"column":0},"end":{"line":385,"column":19}},"78":{"start":{"line":399,"column":0},"end":{"line":442,"column":6}},"79":{"start":{"line":433,"column":8},"end":{"line":433,"column":14}},"80":{"start":{"line":435,"column":8},"end":{"line":439,"column":9}},"81":{"start":{"line":436,"column":12},"end":{"line":438,"column":13}},"82":{"start":{"line":437,"column":16},"end":{"line":437,"column":28}},"83":{"start":{"line":441,"column":8},"end":{"line":441,"column":17}},"84":{"start":{"line":468,"column":0},"end":{"line":498,"column":2}},"85":{"start":{"line":470,"column":4},"end":{"line":470,"column":49}},"86":{"start":{"line":472,"column":4},"end":{"line":472,"column":23}},"87":{"start":{"line":474,"column":4},"end":{"line":474,"column":21}},"88":{"start":{"line":475,"column":4},"end":{"line":475,"column":54}},"89":{"start":{"line":477,"column":4},"end":{"line":493,"column":5}},"90":{"start":{"line":491,"column":8},"end":{"line":491,"column":30}},"91":{"start":{"line":492,"column":8},"end":{"line":492,"column":25}},"92":{"start":{"line":495,"column":4},"end":{"line":497,"column":5}},"93":{"start":{"line":496,"column":8},"end":{"line":496,"column":41}},"94":{"start":{"line":523,"column":0},"end":{"line":523,"column":41}},"95":{"start":{"line":525,"column":0},"end":{"line":525,"column":38}},"96":{"start":{"line":527,"column":0},"end":{"line":1212,"column":2}},"97":{"start":{"line":702,"column":8},"end":{"line":706,"column":31}},"98":{"start":{"line":708,"column":8},"end":{"line":710,"column":9}},"99":{"start":{"line":709,"column":12},"end":{"line":709,"column":28}},"100":{"start":{"line":712,"column":8},"end":{"line":714,"column":9}},"101":{"start":{"line":713,"column":12},"end":{"line":713,"column":30}},"102":{"start":{"line":716,"column":8},"end":{"line":727,"column":9}},"103":{"start":{"line":717,"column":12},"end":{"line":717,"column":36}},"104":{"start":{"line":718,"column":12},"end":{"line":718,"column":33}},"105":{"start":{"line":720,"column":12},"end":{"line":722,"column":13}},"106":{"start":{"line":721,"column":16},"end":{"line":721,"column":33}},"107":{"start":{"line":724,"column":12},"end":{"line":726,"column":13}},"108":{"start":{"line":725,"column":16},"end":{"line":725,"column":35}},"109":{"start":{"line":729,"column":8},"end":{"line":731,"column":9}},"110":{"start":{"line":730,"column":12},"end":{"line":730,"column":46}},"111":{"start":{"line":733,"column":8},"end":{"line":733,"column":23}},"112":{"start":{"line":745,"column":8},"end":{"line":745,"column":30}},"113":{"start":{"line":746,"column":8},"end":{"line":747,"column":50}},"114":{"start":{"line":748,"column":8},"end":{"line":748,"column":23}},"115":{"start":{"line":749,"column":8},"end":{"line":749,"column":51}},"116":{"start":{"line":759,"column":8},"end":{"line":763,"column":26}},"117":{"start":{"line":765,"column":8},"end":{"line":768,"column":9}},"118":{"start":{"line":766,"column":12},"end":{"line":766,"column":47}},"119":{"start":{"line":767,"column":12},"end":{"line":767,"column":44}},"120":{"start":{"line":770,"column":8},"end":{"line":782,"column":9}},"121":{"start":{"line":771,"column":12},"end":{"line":775,"column":13}},"122":{"start":{"line":772,"column":16},"end":{"line":772,"column":48}},"123":{"start":{"line":774,"column":16},"end":{"line":774,"column":44}},"124":{"start":{"line":777,"column":12},"end":{"line":781,"column":13}},"125":{"start":{"line":778,"column":16},"end":{"line":778,"column":37}},"126":{"start":{"line":780,"column":16},"end":{"line":780,"column":26}},"127":{"start":{"line":784,"column":8},"end":{"line":796,"column":9}},"128":{"start":{"line":785,"column":12},"end":{"line":789,"column":13}},"129":{"start":{"line":786,"column":16},"end":{"line":786,"column":54}},"130":{"start":{"line":788,"column":16},"end":{"line":788,"column":48}},"131":{"start":{"line":791,"column":12},"end":{"line":795,"column":13}},"132":{"start":{"line":792,"column":16},"end":{"line":792,"column":41}},"133":{"start":{"line":794,"column":16},"end":{"line":794,"column":28}},"134":{"start":{"line":798,"column":8},"end":{"line":798,"column":30}},"135":{"start":{"line":809,"column":8},"end":{"line":809,"column":35}},"136":{"start":{"line":828,"column":8},"end":{"line":829,"column":22}},"137":{"start":{"line":831,"column":8},"end":{"line":847,"column":9}},"138":{"start":{"line":833,"column":12},"end":{"line":833,"column":39}},"139":{"start":{"line":838,"column":12},"end":{"line":840,"column":13}},"140":{"start":{"line":839,"column":16},"end":{"line":839,"column":49}},"141":{"start":{"line":842,"column":12},"end":{"line":846,"column":13}},"142":{"start":{"line":843,"column":16},"end":{"line":843,"column":72}},"143":{"start":{"line":845,"column":16},"end":{"line":845,"column":43}},"144":{"start":{"line":849,"column":8},"end":{"line":859,"column":9}},"145":{"start":{"line":850,"column":12},"end":{"line":852,"column":13}},"146":{"start":{"line":851,"column":16},"end":{"line":851,"column":34}},"147":{"start":{"line":853,"column":12},"end":{"line":853,"column":33}},"148":{"start":{"line":855,"column":12},"end":{"line":857,"column":13}},"149":{"start":{"line":856,"column":16},"end":{"line":856,"column":39}},"150":{"start":{"line":858,"column":12},"end":{"line":858,"column":38}},"151":{"start":{"line":861,"column":8},"end":{"line":867,"column":9}},"152":{"start":{"line":862,"column":12},"end":{"line":866,"column":13}},"153":{"start":{"line":863,"column":16},"end":{"line":863,"column":38}},"154":{"start":{"line":865,"column":16},"end":{"line":865,"column":43}},"155":{"start":{"line":869,"column":8},"end":{"line":869,"column":42}},"156":{"start":{"line":880,"column":8},"end":{"line":880,"column":79}},"157":{"start":{"line":881,"column":8},"end":{"line":881,"column":46}},"158":{"start":{"line":894,"column":8},"end":{"line":894,"column":79}},"159":{"start":{"line":896,"column":8},"end":{"line":900,"column":9}},"160":{"start":{"line":897,"column":12},"end":{"line":899,"column":15}},"161":{"start":{"line":901,"column":8},"end":{"line":901,"column":46}},"162":{"start":{"line":916,"column":8},"end":{"line":916,"column":79}},"163":{"start":{"line":917,"column":8},"end":{"line":917,"column":47}},"164":{"start":{"line":930,"column":8},"end":{"line":932,"column":9}},"165":{"start":{"line":931,"column":12},"end":{"line":931,"column":31}},"166":{"start":{"line":934,"column":8},"end":{"line":937,"column":34}},"167":{"start":{"line":939,"column":8},"end":{"line":947,"column":9}},"168":{"start":{"line":940,"column":12},"end":{"line":946,"column":13}},"169":{"start":{"line":941,"column":16},"end":{"line":941,"column":28}},"170":{"start":{"line":942,"column":16},"end":{"line":945,"column":17}},"171":{"start":{"line":943,"column":20},"end":{"line":943,"column":45}},"172":{"start":{"line":944,"column":20},"end":{"line":944,"column":28}},"173":{"start":{"line":949,"column":8},"end":{"line":957,"column":9}},"174":{"start":{"line":950,"column":12},"end":{"line":956,"column":13}},"175":{"start":{"line":951,"column":16},"end":{"line":951,"column":30}},"176":{"start":{"line":952,"column":16},"end":{"line":955,"column":17}},"177":{"start":{"line":953,"column":20},"end":{"line":953,"column":47}},"178":{"start":{"line":954,"column":20},"end":{"line":954,"column":28}},"179":{"start":{"line":959,"column":8},"end":{"line":959,"column":21}},"180":{"start":{"line":972,"column":8},"end":{"line":972,"column":50}},"181":{"start":{"line":985,"column":8},"end":{"line":985,"column":16}},"182":{"start":{"line":987,"column":8},"end":{"line":987,"column":35}},"183":{"start":{"line":989,"column":8},"end":{"line":991,"column":9}},"184":{"start":{"line":990,"column":12},"end":{"line":990,"column":25}},"185":{"start":{"line":993,"column":8},"end":{"line":993,"column":20}},"186":{"start":{"line":1028,"column":8},"end":{"line":1028,"column":22}},"187":{"start":{"line":1029,"column":8},"end":{"line":1029,"column":41}},"188":{"start":{"line":1031,"column":8},"end":{"line":1031,"column":32}},"189":{"start":{"line":1046,"column":8},"end":{"line":1064,"column":9}},"190":{"start":{"line":1047,"column":12},"end":{"line":1047,"column":24}},"191":{"start":{"line":1053,"column":12},"end":{"line":1053,"column":30}},"192":{"start":{"line":1055,"column":12},"end":{"line":1057,"column":13}},"193":{"start":{"line":1056,"column":16},"end":{"line":1056,"column":38}},"194":{"start":{"line":1059,"column":12},"end":{"line":1063,"column":13}},"195":{"start":{"line":1060,"column":16},"end":{"line":1060,"column":46}},"196":{"start":{"line":1062,"column":16},"end":{"line":1062,"column":45}},"197":{"start":{"line":1076,"column":8},"end":{"line":1076,"column":25}},"198":{"start":{"line":1077,"column":8},"end":{"line":1077,"column":27}},"199":{"start":{"line":1078,"column":8},"end":{"line":1082,"column":9}},"200":{"start":{"line":1079,"column":12},"end":{"line":1079,"column":38}},"201":{"start":{"line":1080,"column":12},"end":{"line":1080,"column":42}},"202":{"start":{"line":1081,"column":12},"end":{"line":1081,"column":42}},"203":{"start":{"line":1083,"column":8},"end":{"line":1085,"column":9}},"204":{"start":{"line":1084,"column":12},"end":{"line":1084,"column":34}},"205":{"start":{"line":1086,"column":8},"end":{"line":1086,"column":43}},"206":{"start":{"line":1091,"column":8},"end":{"line":1091,"column":32}},"207":{"start":{"line":1092,"column":8},"end":{"line":1092,"column":37}},"208":{"start":{"line":1108,"column":8},"end":{"line":1108,"column":20}},"209":{"start":{"line":1110,"column":8},"end":{"line":1120,"column":9}},"210":{"start":{"line":1111,"column":12},"end":{"line":1111,"column":24}},"211":{"start":{"line":1112,"column":12},"end":{"line":1119,"column":13}},"212":{"start":{"line":1113,"column":16},"end":{"line":1115,"column":17}},"213":{"start":{"line":1114,"column":20},"end":{"line":1114,"column":37}},"214":{"start":{"line":1116,"column":16},"end":{"line":1118,"column":17}},"215":{"start":{"line":1117,"column":20},"end":{"line":1117,"column":33}},"216":{"start":{"line":1122,"column":8},"end":{"line":1122,"column":20}},"217":{"start":{"line":1134,"column":8},"end":{"line":1146,"column":9}},"218":{"start":{"line":1136,"column":12},"end":{"line":1136,"column":34}},"219":{"start":{"line":1137,"column":12},"end":{"line":1137,"column":33}},"220":{"start":{"line":1139,"column":12},"end":{"line":1141,"column":13}},"221":{"start":{"line":1140,"column":16},"end":{"line":1140,"column":35}},"222":{"start":{"line":1143,"column":12},"end":{"line":1145,"column":13}},"223":{"start":{"line":1144,"column":16},"end":{"line":1144,"column":49}},"224":{"start":{"line":1156,"column":8},"end":{"line":1156,"column":53}},"225":{"start":{"line":1165,"column":8},"end":{"line":1165,"column":29}},"226":{"start":{"line":1179,"column":8},"end":{"line":1179,"column":27}},"227":{"start":{"line":1181,"column":8},"end":{"line":1183,"column":9}},"228":{"start":{"line":1182,"column":12},"end":{"line":1182,"column":71}},"229":{"start":{"line":1185,"column":8},"end":{"line":1191,"column":9}},"230":{"start":{"line":1186,"column":12},"end":{"line":1186,"column":43}},"231":{"start":{"line":1188,"column":12},"end":{"line":1190,"column":13}},"232":{"start":{"line":1189,"column":16},"end":{"line":1189,"column":34}},"233":{"start":{"line":1193,"column":8},"end":{"line":1199,"column":9}},"234":{"start":{"line":1194,"column":12},"end":{"line":1198,"column":13}},"235":{"start":{"line":1195,"column":16},"end":{"line":1195,"column":41}},"236":{"start":{"line":1197,"column":16},"end":{"line":1197,"column":46}},"237":{"start":{"line":1201,"column":8},"end":{"line":1206,"column":9}},"238":{"start":{"line":1202,"column":12},"end":{"line":1205,"column":15}},"239":{"start":{"line":1208,"column":8},"end":{"line":1210,"column":9}},"240":{"start":{"line":1209,"column":12},"end":{"line":1209,"column":29}},"241":{"start":{"line":1222,"column":0},"end":{"line":1268,"column":2}},"242":{"start":{"line":1230,"column":4},"end":{"line":1230,"column":17}},"243":{"start":{"line":1237,"column":4},"end":{"line":1237,"column":27}},"244":{"start":{"line":1244,"column":4},"end":{"line":1244,"column":23}},"245":{"start":{"line":1251,"column":4},"end":{"line":1251,"column":21}},"246":{"start":{"line":1253,"column":4},"end":{"line":1253,"column":22}},"247":{"start":{"line":1270,"column":0},"end":{"line":1358,"column":2}},"248":{"start":{"line":1274,"column":8},"end":{"line":1282,"column":9}},"249":{"start":{"line":1275,"column":12},"end":{"line":1281,"column":13}},"250":{"start":{"line":1276,"column":16},"end":{"line":1276,"column":31}},"251":{"start":{"line":1277,"column":16},"end":{"line":1277,"column":36}},"252":{"start":{"line":1279,"column":16},"end":{"line":1279,"column":38}},"253":{"start":{"line":1280,"column":16},"end":{"line":1280,"column":28}},"254":{"start":{"line":1283,"column":8},"end":{"line":1283,"column":31}},"255":{"start":{"line":1284,"column":8},"end":{"line":1299,"column":9}},"256":{"start":{"line":1286,"column":16},"end":{"line":1286,"column":56}},"257":{"start":{"line":1287,"column":16},"end":{"line":1287,"column":22}},"258":{"start":{"line":1289,"column":16},"end":{"line":1289,"column":58}},"259":{"start":{"line":1290,"column":16},"end":{"line":1290,"column":22}},"260":{"start":{"line":1292,"column":16},"end":{"line":1298,"column":17}},"261":{"start":{"line":1293,"column":20},"end":{"line":1293,"column":38}},"262":{"start":{"line":1294,"column":20},"end":{"line":1294,"column":52}},"263":{"start":{"line":1295,"column":20},"end":{"line":1295,"column":46}},"264":{"start":{"line":1297,"column":20},"end":{"line":1297,"column":42}},"265":{"start":{"line":1301,"column":8},"end":{"line":1303,"column":9}},"266":{"start":{"line":1302,"column":12},"end":{"line":1302,"column":29}},"267":{"start":{"line":1305,"column":8},"end":{"line":1305,"column":19}},"268":{"start":{"line":1315,"column":8},"end":{"line":1316,"column":23}},"269":{"start":{"line":1318,"column":8},"end":{"line":1320,"column":9}},"270":{"start":{"line":1319,"column":12},"end":{"line":1319,"column":61}},"271":{"start":{"line":1323,"column":8},"end":{"line":1331,"column":9}},"272":{"start":{"line":1324,"column":12},"end":{"line":1324,"column":44}},"273":{"start":{"line":1326,"column":12},"end":{"line":1330,"column":13}},"274":{"start":{"line":1327,"column":16},"end":{"line":1327,"column":48}},"275":{"start":{"line":1329,"column":16},"end":{"line":1329,"column":59}},"276":{"start":{"line":1333,"column":8},"end":{"line":1333,"column":19}},"277":{"start":{"line":1347,"column":8},"end":{"line":1351,"column":9}},"278":{"start":{"line":1348,"column":12},"end":{"line":1348,"column":66}},"279":{"start":{"line":1350,"column":12},"end":{"line":1350,"column":36}},"280":{"start":{"line":1355,"column":8},"end":{"line":1355,"column":23}},"281":{"start":{"line":1366,"column":0},"end":{"line":1383,"column":2}},"282":{"start":{"line":1374,"column":4},"end":{"line":1374,"column":19}},"283":{"start":{"line":1382,"column":4},"end":{"line":1382,"column":19}},"284":{"start":{"line":1385,"column":0},"end":{"line":1428,"column":2}},"285":{"start":{"line":1387,"column":8},"end":{"line":1387,"column":32}},"286":{"start":{"line":1388,"column":8},"end":{"line":1392,"column":9}},"287":{"start":{"line":1389,"column":12},"end":{"line":1391,"column":15}},"288":{"start":{"line":1390,"column":16},"end":{"line":1390,"column":40}},"289":{"start":{"line":1401,"column":8},"end":{"line":1401,"column":44}},"290":{"start":{"line":1402,"column":8},"end":{"line":1412,"column":9}},"291":{"start":{"line":1403,"column":12},"end":{"line":1410,"column":13}},"292":{"start":{"line":1404,"column":16},"end":{"line":1406,"column":17}},"293":{"start":{"line":1405,"column":20},"end":{"line":1405,"column":48}},"294":{"start":{"line":1408,"column":16},"end":{"line":1408,"column":38}},"295":{"start":{"line":1409,"column":16},"end":{"line":1409,"column":29}},"296":{"start":{"line":1414,"column":8},"end":{"line":1414,"column":24}},"297":{"start":{"line":1426,"column":8},"end":{"line":1426,"column":59}},"298":{"start":{"line":1454,"column":0},"end":{"line":1546,"column":6}},"299":{"start":{"line":1461,"column":8},"end":{"line":1461,"column":51}},"300":{"start":{"line":1473,"column":8},"end":{"line":1475,"column":9}},"301":{"start":{"line":1474,"column":12},"end":{"line":1474,"column":24}},"302":{"start":{"line":1477,"column":8},"end":{"line":1477,"column":45}},"303":{"start":{"line":1489,"column":8},"end":{"line":1489,"column":47}},"304":{"start":{"line":1491,"column":8},"end":{"line":1493,"column":9}},"305":{"start":{"line":1492,"column":12},"end":{"line":1492,"column":21}},"306":{"start":{"line":1495,"column":8},"end":{"line":1495,"column":36}},"307":{"start":{"line":1497,"column":8},"end":{"line":1500,"column":9}},"308":{"start":{"line":1498,"column":12},"end":{"line":1498,"column":25}},"309":{"start":{"line":1499,"column":12},"end":{"line":1499,"column":46}},"310":{"start":{"line":1502,"column":8},"end":{"line":1502,"column":42}},"311":{"start":{"line":1504,"column":8},"end":{"line":1510,"column":9}},"312":{"start":{"line":1505,"column":12},"end":{"line":1505,"column":46}},"313":{"start":{"line":1506,"column":12},"end":{"line":1506,"column":30}},"314":{"start":{"line":1507,"column":12},"end":{"line":1509,"column":13}},"315":{"start":{"line":1508,"column":16},"end":{"line":1508,"column":25}},"316":{"start":{"line":1513,"column":8},"end":{"line":1513,"column":72}},"317":{"start":{"line":1518,"column":8},"end":{"line":1519,"column":21}},"318":{"start":{"line":1521,"column":8},"end":{"line":1531,"column":9}},"319":{"start":{"line":1522,"column":12},"end":{"line":1530,"column":14}},"320":{"start":{"line":1533,"column":8},"end":{"line":1533,"column":34}},"321":{"start":{"line":1535,"column":8},"end":{"line":1545,"column":9}},"322":{"start":{"line":1536,"column":12},"end":{"line":1536,"column":45}},"323":{"start":{"line":1538,"column":12},"end":{"line":1540,"column":13}},"324":{"start":{"line":1539,"column":16},"end":{"line":1539,"column":43}},"325":{"start":{"line":1542,"column":12},"end":{"line":1544,"column":13}},"326":{"start":{"line":1543,"column":16},"end":{"line":1543,"column":46}},"327":{"start":{"line":1548,"column":0},"end":{"line":2313,"column":2}},"328":{"start":{"line":1565,"column":8},"end":{"line":1565,"column":52}},"329":{"start":{"line":1566,"column":8},"end":{"line":1570,"column":11}},"330":{"start":{"line":1567,"column":12},"end":{"line":1569,"column":13}},"331":{"start":{"line":1568,"column":16},"end":{"line":1568,"column":37}},"332":{"start":{"line":1571,"column":8},"end":{"line":1571,"column":22}},"333":{"start":{"line":1587,"column":8},"end":{"line":1587,"column":55}},"334":{"start":{"line":1588,"column":8},"end":{"line":1592,"column":11}},"335":{"start":{"line":1589,"column":12},"end":{"line":1591,"column":13}},"336":{"start":{"line":1590,"column":16},"end":{"line":1590,"column":37}},"337":{"start":{"line":1593,"column":8},"end":{"line":1593,"column":22}},"338":{"start":{"line":1613,"column":8},"end":{"line":1613,"column":67}},"339":{"start":{"line":1647,"column":8},"end":{"line":1650,"column":46}},"340":{"start":{"line":1653,"column":8},"end":{"line":1657,"column":11}},"341":{"start":{"line":1659,"column":8},"end":{"line":1695,"column":9}},"342":{"start":{"line":1661,"column":12},"end":{"line":1663,"column":13}},"343":{"start":{"line":1662,"column":16},"end":{"line":1662,"column":58}},"344":{"start":{"line":1665,"column":12},"end":{"line":1665,"column":19}},"345":{"start":{"line":1666,"column":12},"end":{"line":1666,"column":24}},"346":{"start":{"line":1667,"column":12},"end":{"line":1667,"column":50}},"347":{"start":{"line":1668,"column":12},"end":{"line":1668,"column":21}},"348":{"start":{"line":1670,"column":12},"end":{"line":1672,"column":13}},"349":{"start":{"line":1671,"column":16},"end":{"line":1671,"column":29}},"350":{"start":{"line":1674,"column":12},"end":{"line":1674,"column":32}},"351":{"start":{"line":1675,"column":12},"end":{"line":1675,"column":31}},"352":{"start":{"line":1677,"column":12},"end":{"line":1692,"column":21}},"353":{"start":{"line":1679,"column":16},"end":{"line":1682,"column":17}},"354":{"start":{"line":1680,"column":20},"end":{"line":1680,"column":60}},"355":{"start":{"line":1681,"column":20},"end":{"line":1681,"column":39}},"356":{"start":{"line":1684,"column":16},"end":{"line":1684,"column":53}},"357":{"start":{"line":1686,"column":16},"end":{"line":1686,"column":49}},"358":{"start":{"line":1687,"column":16},"end":{"line":1687,"column":28}},"359":{"start":{"line":1688,"column":16},"end":{"line":1688,"column":28}},"360":{"start":{"line":1690,"column":16},"end":{"line":1690,"column":52}},"361":{"start":{"line":1694,"column":12},"end":{"line":1694,"column":66}},"362":{"start":{"line":1697,"column":8},"end":{"line":1697,"column":34}},"363":{"start":{"line":1698,"column":8},"end":{"line":1698,"column":25}},"364":{"start":{"line":1699,"column":8},"end":{"line":1699,"column":29}},"365":{"start":{"line":1702,"column":8},"end":{"line":1706,"column":9}},"366":{"start":{"line":1703,"column":12},"end":{"line":1703,"column":50}},"367":{"start":{"line":1704,"column":12},"end":{"line":1704,"column":53}},"368":{"start":{"line":1705,"column":12},"end":{"line":1705,"column":39}},"369":{"start":{"line":1708,"column":8},"end":{"line":1708,"column":24}},"370":{"start":{"line":1710,"column":8},"end":{"line":1740,"column":9}},"371":{"start":{"line":1712,"column":12},"end":{"line":1712,"column":44}},"372":{"start":{"line":1713,"column":12},"end":{"line":1713,"column":51}},"373":{"start":{"line":1714,"column":12},"end":{"line":1714,"column":32}},"374":{"start":{"line":1716,"column":12},"end":{"line":1731,"column":13}},"375":{"start":{"line":1717,"column":16},"end":{"line":1717,"column":28}},"376":{"start":{"line":1719,"column":16},"end":{"line":1723,"column":17}},"377":{"start":{"line":1720,"column":20},"end":{"line":1720,"column":50}},"378":{"start":{"line":1721,"column":23},"end":{"line":1723,"column":17}},"379":{"start":{"line":1722,"column":20},"end":{"line":1722,"column":43}},"380":{"start":{"line":1725,"column":16},"end":{"line":1725,"column":58}},"381":{"start":{"line":1728,"column":16},"end":{"line":1730,"column":17}},"382":{"start":{"line":1729,"column":20},"end":{"line":1729,"column":32}},"383":{"start":{"line":1734,"column":12},"end":{"line":1738,"column":13}},"384":{"start":{"line":1735,"column":16},"end":{"line":1735,"column":49}},"385":{"start":{"line":1736,"column":19},"end":{"line":1738,"column":13}},"386":{"start":{"line":1737,"column":16},"end":{"line":1737,"column":47}},"387":{"start":{"line":1742,"column":8},"end":{"line":1750,"column":9}},"388":{"start":{"line":1743,"column":12},"end":{"line":1743,"column":59}},"389":{"start":{"line":1744,"column":12},"end":{"line":1744,"column":131}},"390":{"start":{"line":1747,"column":12},"end":{"line":1749,"column":13}},"391":{"start":{"line":1748,"column":16},"end":{"line":1748,"column":41}},"392":{"start":{"line":1752,"column":8},"end":{"line":1756,"column":9}},"393":{"start":{"line":1753,"column":12},"end":{"line":1753,"column":64}},"394":{"start":{"line":1754,"column":12},"end":{"line":1754,"column":76}},"395":{"start":{"line":1755,"column":12},"end":{"line":1755,"column":53}},"396":{"start":{"line":1758,"column":8},"end":{"line":1758,"column":46}},"397":{"start":{"line":1768,"column":8},"end":{"line":1768,"column":46}},"398":{"start":{"line":1789,"column":8},"end":{"line":1792,"column":56}},"399":{"start":{"line":1795,"column":8},"end":{"line":1806,"column":9}},"400":{"start":{"line":1796,"column":12},"end":{"line":1800,"column":13}},"401":{"start":{"line":1797,"column":16},"end":{"line":1799,"column":17}},"402":{"start":{"line":1798,"column":20},"end":{"line":1798,"column":48}},"403":{"start":{"line":1801,"column":12},"end":{"line":1803,"column":13}},"404":{"start":{"line":1802,"column":16},"end":{"line":1802,"column":60}},"405":{"start":{"line":1805,"column":12},"end":{"line":1805,"column":24}},"406":{"start":{"line":1808,"column":8},"end":{"line":1824,"column":10}},"407":{"start":{"line":1815,"column":12},"end":{"line":1815,"column":45}},"408":{"start":{"line":1816,"column":12},"end":{"line":1823,"column":13}},"409":{"start":{"line":1817,"column":16},"end":{"line":1822,"column":17}},"410":{"start":{"line":1818,"column":20},"end":{"line":1818,"column":40}},"411":{"start":{"line":1819,"column":20},"end":{"line":1821,"column":21}},"412":{"start":{"line":1820,"column":24},"end":{"line":1820,"column":44}},"413":{"start":{"line":1826,"column":8},"end":{"line":1856,"column":9}},"414":{"start":{"line":1828,"column":12},"end":{"line":1828,"column":40}},"415":{"start":{"line":1829,"column":12},"end":{"line":1829,"column":28}},"416":{"start":{"line":1830,"column":12},"end":{"line":1830,"column":67}},"417":{"start":{"line":1832,"column":12},"end":{"line":1844,"column":13}},"418":{"start":{"line":1833,"column":16},"end":{"line":1841,"column":17}},"419":{"start":{"line":1834,"column":20},"end":{"line":1834,"column":55}},"420":{"start":{"line":1836,"column":20},"end":{"line":1840,"column":21}},"421":{"start":{"line":1837,"column":24},"end":{"line":1839,"column":25}},"422":{"start":{"line":1838,"column":28},"end":{"line":1838,"column":60}},"423":{"start":{"line":1843,"column":16},"end":{"line":1843,"column":28}},"424":{"start":{"line":1847,"column":15},"end":{"line":1856,"column":9}},"425":{"start":{"line":1848,"column":12},"end":{"line":1848,"column":26}},"426":{"start":{"line":1849,"column":12},"end":{"line":1849,"column":24}},"427":{"start":{"line":1851,"column":15},"end":{"line":1856,"column":9}},"428":{"start":{"line":1852,"column":12},"end":{"line":1852,"column":50}},"429":{"start":{"line":1853,"column":12},"end":{"line":1853,"column":44}},"430":{"start":{"line":1854,"column":12},"end":{"line":1854,"column":36}},"431":{"start":{"line":1855,"column":12},"end":{"line":1855,"column":24}},"432":{"start":{"line":1858,"column":8},"end":{"line":1858,"column":45}},"433":{"start":{"line":1861,"column":8},"end":{"line":1873,"column":9}},"434":{"start":{"line":1862,"column":12},"end":{"line":1862,"column":50}},"435":{"start":{"line":1864,"column":12},"end":{"line":1872,"column":13}},"436":{"start":{"line":1865,"column":16},"end":{"line":1865,"column":44}},"437":{"start":{"line":1866,"column":16},"end":{"line":1866,"column":28}},"438":{"start":{"line":1868,"column":19},"end":{"line":1872,"column":13}},"439":{"start":{"line":1869,"column":16},"end":{"line":1869,"column":31}},"440":{"start":{"line":1870,"column":16},"end":{"line":1870,"column":52}},"441":{"start":{"line":1871,"column":16},"end":{"line":1871,"column":28}},"442":{"start":{"line":1876,"column":8},"end":{"line":1876,"column":28}},"443":{"start":{"line":1877,"column":8},"end":{"line":1879,"column":9}},"444":{"start":{"line":1878,"column":12},"end":{"line":1878,"column":35}},"445":{"start":{"line":1881,"column":8},"end":{"line":1881,"column":20}},"446":{"start":{"line":1890,"column":8},"end":{"line":1890,"column":50}},"447":{"start":{"line":1901,"column":8},"end":{"line":1901,"column":33}},"448":{"start":{"line":1913,"column":8},"end":{"line":1913,"column":53}},"449":{"start":{"line":1984,"column":8},"end":{"line":1987,"column":34}},"450":{"start":{"line":1989,"column":8},"end":{"line":2004,"column":9}},"451":{"start":{"line":1990,"column":12},"end":{"line":1992,"column":13}},"452":{"start":{"line":1991,"column":16},"end":{"line":1991,"column":43}},"453":{"start":{"line":1993,"column":12},"end":{"line":1993,"column":54}},"454":{"start":{"line":1995,"column":12},"end":{"line":1995,"column":21}},"455":{"start":{"line":1997,"column":12},"end":{"line":2002,"column":21}},"456":{"start":{"line":1998,"column":16},"end":{"line":2000,"column":17}},"457":{"start":{"line":1999,"column":20},"end":{"line":1999,"column":41}},"458":{"start":{"line":2001,"column":16},"end":{"line":2001,"column":63}},"459":{"start":{"line":2006,"column":8},"end":{"line":2006,"column":19}},"460":{"start":{"line":2024,"column":8},"end":{"line":2024,"column":45}},"461":{"start":{"line":2026,"column":8},"end":{"line":2030,"column":9}},"462":{"start":{"line":2027,"column":12},"end":{"line":2027,"column":49}},"463":{"start":{"line":2029,"column":12},"end":{"line":2029,"column":24}},"464":{"start":{"line":2048,"column":8},"end":{"line":2053,"column":36}},"465":{"start":{"line":2055,"column":8},"end":{"line":2055,"column":30}},"466":{"start":{"line":2058,"column":8},"end":{"line":2062,"column":9}},"467":{"start":{"line":2059,"column":12},"end":{"line":2061,"column":15}},"468":{"start":{"line":2064,"column":8},"end":{"line":2072,"column":9}},"469":{"start":{"line":2066,"column":12},"end":{"line":2066,"column":72}},"470":{"start":{"line":2068,"column":12},"end":{"line":2071,"column":13}},"471":{"start":{"line":2069,"column":16},"end":{"line":2069,"column":31}},"472":{"start":{"line":2070,"column":16},"end":{"line":2070,"column":37}},"473":{"start":{"line":2074,"column":8},"end":{"line":2076,"column":9}},"474":{"start":{"line":2075,"column":12},"end":{"line":2075,"column":41}},"475":{"start":{"line":2078,"column":8},"end":{"line":2078,"column":18}},"476":{"start":{"line":2099,"column":8},"end":{"line":2099,"column":33}},"477":{"start":{"line":2101,"column":8},"end":{"line":2115,"column":9}},"478":{"start":{"line":2102,"column":12},"end":{"line":2108,"column":13}},"479":{"start":{"line":2103,"column":16},"end":{"line":2103,"column":33}},"480":{"start":{"line":2104,"column":16},"end":{"line":2104,"column":52}},"481":{"start":{"line":2106,"column":16},"end":{"line":2106,"column":31}},"482":{"start":{"line":2107,"column":16},"end":{"line":2107,"column":38}},"483":{"start":{"line":2110,"column":12},"end":{"line":2114,"column":13}},"484":{"start":{"line":2111,"column":16},"end":{"line":2111,"column":47}},"485":{"start":{"line":2112,"column":16},"end":{"line":2112,"column":35}},"486":{"start":{"line":2113,"column":16},"end":{"line":2113,"column":52}},"487":{"start":{"line":2148,"column":8},"end":{"line":2157,"column":17}},"488":{"start":{"line":2159,"column":8},"end":{"line":2174,"column":9}},"489":{"start":{"line":2164,"column":12},"end":{"line":2170,"column":13}},"490":{"start":{"line":2165,"column":16},"end":{"line":2165,"column":38}},"491":{"start":{"line":2166,"column":19},"end":{"line":2170,"column":13}},"492":{"start":{"line":2167,"column":16},"end":{"line":2167,"column":52}},"493":{"start":{"line":2169,"column":16},"end":{"line":2169,"column":26}},"494":{"start":{"line":2173,"column":12},"end":{"line":2173,"column":73}},"495":{"start":{"line":2176,"column":8},"end":{"line":2178,"column":9}},"496":{"start":{"line":2177,"column":12},"end":{"line":2177,"column":36}},"497":{"start":{"line":2180,"column":8},"end":{"line":2182,"column":9}},"498":{"start":{"line":2181,"column":12},"end":{"line":2181,"column":33}},"499":{"start":{"line":2184,"column":8},"end":{"line":2184,"column":30}},"500":{"start":{"line":2186,"column":8},"end":{"line":2192,"column":9}},"501":{"start":{"line":2187,"column":12},"end":{"line":2187,"column":41}},"502":{"start":{"line":2189,"column":12},"end":{"line":2191,"column":13}},"503":{"start":{"line":2190,"column":16},"end":{"line":2190,"column":37}},"504":{"start":{"line":2195,"column":8},"end":{"line":2199,"column":9}},"505":{"start":{"line":2196,"column":12},"end":{"line":2198,"column":15}},"506":{"start":{"line":2202,"column":8},"end":{"line":2216,"column":9}},"507":{"start":{"line":2203,"column":12},"end":{"line":2205,"column":13}},"508":{"start":{"line":2204,"column":16},"end":{"line":2204,"column":60}},"509":{"start":{"line":2208,"column":12},"end":{"line":2208,"column":23}},"510":{"start":{"line":2211,"column":12},"end":{"line":2213,"column":13}},"511":{"start":{"line":2212,"column":16},"end":{"line":2212,"column":33}},"512":{"start":{"line":2215,"column":12},"end":{"line":2215,"column":33}},"513":{"start":{"line":2218,"column":8},"end":{"line":2218,"column":43}},"514":{"start":{"line":2222,"column":8},"end":{"line":2222,"column":16}},"515":{"start":{"line":2225,"column":8},"end":{"line":2233,"column":9}},"516":{"start":{"line":2226,"column":12},"end":{"line":2226,"column":35}},"517":{"start":{"line":2227,"column":12},"end":{"line":2227,"column":44}},"518":{"start":{"line":2228,"column":12},"end":{"line":2232,"column":13}},"519":{"start":{"line":2229,"column":16},"end":{"line":2229,"column":36}},"520":{"start":{"line":2230,"column":16},"end":{"line":2230,"column":36}},"521":{"start":{"line":2231,"column":16},"end":{"line":2231,"column":34}},"522":{"start":{"line":2235,"column":8},"end":{"line":2235,"column":19}},"523":{"start":{"line":2247,"column":8},"end":{"line":2247,"column":19}},"524":{"start":{"line":2249,"column":8},"end":{"line":2252,"column":9}},"525":{"start":{"line":2250,"column":12},"end":{"line":2250,"column":45}},"526":{"start":{"line":2251,"column":12},"end":{"line":2251,"column":54}},"527":{"start":{"line":2253,"column":8},"end":{"line":2253,"column":32}},"528":{"start":{"line":2254,"column":8},"end":{"line":2254,"column":31}},"529":{"start":{"line":2273,"column":8},"end":{"line":2273,"column":47}},"530":{"start":{"line":2275,"column":8},"end":{"line":2288,"column":9}},"531":{"start":{"line":2277,"column":16},"end":{"line":2277,"column":57}},"532":{"start":{"line":2284,"column":16},"end":{"line":2284,"column":35}},"533":{"start":{"line":2285,"column":16},"end":{"line":2285,"column":22}},"534":{"start":{"line":2287,"column":16},"end":{"line":2287,"column":43}},"535":{"start":{"line":2290,"column":8},"end":{"line":2290,"column":38}},"536":{"start":{"line":2310,"column":8},"end":{"line":2310,"column":46}},"537":{"start":{"line":2315,"column":0},"end":{"line":2315,"column":19}},"538":{"start":{"line":2318,"column":0},"end":{"line":2318,"column":23}},"539":{"start":{"line":2319,"column":0},"end":{"line":2319,"column":31}},"540":{"start":{"line":2321,"column":0},"end":{"line":2321,"column":56}},"541":{"start":{"line":2331,"column":0},"end":{"line":2331,"column":32}}},"branchMap":{"1":{"line":77,"type":"if","locations":[{"start":{"line":77,"column":8},"end":{"line":77,"column":8}},{"start":{"line":77,"column":8},"end":{"line":77,"column":8}}]},"2":{"line":114,"type":"if","locations":[{"start":{"line":114,"column":8},"end":{"line":114,"column":8}},{"start":{"line":114,"column":8},"end":{"line":114,"column":8}}]},"3":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":8},"end":{"line":140,"column":8}},{"start":{"line":140,"column":8},"end":{"line":140,"column":8}}]},"4":{"line":147,"type":"if","locations":[{"start":{"line":147,"column":8},"end":{"line":147,"column":8}},{"start":{"line":147,"column":8},"end":{"line":147,"column":8}}]},"5":{"line":174,"type":"if","locations":[{"start":{"line":174,"column":8},"end":{"line":174,"column":8}},{"start":{"line":174,"column":8},"end":{"line":174,"column":8}}]},"6":{"line":228,"type":"if","locations":[{"start":{"line":228,"column":4},"end":{"line":228,"column":4}},{"start":{"line":228,"column":4},"end":{"line":228,"column":4}}]},"7":{"line":271,"type":"if","locations":[{"start":{"line":271,"column":8},"end":{"line":271,"column":8}},{"start":{"line":271,"column":8},"end":{"line":271,"column":8}}]},"8":{"line":273,"type":"if","locations":[{"start":{"line":273,"column":12},"end":{"line":273,"column":12}},{"start":{"line":273,"column":12},"end":{"line":273,"column":12}}]},"9":{"line":274,"type":"switch","locations":[{"start":{"line":275,"column":20},"end":{"line":276,"column":42}},{"start":{"line":277,"column":20},"end":{"line":279,"column":30}},{"start":{"line":280,"column":20},"end":{"line":282,"column":30}},{"start":{"line":283,"column":20},"end":{"line":283,"column":28}}]},"10":{"line":290,"type":"if","locations":[{"start":{"line":290,"column":4},"end":{"line":290,"column":4}},{"start":{"line":290,"column":4},"end":{"line":290,"column":4}}]},"11":{"line":299,"type":"if","locations":[{"start":{"line":299,"column":8},"end":{"line":299,"column":8}},{"start":{"line":299,"column":8},"end":{"line":299,"column":8}}]},"12":{"line":302,"type":"if","locations":[{"start":{"line":302,"column":12},"end":{"line":302,"column":12}},{"start":{"line":302,"column":12},"end":{"line":302,"column":12}}]},"13":{"line":302,"type":"binary-expr","locations":[{"start":{"line":302,"column":16},"end":{"line":302,"column":22}},{"start":{"line":302,"column":26},"end":{"line":302,"column":56}}]},"14":{"line":305,"type":"if","locations":[{"start":{"line":305,"column":19},"end":{"line":305,"column":19}},{"start":{"line":305,"column":19},"end":{"line":305,"column":19}}]},"15":{"line":305,"type":"binary-expr","locations":[{"start":{"line":305,"column":23},"end":{"line":305,"column":29}},{"start":{"line":305,"column":33},"end":{"line":305,"column":70}}]},"16":{"line":436,"type":"if","locations":[{"start":{"line":436,"column":12},"end":{"line":436,"column":12}},{"start":{"line":436,"column":12},"end":{"line":436,"column":12}}]},"17":{"line":436,"type":"binary-expr","locations":[{"start":{"line":436,"column":16},"end":{"line":436,"column":31}},{"start":{"line":436,"column":36},"end":{"line":436,"column":38}},{"start":{"line":436,"column":42},"end":{"line":436,"column":51}}]},"18":{"line":477,"type":"if","locations":[{"start":{"line":477,"column":4},"end":{"line":477,"column":4}},{"start":{"line":477,"column":4},"end":{"line":477,"column":4}}]},"19":{"line":495,"type":"if","locations":[{"start":{"line":495,"column":4},"end":{"line":495,"column":4}},{"start":{"line":495,"column":4},"end":{"line":495,"column":4}}]},"20":{"line":708,"type":"if","locations":[{"start":{"line":708,"column":8},"end":{"line":708,"column":8}},{"start":{"line":708,"column":8},"end":{"line":708,"column":8}}]},"21":{"line":712,"type":"if","locations":[{"start":{"line":712,"column":8},"end":{"line":712,"column":8}},{"start":{"line":712,"column":8},"end":{"line":712,"column":8}}]},"22":{"line":716,"type":"if","locations":[{"start":{"line":716,"column":8},"end":{"line":716,"column":8}},{"start":{"line":716,"column":8},"end":{"line":716,"column":8}}]},"23":{"line":720,"type":"if","locations":[{"start":{"line":720,"column":12},"end":{"line":720,"column":12}},{"start":{"line":720,"column":12},"end":{"line":720,"column":12}}]},"24":{"line":724,"type":"if","locations":[{"start":{"line":724,"column":12},"end":{"line":724,"column":12}},{"start":{"line":724,"column":12},"end":{"line":724,"column":12}}]},"25":{"line":729,"type":"if","locations":[{"start":{"line":729,"column":8},"end":{"line":729,"column":8}},{"start":{"line":729,"column":8},"end":{"line":729,"column":8}}]},"26":{"line":730,"type":"cond-expr","locations":[{"start":{"line":730,"column":40},"end":{"line":730,"column":41}},{"start":{"line":730,"column":44},"end":{"line":730,"column":45}}]},"27":{"line":765,"type":"if","locations":[{"start":{"line":765,"column":8},"end":{"line":765,"column":8}},{"start":{"line":765,"column":8},"end":{"line":765,"column":8}}]},"28":{"line":770,"type":"if","locations":[{"start":{"line":770,"column":8},"end":{"line":770,"column":8}},{"start":{"line":770,"column":8},"end":{"line":770,"column":8}}]},"29":{"line":771,"type":"if","locations":[{"start":{"line":771,"column":12},"end":{"line":771,"column":12}},{"start":{"line":771,"column":12},"end":{"line":771,"column":12}}]},"30":{"line":777,"type":"if","locations":[{"start":{"line":777,"column":12},"end":{"line":777,"column":12}},{"start":{"line":777,"column":12},"end":{"line":777,"column":12}}]},"31":{"line":784,"type":"if","locations":[{"start":{"line":784,"column":8},"end":{"line":784,"column":8}},{"start":{"line":784,"column":8},"end":{"line":784,"column":8}}]},"32":{"line":785,"type":"if","locations":[{"start":{"line":785,"column":12},"end":{"line":785,"column":12}},{"start":{"line":785,"column":12},"end":{"line":785,"column":12}}]},"33":{"line":791,"type":"if","locations":[{"start":{"line":791,"column":12},"end":{"line":791,"column":12}},{"start":{"line":791,"column":12},"end":{"line":791,"column":12}}]},"34":{"line":831,"type":"if","locations":[{"start":{"line":831,"column":8},"end":{"line":831,"column":8}},{"start":{"line":831,"column":8},"end":{"line":831,"column":8}}]},"35":{"line":831,"type":"binary-expr","locations":[{"start":{"line":831,"column":12},"end":{"line":831,"column":25}},{"start":{"line":831,"column":29},"end":{"line":831,"column":39}}]},"36":{"line":838,"type":"if","locations":[{"start":{"line":838,"column":12},"end":{"line":838,"column":12}},{"start":{"line":838,"column":12},"end":{"line":838,"column":12}}]},"37":{"line":838,"type":"binary-expr","locations":[{"start":{"line":838,"column":16},"end":{"line":838,"column":31}},{"start":{"line":838,"column":35},"end":{"line":838,"column":56}}]},"38":{"line":842,"type":"if","locations":[{"start":{"line":842,"column":12},"end":{"line":842,"column":12}},{"start":{"line":842,"column":12},"end":{"line":842,"column":12}}]},"39":{"line":849,"type":"if","locations":[{"start":{"line":849,"column":8},"end":{"line":849,"column":8}},{"start":{"line":849,"column":8},"end":{"line":849,"column":8}}]},"40":{"line":850,"type":"if","locations":[{"start":{"line":850,"column":12},"end":{"line":850,"column":12}},{"start":{"line":850,"column":12},"end":{"line":850,"column":12}}]},"41":{"line":855,"type":"if","locations":[{"start":{"line":855,"column":12},"end":{"line":855,"column":12}},{"start":{"line":855,"column":12},"end":{"line":855,"column":12}}]},"42":{"line":861,"type":"if","locations":[{"start":{"line":861,"column":8},"end":{"line":861,"column":8}},{"start":{"line":861,"column":8},"end":{"line":861,"column":8}}]},"43":{"line":862,"type":"if","locations":[{"start":{"line":862,"column":12},"end":{"line":862,"column":12}},{"start":{"line":862,"column":12},"end":{"line":862,"column":12}}]},"44":{"line":880,"type":"cond-expr","locations":[{"start":{"line":880,"column":41},"end":{"line":880,"column":71}},{"start":{"line":880,"column":74},"end":{"line":880,"column":78}}]},"45":{"line":894,"type":"cond-expr","locations":[{"start":{"line":894,"column":41},"end":{"line":894,"column":71}},{"start":{"line":894,"column":74},"end":{"line":894,"column":78}}]},"46":{"line":896,"type":"if","locations":[{"start":{"line":896,"column":8},"end":{"line":896,"column":8}},{"start":{"line":896,"column":8},"end":{"line":896,"column":8}}]},"47":{"line":896,"type":"binary-expr","locations":[{"start":{"line":896,"column":12},"end":{"line":896,"column":26}},{"start":{"line":896,"column":30},"end":{"line":896,"column":39}}]},"48":{"line":916,"type":"cond-expr","locations":[{"start":{"line":916,"column":41},"end":{"line":916,"column":71}},{"start":{"line":916,"column":74},"end":{"line":916,"column":78}}]},"49":{"line":930,"type":"if","locations":[{"start":{"line":930,"column":8},"end":{"line":930,"column":8}},{"start":{"line":930,"column":8},"end":{"line":930,"column":8}}]},"50":{"line":930,"type":"binary-expr","locations":[{"start":{"line":930,"column":12},"end":{"line":930,"column":14}},{"start":{"line":930,"column":18},"end":{"line":930,"column":27}}]},"51":{"line":939,"type":"if","locations":[{"start":{"line":939,"column":8},"end":{"line":939,"column":8}},{"start":{"line":939,"column":8},"end":{"line":939,"column":8}}]},"52":{"line":942,"type":"if","locations":[{"start":{"line":942,"column":16},"end":{"line":942,"column":16}},{"start":{"line":942,"column":16},"end":{"line":942,"column":16}}]},"53":{"line":942,"type":"binary-expr","locations":[{"start":{"line":942,"column":20},"end":{"line":942,"column":21}},{"start":{"line":942,"column":26},"end":{"line":942,"column":29}},{"start":{"line":942,"column":33},"end":{"line":942,"column":44}}]},"54":{"line":949,"type":"if","locations":[{"start":{"line":949,"column":8},"end":{"line":949,"column":8}},{"start":{"line":949,"column":8},"end":{"line":949,"column":8}}]},"55":{"line":952,"type":"if","locations":[{"start":{"line":952,"column":16},"end":{"line":952,"column":16}},{"start":{"line":952,"column":16},"end":{"line":952,"column":16}}]},"56":{"line":952,"type":"binary-expr","locations":[{"start":{"line":952,"column":20},"end":{"line":952,"column":21}},{"start":{"line":952,"column":26},"end":{"line":952,"column":29}},{"start":{"line":952,"column":33},"end":{"line":952,"column":44}}]},"57":{"line":989,"type":"if","locations":[{"start":{"line":989,"column":8},"end":{"line":989,"column":8}},{"start":{"line":989,"column":8},"end":{"line":989,"column":8}}]},"58":{"line":989,"type":"binary-expr","locations":[{"start":{"line":989,"column":12},"end":{"line":989,"column":25}},{"start":{"line":989,"column":29},"end":{"line":989,"column":45}}]},"59":{"line":1046,"type":"if","locations":[{"start":{"line":1046,"column":8},"end":{"line":1046,"column":8}},{"start":{"line":1046,"column":8},"end":{"line":1046,"column":8}}]},"60":{"line":1046,"type":"binary-expr","locations":[{"start":{"line":1046,"column":12},"end":{"line":1046,"column":25}},{"start":{"line":1046,"column":29},"end":{"line":1046,"column":39}}]},"61":{"line":1055,"type":"if","locations":[{"start":{"line":1055,"column":12},"end":{"line":1055,"column":12}},{"start":{"line":1055,"column":12},"end":{"line":1055,"column":12}}]},"62":{"line":1059,"type":"if","locations":[{"start":{"line":1059,"column":12},"end":{"line":1059,"column":12}},{"start":{"line":1059,"column":12},"end":{"line":1059,"column":12}}]},"63":{"line":1078,"type":"if","locations":[{"start":{"line":1078,"column":8},"end":{"line":1078,"column":8}},{"start":{"line":1078,"column":8},"end":{"line":1078,"column":8}}]},"64":{"line":1083,"type":"if","locations":[{"start":{"line":1083,"column":8},"end":{"line":1083,"column":8}},{"start":{"line":1083,"column":8},"end":{"line":1083,"column":8}}]},"65":{"line":1086,"type":"cond-expr","locations":[{"start":{"line":1086,"column":30},"end":{"line":1086,"column":35}},{"start":{"line":1086,"column":38},"end":{"line":1086,"column":42}}]},"66":{"line":1091,"type":"binary-expr","locations":[{"start":{"line":1091,"column":18},"end":{"line":1091,"column":25}},{"start":{"line":1091,"column":29},"end":{"line":1091,"column":31}}]},"67":{"line":1112,"type":"if","locations":[{"start":{"line":1112,"column":12},"end":{"line":1112,"column":12}},{"start":{"line":1112,"column":12},"end":{"line":1112,"column":12}}]},"68":{"line":1112,"type":"binary-expr","locations":[{"start":{"line":1112,"column":16},"end":{"line":1112,"column":17}},{"start":{"line":1112,"column":21},"end":{"line":1112,"column":25}}]},"69":{"line":1113,"type":"if","locations":[{"start":{"line":1113,"column":16},"end":{"line":1113,"column":16}},{"start":{"line":1113,"column":16},"end":{"line":1113,"column":16}}]},"70":{"line":1116,"type":"if","locations":[{"start":{"line":1116,"column":16},"end":{"line":1116,"column":16}},{"start":{"line":1116,"column":16},"end":{"line":1116,"column":16}}]},"71":{"line":1134,"type":"if","locations":[{"start":{"line":1134,"column":8},"end":{"line":1134,"column":8}},{"start":{"line":1134,"column":8},"end":{"line":1134,"column":8}}]},"72":{"line":1134,"type":"binary-expr","locations":[{"start":{"line":1134,"column":12},"end":{"line":1134,"column":25}},{"start":{"line":1134,"column":29},"end":{"line":1134,"column":43}}]},"73":{"line":1139,"type":"if","locations":[{"start":{"line":1139,"column":12},"end":{"line":1139,"column":12}},{"start":{"line":1139,"column":12},"end":{"line":1139,"column":12}}]},"74":{"line":1143,"type":"if","locations":[{"start":{"line":1143,"column":12},"end":{"line":1143,"column":12}},{"start":{"line":1143,"column":12},"end":{"line":1143,"column":12}}]},"75":{"line":1181,"type":"if","locations":[{"start":{"line":1181,"column":8},"end":{"line":1181,"column":8}},{"start":{"line":1181,"column":8},"end":{"line":1181,"column":8}}]},"76":{"line":1182,"type":"cond-expr","locations":[{"start":{"line":1182,"column":38},"end":{"line":1182,"column":50}},{"start":{"line":1182,"column":53},"end":{"line":1182,"column":70}}]},"77":{"line":1185,"type":"if","locations":[{"start":{"line":1185,"column":8},"end":{"line":1185,"column":8}},{"start":{"line":1185,"column":8},"end":{"line":1185,"column":8}}]},"78":{"line":1188,"type":"if","locations":[{"start":{"line":1188,"column":12},"end":{"line":1188,"column":12}},{"start":{"line":1188,"column":12},"end":{"line":1188,"column":12}}]},"79":{"line":1188,"type":"binary-expr","locations":[{"start":{"line":1188,"column":16},"end":{"line":1188,"column":17}},{"start":{"line":1188,"column":21},"end":{"line":1188,"column":34}}]},"80":{"line":1193,"type":"if","locations":[{"start":{"line":1193,"column":8},"end":{"line":1193,"column":8}},{"start":{"line":1193,"column":8},"end":{"line":1193,"column":8}}]},"81":{"line":1194,"type":"if","locations":[{"start":{"line":1194,"column":12},"end":{"line":1194,"column":12}},{"start":{"line":1194,"column":12},"end":{"line":1194,"column":12}}]},"82":{"line":1201,"type":"if","locations":[{"start":{"line":1201,"column":8},"end":{"line":1201,"column":8}},{"start":{"line":1201,"column":8},"end":{"line":1201,"column":8}}]},"83":{"line":1201,"type":"binary-expr","locations":[{"start":{"line":1201,"column":12},"end":{"line":1201,"column":26}},{"start":{"line":1201,"column":30},"end":{"line":1201,"column":39}}]},"84":{"line":1208,"type":"if","locations":[{"start":{"line":1208,"column":8},"end":{"line":1208,"column":8}},{"start":{"line":1208,"column":8},"end":{"line":1208,"column":8}}]},"85":{"line":1274,"type":"if","locations":[{"start":{"line":1274,"column":8},"end":{"line":1274,"column":8}},{"start":{"line":1274,"column":8},"end":{"line":1274,"column":8}}]},"86":{"line":1274,"type":"binary-expr","locations":[{"start":{"line":1274,"column":12},"end":{"line":1274,"column":24}},{"start":{"line":1274,"column":28},"end":{"line":1274,"column":43}}]},"87":{"line":1275,"type":"if","locations":[{"start":{"line":1275,"column":12},"end":{"line":1275,"column":12}},{"start":{"line":1275,"column":12},"end":{"line":1275,"column":12}}]},"88":{"line":1284,"type":"switch","locations":[{"start":{"line":1285,"column":12},"end":{"line":1287,"column":22}},{"start":{"line":1288,"column":12},"end":{"line":1290,"column":22}},{"start":{"line":1291,"column":12},"end":{"line":1298,"column":17}}]},"89":{"line":1289,"type":"binary-expr","locations":[{"start":{"line":1289,"column":38},"end":{"line":1289,"column":45}},{"start":{"line":1289,"column":49},"end":{"line":1289,"column":53}}]},"90":{"line":1292,"type":"if","locations":[{"start":{"line":1292,"column":16},"end":{"line":1292,"column":16}},{"start":{"line":1292,"column":16},"end":{"line":1292,"column":16}}]},"91":{"line":1292,"type":"binary-expr","locations":[{"start":{"line":1292,"column":20},"end":{"line":1292,"column":21}},{"start":{"line":1292,"column":25},"end":{"line":1292,"column":29}}]},"92":{"line":1293,"type":"binary-expr","locations":[{"start":{"line":1293,"column":27},"end":{"line":1293,"column":31}},{"start":{"line":1293,"column":35},"end":{"line":1293,"column":37}}]},"93":{"line":1294,"type":"cond-expr","locations":[{"start":{"line":1294,"column":30},"end":{"line":1294,"column":44}},{"start":{"line":1294,"column":47},"end":{"line":1294,"column":51}}]},"94":{"line":1301,"type":"if","locations":[{"start":{"line":1301,"column":8},"end":{"line":1301,"column":8}},{"start":{"line":1301,"column":8},"end":{"line":1301,"column":8}}]},"95":{"line":1318,"type":"if","locations":[{"start":{"line":1318,"column":8},"end":{"line":1318,"column":8}},{"start":{"line":1318,"column":8},"end":{"line":1318,"column":8}}]},"96":{"line":1319,"type":"cond-expr","locations":[{"start":{"line":1319,"column":33},"end":{"line":1319,"column":47}},{"start":{"line":1319,"column":50},"end":{"line":1319,"column":60}}]},"97":{"line":1323,"type":"if","locations":[{"start":{"line":1323,"column":8},"end":{"line":1323,"column":8}},{"start":{"line":1323,"column":8},"end":{"line":1323,"column":8}}]},"98":{"line":1323,"type":"binary-expr","locations":[{"start":{"line":1323,"column":12},"end":{"line":1323,"column":20}},{"start":{"line":1323,"column":24},"end":{"line":1323,"column":42}}]},"99":{"line":1347,"type":"if","locations":[{"start":{"line":1347,"column":8},"end":{"line":1347,"column":8}},{"start":{"line":1347,"column":8},"end":{"line":1347,"column":8}}]},"100":{"line":1348,"type":"binary-expr","locations":[{"start":{"line":1348,"column":21},"end":{"line":1348,"column":35}},{"start":{"line":1348,"column":40},"end":{"line":1348,"column":64}}]},"101":{"line":1387,"type":"binary-expr","locations":[{"start":{"line":1387,"column":15},"end":{"line":1387,"column":16}},{"start":{"line":1387,"column":20},"end":{"line":1387,"column":24}}]},"102":{"line":1388,"type":"if","locations":[{"start":{"line":1388,"column":8},"end":{"line":1388,"column":8}},{"start":{"line":1388,"column":8},"end":{"line":1388,"column":8}}]},"103":{"line":1390,"type":"binary-expr","locations":[{"start":{"line":1390,"column":29},"end":{"line":1390,"column":30}},{"start":{"line":1390,"column":34},"end":{"line":1390,"column":35}}]},"104":{"line":1402,"type":"if","locations":[{"start":{"line":1402,"column":8},"end":{"line":1402,"column":8}},{"start":{"line":1402,"column":8},"end":{"line":1402,"column":8}}]},"105":{"line":1403,"type":"if","locations":[{"start":{"line":1403,"column":12},"end":{"line":1403,"column":12}},{"start":{"line":1403,"column":12},"end":{"line":1403,"column":12}}]},"106":{"line":1473,"type":"if","locations":[{"start":{"line":1473,"column":8},"end":{"line":1473,"column":8}},{"start":{"line":1473,"column":8},"end":{"line":1473,"column":8}}]},"107":{"line":1473,"type":"binary-expr","locations":[{"start":{"line":1473,"column":12},"end":{"line":1473,"column":16}},{"start":{"line":1473,"column":20},"end":{"line":1473,"column":25}},{"start":{"line":1473,"column":29},"end":{"line":1473,"column":64}}]},"108":{"line":1491,"type":"if","locations":[{"start":{"line":1491,"column":8},"end":{"line":1491,"column":8}},{"start":{"line":1491,"column":8},"end":{"line":1491,"column":8}}]},"109":{"line":1497,"type":"if","locations":[{"start":{"line":1497,"column":8},"end":{"line":1497,"column":8}},{"start":{"line":1497,"column":8},"end":{"line":1497,"column":8}}]},"110":{"line":1504,"type":"if","locations":[{"start":{"line":1504,"column":8},"end":{"line":1504,"column":8}},{"start":{"line":1504,"column":8},"end":{"line":1504,"column":8}}]},"111":{"line":1507,"type":"if","locations":[{"start":{"line":1507,"column":12},"end":{"line":1507,"column":12}},{"start":{"line":1507,"column":12},"end":{"line":1507,"column":12}}]},"112":{"line":1513,"type":"cond-expr","locations":[{"start":{"line":1513,"column":40},"end":{"line":1513,"column":56}},{"start":{"line":1513,"column":59},"end":{"line":1513,"column":60}}]},"113":{"line":1521,"type":"if","locations":[{"start":{"line":1521,"column":8},"end":{"line":1521,"column":8}},{"start":{"line":1521,"column":8},"end":{"line":1521,"column":8}}]},"114":{"line":1535,"type":"if","locations":[{"start":{"line":1535,"column":8},"end":{"line":1535,"column":8}},{"start":{"line":1535,"column":8},"end":{"line":1535,"column":8}}]},"115":{"line":1538,"type":"if","locations":[{"start":{"line":1538,"column":12},"end":{"line":1538,"column":12}},{"start":{"line":1538,"column":12},"end":{"line":1538,"column":12}}]},"116":{"line":1542,"type":"if","locations":[{"start":{"line":1542,"column":12},"end":{"line":1542,"column":12}},{"start":{"line":1542,"column":12},"end":{"line":1542,"column":12}}]},"117":{"line":1567,"type":"if","locations":[{"start":{"line":1567,"column":12},"end":{"line":1567,"column":12}},{"start":{"line":1567,"column":12},"end":{"line":1567,"column":12}}]},"118":{"line":1589,"type":"if","locations":[{"start":{"line":1589,"column":12},"end":{"line":1589,"column":12}},{"start":{"line":1589,"column":12},"end":{"line":1589,"column":12}}]},"119":{"line":1613,"type":"binary-expr","locations":[{"start":{"line":1613,"column":32},"end":{"line":1613,"column":35}},{"start":{"line":1613,"column":39},"end":{"line":1613,"column":65}}]},"120":{"line":1659,"type":"if","locations":[{"start":{"line":1659,"column":8},"end":{"line":1659,"column":8}},{"start":{"line":1659,"column":8},"end":{"line":1659,"column":8}}]},"121":{"line":1661,"type":"if","locations":[{"start":{"line":1661,"column":12},"end":{"line":1661,"column":12}},{"start":{"line":1661,"column":12},"end":{"line":1661,"column":12}}]},"122":{"line":1670,"type":"if","locations":[{"start":{"line":1670,"column":12},"end":{"line":1670,"column":12}},{"start":{"line":1670,"column":12},"end":{"line":1670,"column":12}}]},"123":{"line":1679,"type":"if","locations":[{"start":{"line":1679,"column":16},"end":{"line":1679,"column":16}},{"start":{"line":1679,"column":16},"end":{"line":1679,"column":16}}]},"124":{"line":1680,"type":"binary-expr","locations":[{"start":{"line":1680,"column":24},"end":{"line":1680,"column":28}},{"start":{"line":1680,"column":33},"end":{"line":1680,"column":58}}]},"125":{"line":1680,"type":"cond-expr","locations":[{"start":{"line":1680,"column":53},"end":{"line":1680,"column":54}},{"start":{"line":1680,"column":57},"end":{"line":1680,"column":58}}]},"126":{"line":1681,"type":"binary-expr","locations":[{"start":{"line":1681,"column":24},"end":{"line":1681,"column":33}},{"start":{"line":1681,"column":37},"end":{"line":1681,"column":38}}]},"127":{"line":1684,"type":"cond-expr","locations":[{"start":{"line":1684,"column":35},"end":{"line":1684,"column":47}},{"start":{"line":1684,"column":50},"end":{"line":1684,"column":52}}]},"128":{"line":1686,"type":"cond-expr","locations":[{"start":{"line":1686,"column":42},"end":{"line":1686,"column":43}},{"start":{"line":1686,"column":46},"end":{"line":1686,"column":47}}]},"129":{"line":1694,"type":"cond-expr","locations":[{"start":{"line":1694,"column":36},"end":{"line":1694,"column":40}},{"start":{"line":1694,"column":43},"end":{"line":1694,"column":65}}]},"130":{"line":1702,"type":"if","locations":[{"start":{"line":1702,"column":8},"end":{"line":1702,"column":8}},{"start":{"line":1702,"column":8},"end":{"line":1702,"column":8}}]},"131":{"line":1702,"type":"binary-expr","locations":[{"start":{"line":1702,"column":12},"end":{"line":1702,"column":16}},{"start":{"line":1702,"column":20},"end":{"line":1702,"column":44}},{"start":{"line":1702,"column":49},"end":{"line":1702,"column":77}}]},"132":{"line":1710,"type":"if","locations":[{"start":{"line":1710,"column":8},"end":{"line":1710,"column":8}},{"start":{"line":1710,"column":8},"end":{"line":1710,"column":8}}]},"133":{"line":1716,"type":"if","locations":[{"start":{"line":1716,"column":12},"end":{"line":1716,"column":12}},{"start":{"line":1716,"column":12},"end":{"line":1716,"column":12}}]},"134":{"line":1719,"type":"if","locations":[{"start":{"line":1719,"column":16},"end":{"line":1719,"column":16}},{"start":{"line":1719,"column":16},"end":{"line":1719,"column":16}}]},"135":{"line":1721,"type":"if","locations":[{"start":{"line":1721,"column":23},"end":{"line":1721,"column":23}},{"start":{"line":1721,"column":23},"end":{"line":1721,"column":23}}]},"136":{"line":1728,"type":"if","locations":[{"start":{"line":1728,"column":16},"end":{"line":1728,"column":16}},{"start":{"line":1728,"column":16},"end":{"line":1728,"column":16}}]},"137":{"line":1734,"type":"if","locations":[{"start":{"line":1734,"column":12},"end":{"line":1734,"column":12}},{"start":{"line":1734,"column":12},"end":{"line":1734,"column":12}}]},"138":{"line":1736,"type":"if","locations":[{"start":{"line":1736,"column":19},"end":{"line":1736,"column":19}},{"start":{"line":1736,"column":19},"end":{"line":1736,"column":19}}]},"139":{"line":1736,"type":"binary-expr","locations":[{"start":{"line":1736,"column":24},"end":{"line":1736,"column":29}},{"start":{"line":1736,"column":34},"end":{"line":1736,"column":42}}]},"140":{"line":1742,"type":"if","locations":[{"start":{"line":1742,"column":8},"end":{"line":1742,"column":8}},{"start":{"line":1742,"column":8},"end":{"line":1742,"column":8}}]},"141":{"line":1743,"type":"binary-expr","locations":[{"start":{"line":1743,"column":17},"end":{"line":1743,"column":36}},{"start":{"line":1743,"column":40},"end":{"line":1743,"column":58}}]},"142":{"line":1744,"type":"cond-expr","locations":[{"start":{"line":1744,"column":66},"end":{"line":1744,"column":96}},{"start":{"line":1744,"column":99},"end":{"line":1744,"column":103}}]},"143":{"line":1744,"type":"cond-expr","locations":[{"start":{"line":1744,"column":115},"end":{"line":1744,"column":122}},{"start":{"line":1744,"column":125},"end":{"line":1744,"column":129}}]},"144":{"line":1747,"type":"if","locations":[{"start":{"line":1747,"column":12},"end":{"line":1747,"column":12}},{"start":{"line":1747,"column":12},"end":{"line":1747,"column":12}}]},"145":{"line":1752,"type":"if","locations":[{"start":{"line":1752,"column":8},"end":{"line":1752,"column":8}},{"start":{"line":1752,"column":8},"end":{"line":1752,"column":8}}]},"146":{"line":1753,"type":"binary-expr","locations":[{"start":{"line":1753,"column":36},"end":{"line":1753,"column":57}},{"start":{"line":1753,"column":61},"end":{"line":1753,"column":63}}]},"147":{"line":1754,"type":"binary-expr","locations":[{"start":{"line":1754,"column":42},"end":{"line":1754,"column":69}},{"start":{"line":1754,"column":73},"end":{"line":1754,"column":75}}]},"148":{"line":1758,"type":"cond-expr","locations":[{"start":{"line":1758,"column":32},"end":{"line":1758,"column":36}},{"start":{"line":1758,"column":39},"end":{"line":1758,"column":45}}]},"149":{"line":1792,"type":"binary-expr","locations":[{"start":{"line":1792,"column":21},"end":{"line":1792,"column":25}},{"start":{"line":1792,"column":30},"end":{"line":1792,"column":54}}]},"150":{"line":1795,"type":"if","locations":[{"start":{"line":1795,"column":8},"end":{"line":1795,"column":8}},{"start":{"line":1795,"column":8},"end":{"line":1795,"column":8}}]},"151":{"line":1795,"type":"binary-expr","locations":[{"start":{"line":1795,"column":12},"end":{"line":1795,"column":17}},{"start":{"line":1795,"column":22},"end":{"line":1795,"column":32}}]},"152":{"line":1797,"type":"if","locations":[{"start":{"line":1797,"column":16},"end":{"line":1797,"column":16}},{"start":{"line":1797,"column":16},"end":{"line":1797,"column":16}}]},"153":{"line":1801,"type":"if","locations":[{"start":{"line":1801,"column":12},"end":{"line":1801,"column":12}},{"start":{"line":1801,"column":12},"end":{"line":1801,"column":12}}]},"154":{"line":1809,"type":"cond-expr","locations":[{"start":{"line":1809,"column":44},"end":{"line":1809,"column":52}},{"start":{"line":1809,"column":55},"end":{"line":1809,"column":59}}]},"155":{"line":1810,"type":"cond-expr","locations":[{"start":{"line":1810,"column":30},"end":{"line":1810,"column":38}},{"start":{"line":1810,"column":41},"end":{"line":1810,"column":45}}]},"156":{"line":1816,"type":"if","locations":[{"start":{"line":1816,"column":12},"end":{"line":1816,"column":12}},{"start":{"line":1816,"column":12},"end":{"line":1816,"column":12}}]},"157":{"line":1819,"type":"if","locations":[{"start":{"line":1819,"column":20},"end":{"line":1819,"column":20}},{"start":{"line":1819,"column":20},"end":{"line":1819,"column":20}}]},"158":{"line":1819,"type":"binary-expr","locations":[{"start":{"line":1819,"column":24},"end":{"line":1819,"column":40}},{"start":{"line":1819,"column":44},"end":{"line":1819,"column":58}}]},"159":{"line":1826,"type":"if","locations":[{"start":{"line":1826,"column":8},"end":{"line":1826,"column":8}},{"start":{"line":1826,"column":8},"end":{"line":1826,"column":8}}]},"160":{"line":1830,"type":"cond-expr","locations":[{"start":{"line":1830,"column":36},"end":{"line":1830,"column":59}},{"start":{"line":1830,"column":62},"end":{"line":1830,"column":66}}]},"161":{"line":1832,"type":"if","locations":[{"start":{"line":1832,"column":12},"end":{"line":1832,"column":12}},{"start":{"line":1832,"column":12},"end":{"line":1832,"column":12}}]},"162":{"line":1833,"type":"if","locations":[{"start":{"line":1833,"column":16},"end":{"line":1833,"column":16}},{"start":{"line":1833,"column":16},"end":{"line":1833,"column":16}}]},"163":{"line":1837,"type":"if","locations":[{"start":{"line":1837,"column":24},"end":{"line":1837,"column":24}},{"start":{"line":1837,"column":24},"end":{"line":1837,"column":24}}]},"164":{"line":1847,"type":"if","locations":[{"start":{"line":1847,"column":15},"end":{"line":1847,"column":15}},{"start":{"line":1847,"column":15},"end":{"line":1847,"column":15}}]},"165":{"line":1847,"type":"binary-expr","locations":[{"start":{"line":1847,"column":19},"end":{"line":1847,"column":35}},{"start":{"line":1847,"column":39},"end":{"line":1847,"column":50}}]},"166":{"line":1851,"type":"if","locations":[{"start":{"line":1851,"column":15},"end":{"line":1851,"column":15}},{"start":{"line":1851,"column":15},"end":{"line":1851,"column":15}}]},"167":{"line":1851,"type":"binary-expr","locations":[{"start":{"line":1851,"column":19},"end":{"line":1851,"column":25}},{"start":{"line":1851,"column":31},"end":{"line":1851,"column":41}},{"start":{"line":1851,"column":47},"end":{"line":1851,"column":75}}]},"168":{"line":1861,"type":"if","locations":[{"start":{"line":1861,"column":8},"end":{"line":1861,"column":8}},{"start":{"line":1861,"column":8},"end":{"line":1861,"column":8}}]},"169":{"line":1864,"type":"if","locations":[{"start":{"line":1864,"column":12},"end":{"line":1864,"column":12}},{"start":{"line":1864,"column":12},"end":{"line":1864,"column":12}}]},"170":{"line":1864,"type":"binary-expr","locations":[{"start":{"line":1864,"column":16},"end":{"line":1864,"column":21}},{"start":{"line":1864,"column":25},"end":{"line":1864,"column":37}}]},"171":{"line":1868,"type":"if","locations":[{"start":{"line":1868,"column":19},"end":{"line":1868,"column":19}},{"start":{"line":1868,"column":19},"end":{"line":1868,"column":19}}]},"172":{"line":1868,"type":"binary-expr","locations":[{"start":{"line":1868,"column":23},"end":{"line":1868,"column":28}},{"start":{"line":1868,"column":33},"end":{"line":1868,"column":39}},{"start":{"line":1868,"column":43},"end":{"line":1868,"column":47}},{"start":{"line":1868,"column":52},"end":{"line":1868,"column":75}}]},"173":{"line":1877,"type":"if","locations":[{"start":{"line":1877,"column":8},"end":{"line":1877,"column":8}},{"start":{"line":1877,"column":8},"end":{"line":1877,"column":8}}]},"174":{"line":1989,"type":"if","locations":[{"start":{"line":1989,"column":8},"end":{"line":1989,"column":8}},{"start":{"line":1989,"column":8},"end":{"line":1989,"column":8}}]},"175":{"line":1990,"type":"if","locations":[{"start":{"line":1990,"column":12},"end":{"line":1990,"column":12}},{"start":{"line":1990,"column":12},"end":{"line":1990,"column":12}}]},"176":{"line":1998,"type":"if","locations":[{"start":{"line":1998,"column":16},"end":{"line":1998,"column":16}},{"start":{"line":1998,"column":16},"end":{"line":1998,"column":16}}]},"177":{"line":2001,"type":"binary-expr","locations":[{"start":{"line":2001,"column":52},"end":{"line":2001,"column":53}},{"start":{"line":2001,"column":57},"end":{"line":2001,"column":61}}]},"178":{"line":2026,"type":"if","locations":[{"start":{"line":2026,"column":8},"end":{"line":2026,"column":8}},{"start":{"line":2026,"column":8},"end":{"line":2026,"column":8}}]},"179":{"line":2058,"type":"if","locations":[{"start":{"line":2058,"column":8},"end":{"line":2058,"column":8}},{"start":{"line":2058,"column":8},"end":{"line":2058,"column":8}}]},"180":{"line":2058,"type":"binary-expr","locations":[{"start":{"line":2058,"column":13},"end":{"line":2058,"column":31}},{"start":{"line":2058,"column":35},"end":{"line":2058,"column":38}},{"start":{"line":2058,"column":44},"end":{"line":2058,"column":46}},{"start":{"line":2058,"column":50},"end":{"line":2058,"column":62}}]},"181":{"line":2064,"type":"if","locations":[{"start":{"line":2064,"column":8},"end":{"line":2064,"column":8}},{"start":{"line":2064,"column":8},"end":{"line":2064,"column":8}}]},"182":{"line":2068,"type":"if","locations":[{"start":{"line":2068,"column":12},"end":{"line":2068,"column":12}},{"start":{"line":2068,"column":12},"end":{"line":2068,"column":12}}]},"183":{"line":2074,"type":"if","locations":[{"start":{"line":2074,"column":8},"end":{"line":2074,"column":8}},{"start":{"line":2074,"column":8},"end":{"line":2074,"column":8}}]},"184":{"line":2101,"type":"if","locations":[{"start":{"line":2101,"column":8},"end":{"line":2101,"column":8}},{"start":{"line":2101,"column":8},"end":{"line":2101,"column":8}}]},"185":{"line":2102,"type":"if","locations":[{"start":{"line":2102,"column":12},"end":{"line":2102,"column":12}},{"start":{"line":2102,"column":12},"end":{"line":2102,"column":12}}]},"186":{"line":2110,"type":"if","locations":[{"start":{"line":2110,"column":12},"end":{"line":2110,"column":12}},{"start":{"line":2110,"column":12},"end":{"line":2110,"column":12}}]},"187":{"line":2110,"type":"binary-expr","locations":[{"start":{"line":2110,"column":17},"end":{"line":2110,"column":46}},{"start":{"line":2110,"column":51},"end":{"line":2110,"column":54}},{"start":{"line":2110,"column":58},"end":{"line":2110,"column":70}},{"start":{"line":2110,"column":77},"end":{"line":2110,"column":79}},{"start":{"line":2110,"column":83},"end":{"line":2110,"column":95}}]},"188":{"line":2159,"type":"if","locations":[{"start":{"line":2159,"column":8},"end":{"line":2159,"column":8}},{"start":{"line":2159,"column":8},"end":{"line":2159,"column":8}}]},"189":{"line":2159,"type":"binary-expr","locations":[{"start":{"line":2159,"column":12},"end":{"line":2159,"column":24}},{"start":{"line":2159,"column":28},"end":{"line":2159,"column":41}}]},"190":{"line":2164,"type":"if","locations":[{"start":{"line":2164,"column":12},"end":{"line":2164,"column":12}},{"start":{"line":2164,"column":12},"end":{"line":2164,"column":12}}]},"191":{"line":2166,"type":"if","locations":[{"start":{"line":2166,"column":19},"end":{"line":2166,"column":19}},{"start":{"line":2166,"column":19},"end":{"line":2166,"column":19}}]},"192":{"line":2173,"type":"cond-expr","locations":[{"start":{"line":2173,"column":65},"end":{"line":2173,"column":66}},{"start":{"line":2173,"column":69},"end":{"line":2173,"column":70}}]},"193":{"line":2176,"type":"if","locations":[{"start":{"line":2176,"column":8},"end":{"line":2176,"column":8}},{"start":{"line":2176,"column":8},"end":{"line":2176,"column":8}}]},"194":{"line":2177,"type":"binary-expr","locations":[{"start":{"line":2177,"column":17},"end":{"line":2177,"column":21}},{"start":{"line":2177,"column":25},"end":{"line":2177,"column":34}}]},"195":{"line":2180,"type":"if","locations":[{"start":{"line":2180,"column":8},"end":{"line":2180,"column":8}},{"start":{"line":2180,"column":8},"end":{"line":2180,"column":8}}]},"196":{"line":2186,"type":"if","locations":[{"start":{"line":2186,"column":8},"end":{"line":2186,"column":8}},{"start":{"line":2186,"column":8},"end":{"line":2186,"column":8}}]},"197":{"line":2189,"type":"if","locations":[{"start":{"line":2189,"column":12},"end":{"line":2189,"column":12}},{"start":{"line":2189,"column":12},"end":{"line":2189,"column":12}}]},"198":{"line":2189,"type":"binary-expr","locations":[{"start":{"line":2189,"column":16},"end":{"line":2189,"column":19}},{"start":{"line":2189,"column":23},"end":{"line":2189,"column":26}}]},"199":{"line":2195,"type":"if","locations":[{"start":{"line":2195,"column":8},"end":{"line":2195,"column":8}},{"start":{"line":2195,"column":8},"end":{"line":2195,"column":8}}]},"200":{"line":2195,"type":"binary-expr","locations":[{"start":{"line":2195,"column":13},"end":{"line":2195,"column":31}},{"start":{"line":2195,"column":36},"end":{"line":2195,"column":39}},{"start":{"line":2195,"column":43},"end":{"line":2195,"column":55}},{"start":{"line":2195,"column":62},"end":{"line":2195,"column":64}},{"start":{"line":2195,"column":68},"end":{"line":2195,"column":80}}]},"201":{"line":2196,"type":"binary-expr","locations":[{"start":{"line":2196,"column":35},"end":{"line":2196,"column":37}},{"start":{"line":2196,"column":41},"end":{"line":2196,"column":42}}]},"202":{"line":2202,"type":"if","locations":[{"start":{"line":2202,"column":8},"end":{"line":2202,"column":8}},{"start":{"line":2202,"column":8},"end":{"line":2202,"column":8}}]},"203":{"line":2203,"type":"if","locations":[{"start":{"line":2203,"column":12},"end":{"line":2203,"column":12}},{"start":{"line":2203,"column":12},"end":{"line":2203,"column":12}}]},"204":{"line":2211,"type":"if","locations":[{"start":{"line":2211,"column":12},"end":{"line":2211,"column":12}},{"start":{"line":2211,"column":12},"end":{"line":2211,"column":12}}]},"205":{"line":2218,"type":"cond-expr","locations":[{"start":{"line":2218,"column":32},"end":{"line":2218,"column":36}},{"start":{"line":2218,"column":39},"end":{"line":2218,"column":42}}]},"206":{"line":2225,"type":"if","locations":[{"start":{"line":2225,"column":8},"end":{"line":2225,"column":8}},{"start":{"line":2225,"column":8},"end":{"line":2225,"column":8}}]},"207":{"line":2228,"type":"if","locations":[{"start":{"line":2228,"column":12},"end":{"line":2228,"column":12}},{"start":{"line":2228,"column":12},"end":{"line":2228,"column":12}}]},"208":{"line":2249,"type":"if","locations":[{"start":{"line":2249,"column":8},"end":{"line":2249,"column":8}},{"start":{"line":2249,"column":8},"end":{"line":2249,"column":8}}]},"209":{"line":2251,"type":"cond-expr","locations":[{"start":{"line":2251,"column":27},"end":{"line":2251,"column":46}},{"start":{"line":2251,"column":49},"end":{"line":2251,"column":53}}]},"210":{"line":2254,"type":"binary-expr","locations":[{"start":{"line":2254,"column":15},"end":{"line":2254,"column":22}},{"start":{"line":2254,"column":26},"end":{"line":2254,"column":30}}]},"211":{"line":2275,"type":"switch","locations":[{"start":{"line":2276,"column":12},"end":{"line":2277,"column":57}},{"start":{"line":2278,"column":12},"end":{"line":2278,"column":25}},{"start":{"line":2283,"column":12},"end":{"line":2285,"column":22}},{"start":{"line":2286,"column":12},"end":{"line":2287,"column":43}}]},"212":{"line":2321,"type":"binary-expr","locations":[{"start":{"line":2321,"column":23},"end":{"line":2321,"column":43}},{"start":{"line":2321,"column":47},"end":{"line":2321,"column":55}}]}},"code":["(function () { YUI.add('event-custom-base', function (Y, NAME) {","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," */","","Y.Env.evt = {"," handles: {},"," plugins: {}","};","","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," * @submodule event-custom-base"," */","","/**"," * Allows for the insertion of methods that are executed before or after"," * a specified method"," * @class Do"," * @static"," */","","var DO_BEFORE = 0,"," DO_AFTER = 1,","","DO = {",""," /**"," * Cache of objects touched by the utility"," * @property objs"," * @static"," * @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object"," * replaces the role of this property, but is considered to be private, and"," * is only mentioned to provide a migration path."," *"," * If you have a use case which warrants migration to the _yuiaop property,"," * please file a ticket to let us know what it's used for and we can see if"," * we need to expose hooks for that functionality more formally."," */"," objs: null,",""," /**"," * <p>Execute the supplied method before the specified function. Wrapping"," * function may optionally return an instance of the following classes to"," * further alter runtime behavior:</p>"," * <dl>"," * <dt></code>Y.Do.Halt(message, returnValue)</code></dt>"," * <dd>Immediatly stop execution and return"," * <code>returnValue</code>. No other wrapping functions will be"," * executed.</dd>"," * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>"," * <dd>Replace the arguments that the original function will be"," * called with.</dd>"," * <dt></code>Y.Do.Prevent(message)</code></dt>"," * <dd>Don't execute the wrapped function. Other before phase"," * wrappers will be executed.</dd>"," * </dl>"," *"," * @method before"," * @param fn {Function} the function to execute"," * @param obj the object hosting the method to displace"," * @param sFn {string} the name of the method to displace"," * @param c The execution context for fn"," * @param arg* {mixed} 0..n additional arguments to supply to the subscriber"," * when the event fires."," * @return {string} handle for the subscription"," * @static"," */"," before: function(fn, obj, sFn, c) {"," var f = fn, a;"," if (c) {"," a = [fn, c].concat(Y.Array(arguments, 4, true));"," f = Y.rbind.apply(Y, a);"," }",""," return this._inject(DO_BEFORE, f, obj, sFn);"," },",""," /**"," * <p>Execute the supplied method after the specified function. Wrapping"," * function may optionally return an instance of the following classes to"," * further alter runtime behavior:</p>"," * <dl>"," * <dt></code>Y.Do.Halt(message, returnValue)</code></dt>"," * <dd>Immediatly stop execution and return"," * <code>returnValue</code>. No other wrapping functions will be"," * executed.</dd>"," * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>"," * <dd>Return <code>returnValue</code> instead of the wrapped"," * method's original return value. This can be further altered by"," * other after phase wrappers.</dd>"," * </dl>"," *"," * <p>The static properties <code>Y.Do.originalRetVal</code> and"," * <code>Y.Do.currentRetVal</code> will be populated for reference.</p>"," *"," * @method after"," * @param fn {Function} the function to execute"," * @param obj the object hosting the method to displace"," * @param sFn {string} the name of the method to displace"," * @param c The execution context for fn"," * @param arg* {mixed} 0..n additional arguments to supply to the subscriber"," * @return {string} handle for the subscription"," * @static"," */"," after: function(fn, obj, sFn, c) {"," var f = fn, a;"," if (c) {"," a = [fn, c].concat(Y.Array(arguments, 4, true));"," f = Y.rbind.apply(Y, a);"," }",""," return this._inject(DO_AFTER, f, obj, sFn);"," },",""," /**"," * Execute the supplied method before or after the specified function."," * Used by <code>before</code> and <code>after</code>."," *"," * @method _inject"," * @param when {string} before or after"," * @param fn {Function} the function to execute"," * @param obj the object hosting the method to displace"," * @param sFn {string} the name of the method to displace"," * @param c The execution context for fn"," * @return {string} handle for the subscription"," * @private"," * @static"," */"," _inject: function(when, fn, obj, sFn) {"," // object id"," var id = Y.stamp(obj), o, sid;",""," if (!obj._yuiaop) {"," // create a map entry for the obj if it doesn't exist, to hold overridden methods"," obj._yuiaop = {};"," }",""," o = obj._yuiaop;",""," if (!o[sFn]) {"," // create a map entry for the method if it doesn't exist"," o[sFn] = new Y.Do.Method(obj, sFn);",""," // re-route the method to our wrapper"," obj[sFn] = function() {"," return o[sFn].exec.apply(o[sFn], arguments);"," };"," }",""," // subscriber id"," sid = id + Y.stamp(fn) + sFn;",""," // register the callback"," o[sFn].register(sid, fn, when);",""," return new Y.EventHandle(o[sFn], sid);"," },",""," /**"," * Detach a before or after subscription."," *"," * @method detach"," * @param handle {string} the subscription handle"," * @static"," */"," detach: function(handle) {"," if (handle.detach) {"," handle.detach();"," }"," }","};","","Y.Do = DO;","","//////////////////////////////////////////////////////////////////////////","","/**"," * Contains the return value from the wrapped method, accessible"," * by 'after' event listeners."," *"," * @property originalRetVal"," * @static"," * @since 3.2.0"," */","","/**"," * Contains the current state of the return value, consumable by"," * 'after' event listeners, and updated if an after subscriber"," * changes the return value generated by the wrapped function."," *"," * @property currentRetVal"," * @static"," * @since 3.2.0"," */","","//////////////////////////////////////////////////////////////////////////","","/**"," * Wrapper for a displaced method with aop enabled"," * @class Do.Method"," * @constructor"," * @param obj The object to operate on"," * @param sFn The name of the method to displace"," */","DO.Method = function(obj, sFn) {"," this.obj = obj;"," this.methodName = sFn;"," this.method = obj[sFn];"," this.before = {};"," this.after = {};","};","","/**"," * Register a aop subscriber"," * @method register"," * @param sid {string} the subscriber id"," * @param fn {Function} the function to execute"," * @param when {string} when to execute the function"," */","DO.Method.prototype.register = function (sid, fn, when) {"," if (when) {"," this.after[sid] = fn;"," } else {"," this.before[sid] = fn;"," }","};","","/**"," * Unregister a aop subscriber"," * @method delete"," * @param sid {string} the subscriber id"," * @param fn {Function} the function to execute"," * @param when {string} when to execute the function"," */","DO.Method.prototype._delete = function (sid) {"," delete this.before[sid];"," delete this.after[sid];","};","","/**"," * <p>Execute the wrapped method. All arguments are passed into the wrapping"," * functions. If any of the before wrappers return an instance of"," * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped"," * function nor any after phase subscribers will be executed.</p>"," *"," * <p>The return value will be the return value of the wrapped function or one"," * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or"," * <code>Y.Do.AlterReturn</code>."," *"," * @method exec"," * @param arg* {any} Arguments are passed to the wrapping and wrapped functions"," * @return {any} Return value of wrapped function unless overwritten (see above)"," */","DO.Method.prototype.exec = function () {",""," var args = Y.Array(arguments, 0, true),"," i, ret, newRet,"," bf = this.before,"," af = this.after,"," prevented = false;",""," // execute before"," for (i in bf) {"," if (bf.hasOwnProperty(i)) {"," ret = bf[i].apply(this.obj, args);"," if (ret) {"," switch (ret.constructor) {"," case DO.Halt:"," return ret.retVal;"," case DO.AlterArgs:"," args = ret.newArgs;"," break;"," case DO.Prevent:"," prevented = true;"," break;"," default:"," }"," }"," }"," }",""," // execute method"," if (!prevented) {"," ret = this.method.apply(this.obj, args);"," }",""," DO.originalRetVal = ret;"," DO.currentRetVal = ret;",""," // execute after methods."," for (i in af) {"," if (af.hasOwnProperty(i)) {"," newRet = af[i].apply(this.obj, args);"," // Stop processing if a Halt object is returned"," if (newRet && newRet.constructor === DO.Halt) {"," return newRet.retVal;"," // Check for a new return value"," } else if (newRet && newRet.constructor === DO.AlterReturn) {"," ret = newRet.newRetVal;"," // Update the static retval state"," DO.currentRetVal = ret;"," }"," }"," }",""," return ret;","};","","//////////////////////////////////////////////////////////////////////////","","/**"," * Return an AlterArgs object when you want to change the arguments that"," * were passed into the function. Useful for Do.before subscribers. An"," * example would be a service that scrubs out illegal characters prior to"," * executing the core business logic."," * @class Do.AlterArgs"," * @constructor"," * @param msg {String} (optional) Explanation of the altered return value"," * @param newArgs {Array} Call parameters to be used for the original method"," * instead of the arguments originally passed in."," */","DO.AlterArgs = function(msg, newArgs) {"," this.msg = msg;"," this.newArgs = newArgs;","};","","/**"," * Return an AlterReturn object when you want to change the result returned"," * from the core method to the caller. Useful for Do.after subscribers."," * @class Do.AlterReturn"," * @constructor"," * @param msg {String} (optional) Explanation of the altered return value"," * @param newRetVal {any} Return value passed to code that invoked the wrapped"," * function."," */","DO.AlterReturn = function(msg, newRetVal) {"," this.msg = msg;"," this.newRetVal = newRetVal;","};","","/**"," * Return a Halt object when you want to terminate the execution"," * of all subsequent subscribers as well as the wrapped method"," * if it has not exectued yet. Useful for Do.before subscribers."," * @class Do.Halt"," * @constructor"," * @param msg {String} (optional) Explanation of why the termination was done"," * @param retVal {any} Return value passed to code that invoked the wrapped"," * function."," */","DO.Halt = function(msg, retVal) {"," this.msg = msg;"," this.retVal = retVal;","};","","/**"," * Return a Prevent object when you want to prevent the wrapped function"," * from executing, but want the remaining listeners to execute. Useful"," * for Do.before subscribers."," * @class Do.Prevent"," * @constructor"," * @param msg {String} (optional) Explanation of why the termination was done"," */","DO.Prevent = function(msg) {"," this.msg = msg;","};","","/**"," * Return an Error object when you want to terminate the execution"," * of all subsequent method calls."," * @class Do.Error"," * @constructor"," * @param msg {String} (optional) Explanation of the altered return value"," * @param retVal {any} Return value passed to code that invoked the wrapped"," * function."," * @deprecated use Y.Do.Halt or Y.Do.Prevent"," */","DO.Error = DO.Halt;","","","//////////////////////////////////////////////////////////////////////////","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," * @submodule event-custom-base"," */","","","// var onsubscribeType = \"_event:onsub\",","var YArray = Y.Array,",""," AFTER = 'after',"," CONFIGS = ["," 'broadcast',"," 'monitored',"," 'bubbles',"," 'context',"," 'contextFn',"," 'currentTarget',"," 'defaultFn',"," 'defaultTargetOnly',"," 'details',"," 'emitFacade',"," 'fireOnce',"," 'async',"," 'host',"," 'preventable',"," 'preventedFn',"," 'queuable',"," 'silent',"," 'stoppedFn',"," 'target',"," 'type'"," ],",""," CONFIGS_HASH = YArray.hash(CONFIGS),",""," nativeSlice = Array.prototype.slice,",""," YUI3_SIGNATURE = 9,"," YUI_LOG = 'yui:log',",""," mixConfigs = function(r, s, ov) {"," var p;",""," for (p in s) {"," if (CONFIGS_HASH[p] && (ov || !(p in r))) {"," r[p] = s[p];"," }"," }",""," return r;"," };","","/**"," * The CustomEvent class lets you define events for your application"," * that can be subscribed to by one or more independent component."," *"," * @param {String} type The type of event, which is passed to the callback"," * when the event fires."," * @param {object} defaults configuration object."," * @class CustomEvent"," * @constructor"," */",""," /**"," * The type of event, returned to subscribers when the event fires"," * @property type"," * @type string"," */","","/**"," * By default all custom events are logged in the debug build, set silent"," * to true to disable debug outpu for this event."," * @property silent"," * @type boolean"," */","","Y.CustomEvent = function(type, defaults) {",""," this._kds = Y.CustomEvent.keepDeprecatedSubs;",""," this.id = Y.guid();",""," this.type = type;"," this.silent = this.logSystem = (type === YUI_LOG);",""," if (this._kds) {"," /**"," * The subscribers to this event"," * @property subscribers"," * @type Subscriber {}"," * @deprecated"," */",""," /**"," * 'After' subscribers"," * @property afters"," * @type Subscriber {}"," * @deprecated"," */"," this.subscribers = {};"," this.afters = {};"," }",""," if (defaults) {"," mixConfigs(this, defaults, true);"," }","};","","/**"," * Static flag to enable population of the <a href=\"#property_subscribers\">`subscribers`</a>"," * and <a href=\"#property_subscribers\">`afters`</a> properties held on a `CustomEvent` instance."," *"," * These properties were changed to private properties (`_subscribers` and `_afters`), and"," * converted from objects to arrays for performance reasons."," *"," * Setting this property to true will populate the deprecated `subscribers` and `afters`"," * properties for people who may be using them (which is expected to be rare). There will"," * be a performance hit, compared to the new array based implementation."," *"," * If you are using these deprecated properties for a use case which the public API"," * does not support, please file an enhancement request, and we can provide an alternate"," * public implementation which doesn't have the performance cost required to maintiain the"," * properties as objects."," *"," * @property keepDeprecatedSubs"," * @static"," * @for CustomEvent"," * @type boolean"," * @default false"," * @deprecated"," */","Y.CustomEvent.keepDeprecatedSubs = false;","","Y.CustomEvent.mixConfigs = mixConfigs;","","Y.CustomEvent.prototype = {",""," constructor: Y.CustomEvent,",""," /**"," * Monitor when an event is attached or detached."," *"," * @property monitored"," * @type boolean"," */",""," /**"," * If 0, this event does not broadcast. If 1, the YUI instance is notified"," * every time this event fires. If 2, the YUI instance and the YUI global"," * (if event is enabled on the global) are notified every time this event"," * fires."," * @property broadcast"," * @type int"," */",""," /**"," * Specifies whether this event should be queued when the host is actively"," * processing an event. This will effect exectution order of the callbacks"," * for the various events."," * @property queuable"," * @type boolean"," * @default false"," */",""," /**"," * This event has fired if true"," *"," * @property fired"," * @type boolean"," * @default false;"," */",""," /**"," * An array containing the arguments the custom event"," * was last fired with."," * @property firedWith"," * @type Array"," */",""," /**"," * This event should only fire one time if true, and if"," * it has fired, any new subscribers should be notified"," * immediately."," *"," * @property fireOnce"," * @type boolean"," * @default false;"," */",""," /**"," * fireOnce listeners will fire syncronously unless async"," * is set to true"," * @property async"," * @type boolean"," * @default false"," */",""," /**"," * Flag for stopPropagation that is modified during fire()"," * 1 means to stop propagation to bubble targets. 2 means"," * to also stop additional subscribers on this target."," * @property stopped"," * @type int"," */",""," /**"," * Flag for preventDefault that is modified during fire()."," * if it is not 0, the default behavior for this event"," * @property prevented"," * @type int"," */",""," /**"," * Specifies the host for this custom event. This is used"," * to enable event bubbling"," * @property host"," * @type EventTarget"," */",""," /**"," * The default function to execute after event listeners"," * have fire, but only if the default action was not"," * prevented."," * @property defaultFn"," * @type Function"," */",""," /**"," * The function to execute if a subscriber calls"," * stopPropagation or stopImmediatePropagation"," * @property stoppedFn"," * @type Function"," */",""," /**"," * The function to execute if a subscriber calls"," * preventDefault"," * @property preventedFn"," * @type Function"," */",""," /**"," * The subscribers to this event"," * @property _subscribers"," * @type Subscriber []"," * @private"," */",""," /**"," * 'After' subscribers"," * @property _afters"," * @type Subscriber []"," * @private"," */",""," /**"," * If set to true, the custom event will deliver an EventFacade object"," * that is similar to a DOM event object."," * @property emitFacade"," * @type boolean"," * @default false"," */",""," /**"," * Supports multiple options for listener signatures in order to"," * port YUI 2 apps."," * @property signature"," * @type int"," * @default 9"," */"," signature : YUI3_SIGNATURE,",""," /**"," * The context the the event will fire from by default. Defaults to the YUI"," * instance."," * @property context"," * @type object"," */"," context : Y,",""," /**"," * Specifies whether or not this event's default function"," * can be cancelled by a subscriber by executing preventDefault()"," * on the event facade"," * @property preventable"," * @type boolean"," * @default true"," */"," preventable : true,",""," /**"," * Specifies whether or not a subscriber can stop the event propagation"," * via stopPropagation(), stopImmediatePropagation(), or halt()"," *"," * Events can only bubble if emitFacade is true."," *"," * @property bubbles"," * @type boolean"," * @default true"," */"," bubbles : true,",""," /**"," * Returns the number of subscribers for this event as the sum of the on()"," * subscribers and after() subscribers."," *"," * @method hasSubs"," * @return Number"," */"," hasSubs: function(when) {"," var s = 0,"," a = 0,"," subs = this._subscribers,"," afters = this._afters,"," sib = this.sibling;",""," if (subs) {"," s = subs.length;"," }",""," if (afters) {"," a = afters.length;"," }",""," if (sib) {"," subs = sib._subscribers;"," afters = sib._afters;",""," if (subs) {"," s += subs.length;"," }",""," if (afters) {"," a += afters.length;"," }"," }",""," if (when) {"," return (when === 'after') ? a : s;"," }",""," return (s + a);"," },",""," /**"," * Monitor the event state for the subscribed event. The first parameter"," * is what should be monitored, the rest are the normal parameters when"," * subscribing to an event."," * @method monitor"," * @param what {string} what to monitor ('detach', 'attach', 'publish')."," * @return {EventHandle} return value from the monitor event subscription."," */"," monitor: function(what) {"," this.monitored = true;"," var type = this.id + '|' + this.type + '_' + what,"," args = nativeSlice.call(arguments, 0);"," args[0] = type;"," return this.host.on.apply(this.host, args);"," },",""," /**"," * Get all of the subscribers to this event and any sibling event"," * @method getSubs"," * @return {Array} first item is the on subscribers, second the after."," */"," getSubs: function() {",""," var sibling = this.sibling,"," subs = this._subscribers,"," afters = this._afters,"," siblingSubs,"," siblingAfters;",""," if (sibling) {"," siblingSubs = sibling._subscribers;"," siblingAfters = sibling._afters;"," }",""," if (siblingSubs) {"," if (subs) {"," subs = subs.concat(siblingSubs);"," } else {"," subs = siblingSubs.concat();"," }"," } else {"," if (subs) {"," subs = subs.concat();"," } else {"," subs = [];"," }"," }",""," if (siblingAfters) {"," if (afters) {"," afters = afters.concat(siblingAfters);"," } else {"," afters = siblingAfters.concat();"," }"," } else {"," if (afters) {"," afters = afters.concat();"," } else {"," afters = [];"," }"," }",""," return [subs, afters];"," },",""," /**"," * Apply configuration properties. Only applies the CONFIG whitelist"," * @method applyConfig"," * @param o hash of properties to apply."," * @param force {boolean} if true, properties that exist on the event"," * will be overwritten."," */"," applyConfig: function(o, force) {"," mixConfigs(this, o, force);"," },",""," /**"," * Create the Subscription for subscribing function, context, and bound"," * arguments. If this is a fireOnce event, the subscriber is immediately"," * notified."," *"," * @method _on"," * @param fn {Function} Subscription callback"," * @param [context] {Object} Override `this` in the callback"," * @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()"," * @param [when] {String} \"after\" to slot into after subscribers"," * @return {EventHandle}"," * @protected"," */"," _on: function(fn, context, args, when) {","",""," var s = new Y.Subscriber(fn, context, args, when),"," firedWith;",""," if (this.fireOnce && this.fired) {",""," firedWith = this.firedWith;",""," // It's a little ugly for this to know about facades,"," // but given the current breakup, not much choice without"," // moving a whole lot of stuff around."," if (this.emitFacade && this._addFacadeToArgs) {"," this._addFacadeToArgs(firedWith);"," }",""," if (this.async) {"," setTimeout(Y.bind(this._notify, this, s, firedWith), 0);"," } else {"," this._notify(s, firedWith);"," }"," }",""," if (when === AFTER) {"," if (!this._afters) {"," this._afters = [];"," }"," this._afters.push(s);"," } else {"," if (!this._subscribers) {"," this._subscribers = [];"," }"," this._subscribers.push(s);"," }",""," if (this._kds) {"," if (when === AFTER) {"," this.afters[s.id] = s;"," } else {"," this.subscribers[s.id] = s;"," }"," }",""," return new Y.EventHandle(this, s);"," },",""," /**"," * Listen for this event"," * @method subscribe"," * @param {Function} fn The function to execute."," * @return {EventHandle} Unsubscribe handle."," * @deprecated use on."," */"," subscribe: function(fn, context) {"," var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;"," return this._on(fn, context, a, true);"," },",""," /**"," * Listen for this event"," * @method on"," * @param {Function} fn The function to execute."," * @param {object} context optional execution context."," * @param {mixed} arg* 0..n additional arguments to supply to the subscriber"," * when the event fires."," * @return {EventHandle} An object with a detach method to detch the handler(s)."," */"," on: function(fn, context) {"," var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;",""," if (this.monitored && this.host) {"," this.host._monitor('attach', this, {"," args: arguments"," });"," }"," return this._on(fn, context, a, true);"," },",""," /**"," * Listen for this event after the normal subscribers have been notified and"," * the default behavior has been applied. If a normal subscriber prevents the"," * default behavior, it also prevents after listeners from firing."," * @method after"," * @param {Function} fn The function to execute."," * @param {object} context optional execution context."," * @param {mixed} arg* 0..n additional arguments to supply to the subscriber"," * when the event fires."," * @return {EventHandle} handle Unsubscribe handle."," */"," after: function(fn, context) {"," var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;"," return this._on(fn, context, a, AFTER);"," },",""," /**"," * Detach listeners."," * @method detach"," * @param {Function} fn The subscribed function to remove, if not supplied"," * all will be removed."," * @param {Object} context The context object passed to subscribe."," * @return {int} returns the number of subscribers unsubscribed."," */"," detach: function(fn, context) {"," // unsubscribe handle"," if (fn && fn.detach) {"," return fn.detach();"," }",""," var i, s,"," found = 0,"," subs = this._subscribers,"," afters = this._afters;",""," if (subs) {"," for (i = subs.length; i >= 0; i--) {"," s = subs[i];"," if (s && (!fn || fn === s.fn)) {"," this._delete(s, subs, i);"," found++;"," }"," }"," }",""," if (afters) {"," for (i = afters.length; i >= 0; i--) {"," s = afters[i];"," if (s && (!fn || fn === s.fn)) {"," this._delete(s, afters, i);"," found++;"," }"," }"," }",""," return found;"," },",""," /**"," * Detach listeners."," * @method unsubscribe"," * @param {Function} fn The subscribed function to remove, if not supplied"," * all will be removed."," * @param {Object} context The context object passed to subscribe."," * @return {int|undefined} returns the number of subscribers unsubscribed."," * @deprecated use detach."," */"," unsubscribe: function() {"," return this.detach.apply(this, arguments);"," },",""," /**"," * Notify a single subscriber"," * @method _notify"," * @param {Subscriber} s the subscriber."," * @param {Array} args the arguments array to apply to the listener."," * @protected"," */"," _notify: function(s, args, ef) {","",""," var ret;",""," ret = s.notify(args, this);",""," if (false === ret || this.stopped > 1) {"," return false;"," }",""," return true;"," },",""," /**"," * Logger abstraction to centralize the application of the silent flag"," * @method log"," * @param {string} msg message to log."," * @param {string} cat log category."," */"," log: function(msg, cat) {"," },",""," /**"," * Notifies the subscribers. The callback functions will be executed"," * from the context specified when the event was created, and with the"," * following parameters:"," * <ul>"," * <li>The type of event</li>"," * <li>All of the arguments fire() was executed with as an array</li>"," * <li>The custom object (if any) that was passed into the subscribe()"," * method</li>"," * </ul>"," * @method fire"," * @param {Object*} arguments an arbitrary set of parameters to pass to"," * the handler."," * @return {boolean} false if one of the subscribers returned false,"," * true otherwise."," *"," */"," fire: function() {",""," // push is the fastest way to go from arguments to arrays"," // for most browsers currently"," // http://jsperf.com/push-vs-concat-vs-slice/2",""," var args = [];"," args.push.apply(args, arguments);",""," return this._fire(args);"," },",""," /**"," * Private internal implementation for `fire`, which is can be used directly by"," * `EventTarget` and other event module classes which have already converted from"," * an `arguments` list to an array, to avoid the repeated overhead."," *"," * @method _fire"," * @private"," * @param {Array} args The array of arguments passed to be passed to handlers."," * @return {boolean} false if one of the subscribers returned false, true otherwise."," */"," _fire: function(args) {",""," if (this.fireOnce && this.fired) {"," return true;"," } else {",""," // this doesn't happen if the event isn't published"," // this.host._monitor('fire', this.type, args);",""," this.fired = true;",""," if (this.fireOnce) {"," this.firedWith = args;"," }",""," if (this.emitFacade) {"," return this.fireComplex(args);"," } else {"," return this.fireSimple(args);"," }"," }"," },",""," /**"," * Set up for notifying subscribers of non-emitFacade events."," *"," * @method fireSimple"," * @param args {Array} Arguments passed to fire()"," * @return Boolean false if a subscriber returned false"," * @protected"," */"," fireSimple: function(args) {"," this.stopped = 0;"," this.prevented = 0;"," if (this.hasSubs()) {"," var subs = this.getSubs();"," this._procSubs(subs[0], args);"," this._procSubs(subs[1], args);"," }"," if (this.broadcast) {"," this._broadcast(args);"," }"," return this.stopped ? false : true;"," },",""," // Requires the event-custom-complex module for full funcitonality."," fireComplex: function(args) {"," args[0] = args[0] || {};"," return this.fireSimple(args);"," },",""," /**"," * Notifies a list of subscribers."," *"," * @method _procSubs"," * @param subs {Array} List of subscribers"," * @param args {Array} Arguments passed to fire()"," * @param ef {}"," * @return Boolean false if a subscriber returns false or stops the event"," * propagation via e.stopPropagation(),"," * e.stopImmediatePropagation(), or e.halt()"," * @private"," */"," _procSubs: function(subs, args, ef) {"," var s, i, l;",""," for (i = 0, l = subs.length; i < l; i++) {"," s = subs[i];"," if (s && s.fn) {"," if (false === this._notify(s, args, ef)) {"," this.stopped = 2;"," }"," if (this.stopped === 2) {"," return false;"," }"," }"," }",""," return true;"," },",""," /**"," * Notifies the YUI instance if the event is configured with broadcast = 1,"," * and both the YUI instance and Y.Global if configured with broadcast = 2."," *"," * @method _broadcast"," * @param args {Array} Arguments sent to fire()"," * @private"," */"," _broadcast: function(args) {"," if (!this.stopped && this.broadcast) {",""," var a = args.concat();"," a.unshift(this.type);",""," if (this.host !== Y) {"," Y.fire.apply(Y, a);"," }",""," if (this.broadcast === 2) {"," Y.Global.fire.apply(Y.Global, a);"," }"," }"," },",""," /**"," * Removes all listeners"," * @method unsubscribeAll"," * @return {int} The number of listeners unsubscribed."," * @deprecated use detachAll."," */"," unsubscribeAll: function() {"," return this.detachAll.apply(this, arguments);"," },",""," /**"," * Removes all listeners"," * @method detachAll"," * @return {int} The number of listeners unsubscribed."," */"," detachAll: function() {"," return this.detach();"," },",""," /**"," * Deletes the subscriber from the internal store of on() and after()"," * subscribers."," *"," * @method _delete"," * @param s subscriber object."," * @param subs (optional) on or after subscriber array"," * @param index (optional) The index found."," * @private"," */"," _delete: function(s, subs, i) {"," var when = s._when;",""," if (!subs) {"," subs = (when === AFTER) ? this._afters : this._subscribers;"," }",""," if (subs) {"," i = YArray.indexOf(subs, s, 0);",""," if (s && subs[i] === s) {"," subs.splice(i, 1);"," }"," }",""," if (this._kds) {"," if (when === AFTER) {"," delete this.afters[s.id];"," } else {"," delete this.subscribers[s.id];"," }"," }",""," if (this.monitored && this.host) {"," this.host._monitor('detach', this, {"," ce: this,"," sub: s"," });"," }",""," if (s) {"," s.deleted = true;"," }"," }","};","/**"," * Stores the subscriber information to be used when the event fires."," * @param {Function} fn The wrapped function to execute."," * @param {Object} context The value of the keyword 'this' in the listener."," * @param {Array} args* 0..n additional arguments to supply the listener."," *"," * @class Subscriber"," * @constructor"," */","Y.Subscriber = function(fn, context, args, when) {",""," /**"," * The callback that will be execute when the event fires"," * This is wrapped by Y.rbind if obj was supplied."," * @property fn"," * @type Function"," */"," this.fn = fn;",""," /**"," * Optional 'this' keyword for the listener"," * @property context"," * @type Object"," */"," this.context = context;",""," /**"," * Unique subscriber id"," * @property id"," * @type String"," */"," this.id = Y.guid();",""," /**"," * Additional arguments to propagate to the subscriber"," * @property args"," * @type Array"," */"," this.args = args;",""," this._when = when;",""," /**"," * Custom events for a given fire transaction."," * @property events"," * @type {EventTarget}"," */"," // this.events = null;",""," /**"," * This listener only reacts to the event once"," * @property once"," */"," // this.once = false;","","};","","Y.Subscriber.prototype = {"," constructor: Y.Subscriber,",""," _notify: function(c, args, ce) {"," if (this.deleted && !this.postponed) {"," if (this.postponed) {"," delete this.fn;"," delete this.context;"," } else {"," delete this.postponed;"," return null;"," }"," }"," var a = this.args, ret;"," switch (ce.signature) {"," case 0:"," ret = this.fn.call(c, ce.type, args, c);"," break;"," case 1:"," ret = this.fn.call(c, args[0] || null, c);"," break;"," default:"," if (a || args) {"," args = args || [];"," a = (a) ? args.concat(a) : args;"," ret = this.fn.apply(c, a);"," } else {"," ret = this.fn.call(c);"," }"," }",""," if (this.once) {"," ce._delete(this);"," }",""," return ret;"," },",""," /**"," * Executes the subscriber."," * @method notify"," * @param args {Array} Arguments array for the subscriber."," * @param ce {CustomEvent} The custom event that sent the notification."," */"," notify: function(args, ce) {"," var c = this.context,"," ret = true;",""," if (!c) {"," c = (ce.contextFn) ? ce.contextFn() : ce.context;"," }",""," // only catch errors if we will not re-throw them."," if (Y.config && Y.config.throwFail) {"," ret = this._notify(c, args, ce);"," } else {"," try {"," ret = this._notify(c, args, ce);"," } catch (e) {"," Y.error(this + ' failed: ' + e.message, e);"," }"," }",""," return ret;"," },",""," /**"," * Returns true if the fn and obj match this objects properties."," * Used by the unsubscribe method to match the right subscriber."," *"," * @method contains"," * @param {Function} fn the function to execute."," * @param {Object} context optional 'this' keyword for the listener."," * @return {boolean} true if the supplied arguments match this"," * subscriber's signature."," */"," contains: function(fn, context) {"," if (context) {"," return ((this.fn === fn) && this.context === context);"," } else {"," return (this.fn === fn);"," }"," },",""," valueOf : function() {"," return this.id;"," }","","};","/**"," * Return value from all subscribe operations"," * @class EventHandle"," * @constructor"," * @param {CustomEvent} evt the custom event."," * @param {Subscriber} sub the subscriber."," */","Y.EventHandle = function(evt, sub) {",""," /**"," * The custom event"," *"," * @property evt"," * @type CustomEvent"," */"," this.evt = evt;",""," /**"," * The subscriber object"," *"," * @property sub"," * @type Subscriber"," */"," this.sub = sub;","};","","Y.EventHandle.prototype = {"," batch: function(f, c) {"," f.call(c || this, this);"," if (Y.Lang.isArray(this.evt)) {"," Y.Array.each(this.evt, function(h) {"," h.batch.call(c || h, f);"," });"," }"," },",""," /**"," * Detaches this subscriber"," * @method detach"," * @return {int} the number of detached listeners"," */"," detach: function() {"," var evt = this.evt, detached = 0, i;"," if (evt) {"," if (Y.Lang.isArray(evt)) {"," for (i = 0; i < evt.length; i++) {"," detached += evt[i].detach();"," }"," } else {"," evt._delete(this.sub);"," detached = 1;"," }",""," }",""," return detached;"," },",""," /**"," * Monitor the event state for the subscribed event. The first parameter"," * is what should be monitored, the rest are the normal parameters when"," * subscribing to an event."," * @method monitor"," * @param what {string} what to monitor ('attach', 'detach', 'publish')."," * @return {EventHandle} return value from the monitor event subscription."," */"," monitor: function(what) {"," return this.evt.monitor.apply(this.evt, arguments);"," }","};","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," * @submodule event-custom-base"," */","","/**"," * EventTarget provides the implementation for any object to"," * publish, subscribe and fire to custom events, and also"," * alows other EventTargets to target the object with events"," * sourced from the other object."," * EventTarget is designed to be used with Y.augment to wrap"," * EventCustom in an interface that allows events to be listened to"," * and fired by name. This makes it possible for implementing code to"," * subscribe to an event that either has not been created yet, or will"," * not be created at all."," * @class EventTarget"," * @param opts a configuration object"," * @config emitFacade {boolean} if true, all events will emit event"," * facade payloads by default (default false)"," * @config prefix {String} the prefix to apply to non-prefixed event names"," */","","var L = Y.Lang,"," PREFIX_DELIMITER = ':',"," CATEGORY_DELIMITER = '|',"," AFTER_PREFIX = '~AFTER~',"," WILD_TYPE_RE = /(.*?)(:)(.*?)/,",""," _wildType = Y.cached(function(type) {"," return type.replace(WILD_TYPE_RE, \"*$2$3\");"," }),",""," /**"," * If the instance has a prefix attribute and the"," * event type is not prefixed, the instance prefix is"," * applied to the supplied type."," * @method _getType"," * @private"," */"," _getType = function(type, pre) {",""," if (!pre || !type || type.indexOf(PREFIX_DELIMITER) > -1) {"," return type;"," }",""," return pre + PREFIX_DELIMITER + type;"," },",""," /**"," * Returns an array with the detach key (if provided),"," * and the prefixed event name from _getType"," * Y.on('detachcategory| menu:click', fn)"," * @method _parseType"," * @private"," */"," _parseType = Y.cached(function(type, pre) {",""," var t = type, detachcategory, after, i;",""," if (!L.isString(t)) {"," return t;"," }",""," i = t.indexOf(AFTER_PREFIX);",""," if (i > -1) {"," after = true;"," t = t.substr(AFTER_PREFIX.length);"," }",""," i = t.indexOf(CATEGORY_DELIMITER);",""," if (i > -1) {"," detachcategory = t.substr(0, (i));"," t = t.substr(i+1);"," if (t === '*') {"," t = null;"," }"," }",""," // detach category, full type with instance prefix, is this an after listener, short type"," return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];"," }),",""," ET = function(opts) {",""," var etState = this._yuievt,"," etConfig;",""," if (!etState) {"," etState = this._yuievt = {"," events: {}, // PERF: Not much point instantiating lazily. We're bound to have events"," targets: null, // PERF: Instantiate lazily, if user actually adds target,"," config: {"," host: this,"," context: this"," },"," chain: Y.config.chain"," };"," }",""," etConfig = etState.config;",""," if (opts) {"," mixConfigs(etConfig, opts, true);",""," if (opts.chain !== undefined) {"," etState.chain = opts.chain;"," }",""," if (opts.prefix) {"," etConfig.prefix = opts.prefix;"," }"," }"," };","","ET.prototype = {",""," constructor: ET,",""," /**"," * Listen to a custom event hosted by this object one time."," * This is the equivalent to <code>on</code> except the"," * listener is immediatelly detached when it is executed."," * @method once"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching the"," * subscription"," */"," once: function() {"," var handle = this.on.apply(this, arguments);"," handle.batch(function(hand) {"," if (hand.sub) {"," hand.sub.once = true;"," }"," });"," return handle;"," },",""," /**"," * Listen to a custom event hosted by this object one time."," * This is the equivalent to <code>after</code> except the"," * listener is immediatelly detached when it is executed."," * @method onceAfter"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching that"," * subscription"," */"," onceAfter: function() {"," var handle = this.after.apply(this, arguments);"," handle.batch(function(hand) {"," if (hand.sub) {"," hand.sub.once = true;"," }"," });"," return handle;"," },",""," /**"," * Takes the type parameter passed to 'on' and parses out the"," * various pieces that could be included in the type. If the"," * event type is passed without a prefix, it will be expanded"," * to include the prefix one is supplied or the event target"," * is configured with a default prefix."," * @method parseType"," * @param {String} type the type"," * @param {String} [pre=this._yuievt.config.prefix] the prefix"," * @since 3.3.0"," * @return {Array} an array containing:"," * * the detach category, if supplied,"," * * the prefixed event type,"," * * whether or not this is an after listener,"," * * the supplied event type"," */"," parseType: function(type, pre) {"," return _parseType(type, pre || this._yuievt.config.prefix);"," },",""," /**"," * Subscribe a callback function to a custom event fired by this object or"," * from an object that bubbles its events to this object."," *"," * Callback functions for events published with `emitFacade = true` will"," * receive an `EventFacade` as the first argument (typically named \"e\")."," * These callbacks can then call `e.preventDefault()` to disable the"," * behavior published to that event's `defaultFn`. See the `EventFacade`"," * API for all available properties and methods. Subscribers to"," * non-`emitFacade` events will receive the arguments passed to `fire()`"," * after the event name."," *"," * To subscribe to multiple events at once, pass an object as the first"," * argument, where the key:value pairs correspond to the eventName:callback,"," * or pass an array of event names as the first argument to subscribe to"," * all listed events with the same callback."," *"," * Returning `false` from a callback is supported as an alternative to"," * calling `e.preventDefault(); e.stopPropagation();`. However, it is"," * recommended to use the event methods whenever possible."," *"," * @method on"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching that"," * subscription"," */"," on: function(type, fn, context) {",""," var yuievt = this._yuievt,"," parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,"," detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,"," Node = Y.Node, n, domevent, isArr;",""," // full name, args, detachcategory, after"," this._monitor('attach', parts[1], {"," args: arguments,"," category: parts[0],"," after: parts[2]"," });",""," if (L.isObject(type)) {",""," if (L.isFunction(type)) {"," return Y.Do.before.apply(Y.Do, arguments);"," }",""," f = fn;"," c = context;"," args = nativeSlice.call(arguments, 0);"," ret = [];",""," if (L.isArray(type)) {"," isArr = true;"," }",""," after = type._after;"," delete type._after;",""," Y.each(type, function(v, k) {",""," if (L.isObject(v)) {"," f = v.fn || ((L.isFunction(v)) ? v : f);"," c = v.context || c;"," }",""," var nv = (after) ? AFTER_PREFIX : '';",""," args[0] = nv + ((isArr) ? v : k);"," args[1] = f;"," args[2] = c;",""," ret.push(this.on.apply(this, args));",""," }, this);",""," return (yuievt.chain) ? this : new Y.EventHandle(ret);"," }",""," detachcategory = parts[0];"," after = parts[2];"," shorttype = parts[3];",""," // extra redirection so we catch adaptor events too. take a look at this."," if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {"," args = nativeSlice.call(arguments, 0);"," args.splice(2, 0, Node.getDOMNode(this));"," return Y.on.apply(Y, args);"," }",""," type = parts[1];",""," if (Y.instanceOf(this, YUI)) {",""," adapt = Y.Env.evt.plugins[type];"," args = nativeSlice.call(arguments, 0);"," args[0] = shorttype;",""," if (Node) {"," n = args[2];",""," if (Y.instanceOf(n, Y.NodeList)) {"," n = Y.NodeList.getDOMNodes(n);"," } else if (Y.instanceOf(n, Node)) {"," n = Node.getDOMNode(n);"," }",""," domevent = (shorttype in Node.DOM_EVENTS);",""," // Captures both DOM events and event plugins."," if (domevent) {"," args[2] = n;"," }"," }",""," // check for the existance of an event adaptor"," if (adapt) {"," handle = adapt.on.apply(Y, args);"," } else if ((!type) || domevent) {"," handle = Y.Event._attach(args);"," }",""," }",""," if (!handle) {"," ce = yuievt.events[type] || this.publish(type);"," handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);",""," // TODO: More robust regex, accounting for category"," if (type.indexOf(\"*:\") !== -1) {"," this._hasSiblings = true;"," }"," }",""," if (detachcategory) {"," store[detachcategory] = store[detachcategory] || {};"," store[detachcategory][type] = store[detachcategory][type] || [];"," store[detachcategory][type].push(handle);"," }",""," return (yuievt.chain) ? this : handle;",""," },",""," /**"," * subscribe to an event"," * @method subscribe"," * @deprecated use on"," */"," subscribe: function() {"," return this.on.apply(this, arguments);"," },",""," /**"," * Detach one or more listeners the from the specified event"," * @method detach"," * @param type {string|Object} Either the handle to the subscriber or the"," * type of event. If the type"," * is not specified, it will attempt to remove"," * the listener from all hosted events."," * @param fn {Function} The subscribed function to unsubscribe, if not"," * supplied, all subscribers will be removed."," * @param context {Object} The custom object passed to subscribe. This is"," * optional, but if supplied will be used to"," * disambiguate multiple listeners that are the same"," * (e.g., you subscribe many object using a function"," * that lives on the prototype)"," * @return {EventTarget} the host"," */"," detach: function(type, fn, context) {",""," var evts = this._yuievt.events,"," i,"," Node = Y.Node,"," isNode = Node && (Y.instanceOf(this, Node));",""," // detachAll disabled on the Y instance."," if (!type && (this !== Y)) {"," for (i in evts) {"," if (evts.hasOwnProperty(i)) {"," evts[i].detach(fn, context);"," }"," }"," if (isNode) {"," Y.Event.purgeElement(Node.getDOMNode(this));"," }",""," return this;"," }",""," var parts = _parseType(type, this._yuievt.config.prefix),"," detachcategory = L.isArray(parts) ? parts[0] : null,"," shorttype = (parts) ? parts[3] : null,"," adapt, store = Y.Env.evt.handles, detachhost, cat, args,"," ce,",""," keyDetacher = function(lcat, ltype, host) {"," var handles = lcat[ltype], ce, i;"," if (handles) {"," for (i = handles.length - 1; i >= 0; --i) {"," ce = handles[i].evt;"," if (ce.host === host || ce.el === host) {"," handles[i].detach();"," }"," }"," }"," };",""," if (detachcategory) {",""," cat = store[detachcategory];"," type = parts[1];"," detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;",""," if (cat) {"," if (type) {"," keyDetacher(cat, type, detachhost);"," } else {"," for (i in cat) {"," if (cat.hasOwnProperty(i)) {"," keyDetacher(cat, i, detachhost);"," }"," }"," }",""," return this;"," }",""," // If this is an event handle, use it to detach"," } else if (L.isObject(type) && type.detach) {"," type.detach();"," return this;"," // extra redirection so we catch adaptor events too. take a look at this."," } else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {"," args = nativeSlice.call(arguments, 0);"," args[2] = Node.getDOMNode(this);"," Y.detach.apply(Y, args);"," return this;"," }",""," adapt = Y.Env.evt.plugins[shorttype];",""," // The YUI instance handles DOM events and adaptors"," if (Y.instanceOf(this, YUI)) {"," args = nativeSlice.call(arguments, 0);"," // use the adaptor specific detach code if"," if (adapt && adapt.detach) {"," adapt.detach.apply(Y, args);"," return this;"," // DOM event fork"," } else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {"," args[0] = type;"," Y.Event.detach.apply(Y.Event, args);"," return this;"," }"," }",""," // ce = evts[type];"," ce = evts[parts[1]];"," if (ce) {"," ce.detach(fn, context);"," }",""," return this;"," },",""," /**"," * detach a listener"," * @method unsubscribe"," * @deprecated use detach"," */"," unsubscribe: function() {"," return this.detach.apply(this, arguments);"," },",""," /**"," * Removes all listeners from the specified event. If the event type"," * is not specified, all listeners from all hosted custom events will"," * be removed."," * @method detachAll"," * @param type {String} The type, or name of the event"," */"," detachAll: function(type) {"," return this.detach(type);"," },",""," /**"," * Removes all listeners from the specified event. If the event type"," * is not specified, all listeners from all hosted custom events will"," * be removed."," * @method unsubscribeAll"," * @param type {String} The type, or name of the event"," * @deprecated use detachAll"," */"," unsubscribeAll: function() {"," return this.detachAll.apply(this, arguments);"," },",""," /**"," * Creates a new custom event of the specified type. If a custom event"," * by that name already exists, it will not be re-created. In either"," * case the custom event is returned."," *"," * @method publish"," *"," * @param type {String} the type, or name of the event"," * @param opts {object} optional config params. Valid properties are:"," *"," * <ul>"," * <li>"," * 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)"," * </li>"," * <li>"," * 'bubbles': whether or not this event bubbles (true)"," * Events can only bubble if emitFacade is true."," * </li>"," * <li>"," * 'context': the default execution context for the listeners (this)"," * </li>"," * <li>"," * 'defaultFn': the default function to execute when this event fires if preventDefault was not called"," * </li>"," * <li>"," * 'emitFacade': whether or not this event emits a facade (false)"," * </li>"," * <li>"," * 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'"," * </li>"," * <li>"," * 'fireOnce': if an event is configured to fire once, new subscribers after"," * the fire will be notified immediately."," * </li>"," * <li>"," * 'async': fireOnce event listeners will fire synchronously if the event has already"," * fired unless async is true."," * </li>"," * <li>"," * 'preventable': whether or not preventDefault() has an effect (true)"," * </li>"," * <li>"," * 'preventedFn': a function that is executed when preventDefault is called"," * </li>"," * <li>"," * 'queuable': whether or not this event can be queued during bubbling (false)"," * </li>"," * <li>"," * 'silent': if silent is true, debug messages are not provided for this event."," * </li>"," * <li>"," * 'stoppedFn': a function that is executed when stopPropagation is called"," * </li>"," *"," * <li>"," * 'monitored': specifies whether or not this event should send notifications about"," * when the event has been attached, detached, or published."," * </li>"," * <li>"," * 'type': the event type (valid option if not provided as the first parameter to publish)"," * </li>"," * </ul>"," *"," * @return {CustomEvent} the custom event"," *"," */"," publish: function(type, opts) {",""," var ret,"," etState = this._yuievt,"," etConfig = etState.config,"," pre = etConfig.prefix;",""," if (typeof type === \"string\") {"," if (pre) {"," type = _getType(type, pre);"," }"," ret = this._publish(type, etConfig, opts);"," } else {"," ret = {};",""," Y.each(type, function(v, k) {"," if (pre) {"," k = _getType(k, pre);"," }"," ret[k] = this._publish(k, etConfig, v || opts);"," }, this);",""," }",""," return ret;"," },",""," /**"," * Returns the fully qualified type, given a short type string."," * That is, returns \"foo:bar\" when given \"bar\" if \"foo\" is the configured prefix."," *"," * NOTE: This method, unlike _getType, does no checking of the value passed in, and"," * is designed to be used with the low level _publish() method, for critical path"," * implementations which need to fast-track publish for performance reasons."," *"," * @method _getFullType"," * @private"," * @param {String} type The short type to prefix"," * @return {String} The prefixed type, if a prefix is set, otherwise the type passed in"," */"," _getFullType : function(type) {",""," var pre = this._yuievt.config.prefix;",""," if (pre) {"," return pre + PREFIX_DELIMITER + type;"," } else {"," return type;"," }"," },",""," /**"," * The low level event publish implementation. It expects all the massaging to have been done"," * outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast"," * path publish, which can be used by critical code paths to improve performance."," *"," * @method _publish"," * @private"," * @param {String} fullType The prefixed type of the event to publish."," * @param {Object} etOpts The EventTarget specific configuration to mix into the published event."," * @param {Object} ceOpts The publish specific configuration to mix into the published event."," * @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will"," * be the default `CustomEvent` instance, and can be configured independently."," */"," _publish : function(fullType, etOpts, ceOpts) {",""," var ce,"," etState = this._yuievt,"," etConfig = etState.config,"," host = etConfig.host,"," context = etConfig.context,"," events = etState.events;",""," ce = events[fullType];",""," // PERF: Hate to pull the check out of monitor, but trying to keep critical path tight."," if ((etConfig.monitored && !ce) || (ce && ce.monitored)) {"," this._monitor('publish', fullType, {"," args: arguments"," });"," }",""," if (!ce) {"," // Publish event"," ce = events[fullType] = new Y.CustomEvent(fullType, etOpts);",""," if (!etOpts) {"," ce.host = host;"," ce.context = context;"," }"," }",""," if (ceOpts) {"," mixConfigs(ce, ceOpts, true);"," }",""," return ce;"," },",""," /**"," * This is the entry point for the event monitoring system."," * You can monitor 'attach', 'detach', 'fire', and 'publish'."," * When configured, these events generate an event. click ->"," * click_attach, click_detach, click_publish -- these can"," * be subscribed to like other events to monitor the event"," * system. Inividual published events can have monitoring"," * turned on or off (publish can't be turned off before it"," * it published) by setting the events 'monitor' config."," *"," * @method _monitor"," * @param what {String} 'attach', 'detach', 'fire', or 'publish'"," * @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object."," * @param o {Object} Information about the event interaction, such as"," * fire() args, subscription category, publish config"," * @private"," */"," _monitor: function(what, eventType, o) {"," var monitorevt, ce, type;",""," if (eventType) {"," if (typeof eventType === \"string\") {"," type = eventType;"," ce = this.getEvent(eventType, true);"," } else {"," ce = eventType;"," type = eventType.type;"," }",""," if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {"," monitorevt = type + '_' + what;"," o.monitored = what;"," this.fire.call(this, monitorevt, o);"," }"," }"," },",""," /**"," * Fire a custom event by name. The callback functions will be executed"," * from the context specified when the event was created, and with the"," * following parameters."," *"," * The first argument is the event type, and any additional arguments are"," * passed to the listeners as parameters. If the first of these is an"," * object literal, and the event is configured to emit an event facade,"," * that object is mixed into the event facade and the facade is provided"," * in place of the original object."," *"," * If the custom event object hasn't been created, then the event hasn't"," * been published and it has no subscribers. For performance sake, we"," * immediate exit in this case. This means the event won't bubble, so"," * if the intention is that a bubble target be notified, the event must"," * be published on this object first."," *"," * @method fire"," * @param type {String|Object} The type of the event, or an object that contains"," * a 'type' property."," * @param arguments {Object*} an arbitrary set of parameters to pass to"," * the handler. If the first of these is an object literal and the event is"," * configured to emit an event facade, the event facade will replace that"," * parameter after the properties the object literal contains are copied to"," * the event facade."," * @return {Boolean} True if the whole lifecycle of the event went through,"," * false if at any point the event propagation was halted."," */"," fire: function(type) {",""," var typeIncluded = (typeof type === \"string\"),"," argCount = arguments.length,"," t = type,"," yuievt = this._yuievt,"," etConfig = yuievt.config,"," pre = etConfig.prefix,"," ret,"," ce,"," ce2,"," args;",""," if (typeIncluded && argCount <= 3) {",""," // PERF: Try to avoid slice/iteration for the common signatures",""," // Most common"," if (argCount === 2) {"," args = [arguments[1]]; // fire(\"foo\", {})"," } else if (argCount === 3) {"," args = [arguments[1], arguments[2]]; // fire(\"foo\", {}, opts)"," } else {"," args = []; // fire(\"foo\")"," }",""," } else {"," args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0));"," }",""," if (!typeIncluded) {"," t = (type && type.type);"," }",""," if (pre) {"," t = _getType(t, pre);"," }",""," ce = yuievt.events[t];",""," if (this._hasSiblings) {"," ce2 = this.getSibling(t, ce);",""," if (ce2 && !ce) {"," ce = this.publish(t);"," }"," }",""," // PERF: trying to avoid function call, since this is a critical path"," if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {"," this._monitor('fire', (ce || t), {"," args: args"," });"," }",""," // this event has not been published or subscribed to"," if (!ce) {"," if (yuievt.hasTargets) {"," return this.bubble({ type: t }, args, this);"," }",""," // otherwise there is nothing to be done"," ret = true;"," } else {",""," if (ce2) {"," ce.sibling = ce2;"," }",""," ret = ce._fire(args);"," }",""," return (yuievt.chain) ? this : ret;"," },",""," getSibling: function(type, ce) {"," var ce2;",""," // delegate to *:type events if there are subscribers"," if (type.indexOf(PREFIX_DELIMITER) > -1) {"," type = _wildType(type);"," ce2 = this.getEvent(type, true);"," if (ce2) {"," ce2.applyConfig(ce);"," ce2.bubbles = false;"," ce2.broadcast = 0;"," }"," }",""," return ce2;"," },",""," /**"," * Returns the custom event of the provided type has been created, a"," * falsy value otherwise"," * @method getEvent"," * @param type {String} the type, or name of the event"," * @param prefixed {String} if true, the type is prefixed already"," * @return {CustomEvent} the custom event or null"," */"," getEvent: function(type, prefixed) {"," var pre, e;",""," if (!prefixed) {"," pre = this._yuievt.config.prefix;"," type = (pre) ? _getType(type, pre) : type;"," }"," e = this._yuievt.events;"," return e[type] || null;"," },",""," /**"," * Subscribe to a custom event hosted by this object. The"," * supplied callback will execute after any listeners add"," * via the subscribe method, and after the default function,"," * if configured for the event, has executed."," *"," * @method after"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching the"," * subscription"," */"," after: function(type, fn) {",""," var a = nativeSlice.call(arguments, 0);",""," switch (L.type(type)) {"," case 'function':"," return Y.Do.after.apply(Y.Do, arguments);"," case 'array':"," // YArray.each(a[0], function(v) {"," // v = AFTER_PREFIX + v;"," // });"," // break;"," case 'object':"," a[0]._after = true;"," break;"," default:"," a[0] = AFTER_PREFIX + type;"," }",""," return this.on.apply(this, a);",""," },",""," /**"," * Executes the callback before a DOM event, custom event"," * or method. If the first argument is a function, it"," * is assumed the target is a method. For DOM and custom"," * events, this is an alias for Y.on."," *"," * For DOM and custom events:"," * type, callback, context, 0-n arguments"," *"," * For methods:"," * callback, object (method host), methodName, context, 0-n arguments"," *"," * @method before"," * @return detach handle"," */"," before: function() {"," return this.on.apply(this, arguments);"," }","","};","","Y.EventTarget = ET;","","// make Y an event target","Y.mix(Y, ET.prototype);","ET.call(Y, { bubbles: false });","","YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();","","/**"," * Hosts YUI page level events. This is where events bubble to"," * when the broadcast config is set to 2. This property is"," * only available if the custom event module is loaded."," * @property Global"," * @type EventTarget"," * @for YUI"," */","Y.Global = YUI.Env.globalEvents;","","// @TODO implement a global namespace function on Y.Global?","","/**","`Y.on()` can do many things:","","<ul>"," <li>Subscribe to custom events `publish`ed and `fire`d from Y</li>"," <li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and"," `fire`d from any object in the YUI instance sandbox</li>"," <li>Subscribe to DOM events</li>"," <li>Subscribe to the execution of a method on any object, effectively"," treating that method as an event</li>","</ul>","","For custom event subscriptions, pass the custom event name as the first argument","and callback as the second. The `this` object in the callback will be `Y` unless","an override is passed as the third argument.",""," Y.on('io:complete', function () {"," Y.MyApp.updateStatus('Transaction complete');"," });","","To subscribe to DOM events, pass the name of a DOM event as the first argument","and a CSS selector string as the third argument after the callback function.","Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,","array, or simply omitted (the default is the `window` object).",""," Y.on('click', function (e) {"," e.preventDefault();",""," // proceed with ajax form submission"," var url = this.get('action');"," ..."," }, '#my-form');","","The `this` object in DOM event callbacks will be the `Node` targeted by the CSS","selector or other identifier.","","`on()` subscribers for DOM events or custom events `publish`ed with a","`defaultFn` can prevent the default behavior with `e.preventDefault()` from the","event object passed as the first parameter to the subscription callback.","","To subscribe to the execution of an object method, pass arguments corresponding to the call signature for","<a href=\"../classes/Do.html#methods_before\">`Y.Do.before(...)`</a>.","","NOTE: The formal parameter list below is for events, not for function","injection. See `Y.Do.before` for that signature.","","@method on","@param {String} type DOM or custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [arg*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@see Do.before","@for YUI","**/","","/**","Listen for an event one time. Equivalent to `on()`, except that","the listener is immediately detached when executed.","","See the <a href=\"#methods_on\">`on()` method</a> for additional subscription","options.","","@see on","@method once","@param {String} type DOM or custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [arg*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@for YUI","**/","","/**","Listen for an event one time. Equivalent to `once()`, except, like `after()`,","the subscription callback executes after all `on()` subscribers and the event's","`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase","subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`","subscribers will execute.","","The listener is immediately detached when executed.","","See the <a href=\"#methods_on\">`on()` method</a> for additional subscription","options.","","@see once","@method onceAfter","@param {String} type The custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [arg*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@for YUI","**/","","/**","Like `on()`, this method creates a subscription to a custom event or to the","execution of a method on an object.","","For events, `after()` subscribers are executed after the event's","`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.","","See the <a href=\"#methods_on\">`on()` method</a> for additional subscription","options.","","NOTE: The subscription signature shown is for events, not for function","injection. See <a href=\"../classes/Do.html#methods_after\">`Y.Do.after`</a>","for that signature.","","@see on","@see Do.after","@method after","@param {String} type The custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [args*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@for YUI","**/","","","}, '@VERSION@', {\"requires\": [\"oop\"]});","","}());"]};
}
var __cov_0ShtDtxkEapLmfzOgrY8Kw = __coverage__['build/event-custom-base/event-custom-base.js'];
__cov_0ShtDtxkEapLmfzOgrY8Kw.s['1']++;YUI.add('event-custom-base',function(Y,NAME){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['1']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['2']++;Y.Env.evt={handles:{},plugins:{}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['3']++;var DO_BEFORE=0,DO_AFTER=1,DO={objs:null,before:function(fn,obj,sFn,c){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['2']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['4']++;var f=fn,a;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['5']++;if(c){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['1'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['6']++;a=[fn,c].concat(Y.Array(arguments,4,true));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['7']++;f=Y.rbind.apply(Y,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['1'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['8']++;return this._inject(DO_BEFORE,f,obj,sFn);},after:function(fn,obj,sFn,c){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['3']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['9']++;var f=fn,a;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['10']++;if(c){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['2'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['11']++;a=[fn,c].concat(Y.Array(arguments,4,true));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['12']++;f=Y.rbind.apply(Y,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['2'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['13']++;return this._inject(DO_AFTER,f,obj,sFn);},_inject:function(when,fn,obj,sFn){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['4']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['14']++;var id=Y.stamp(obj),o,sid;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['15']++;if(!obj._yuiaop){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['3'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['16']++;obj._yuiaop={};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['3'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['17']++;o=obj._yuiaop;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['18']++;if(!o[sFn]){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['4'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['19']++;o[sFn]=new Y.Do.Method(obj,sFn);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['20']++;obj[sFn]=function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['5']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['21']++;return o[sFn].exec.apply(o[sFn],arguments);};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['4'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['22']++;sid=id+Y.stamp(fn)+sFn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['23']++;o[sFn].register(sid,fn,when);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['24']++;return new Y.EventHandle(o[sFn],sid);},detach:function(handle){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['6']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['25']++;if(handle.detach){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['5'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['26']++;handle.detach();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['5'][1]++;}}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['27']++;Y.Do=DO;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['28']++;DO.Method=function(obj,sFn){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['7']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['29']++;this.obj=obj;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['30']++;this.methodName=sFn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['31']++;this.method=obj[sFn];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['32']++;this.before={};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['33']++;this.after={};};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['34']++;DO.Method.prototype.register=function(sid,fn,when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['8']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['35']++;if(when){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['6'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['36']++;this.after[sid]=fn;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['6'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['37']++;this.before[sid]=fn;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['38']++;DO.Method.prototype._delete=function(sid){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['9']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['39']++;delete this.before[sid];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['40']++;delete this.after[sid];};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['41']++;DO.Method.prototype.exec=function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['10']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['42']++;var args=Y.Array(arguments,0,true),i,ret,newRet,bf=this.before,af=this.after,prevented=false;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['43']++;for(i in bf){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['44']++;if(bf.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['7'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['45']++;ret=bf[i].apply(this.obj,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['46']++;if(ret){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['8'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['47']++;switch(ret.constructor){case DO.Halt:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['48']++;return ret.retVal;case DO.AlterArgs:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['49']++;args=ret.newArgs;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['50']++;break;case DO.Prevent:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][2]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['51']++;prevented=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['52']++;break;default:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][3]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['8'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['7'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['53']++;if(!prevented){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['10'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['54']++;ret=this.method.apply(this.obj,args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['10'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['55']++;DO.originalRetVal=ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['56']++;DO.currentRetVal=ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['57']++;for(i in af){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['58']++;if(af.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['11'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['59']++;newRet=af[i].apply(this.obj,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['60']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['13'][0]++,newRet)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['13'][1]++,newRet.constructor===DO.Halt)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['12'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['61']++;return newRet.retVal;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['12'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['62']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['15'][0]++,newRet)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['15'][1]++,newRet.constructor===DO.AlterReturn)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['14'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['63']++;ret=newRet.newRetVal;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['64']++;DO.currentRetVal=ret;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['14'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['11'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['65']++;return ret;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['66']++;DO.AlterArgs=function(msg,newArgs){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['11']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['67']++;this.msg=msg;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['68']++;this.newArgs=newArgs;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['69']++;DO.AlterReturn=function(msg,newRetVal){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['12']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['70']++;this.msg=msg;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['71']++;this.newRetVal=newRetVal;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['72']++;DO.Halt=function(msg,retVal){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['13']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['73']++;this.msg=msg;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['74']++;this.retVal=retVal;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['75']++;DO.Prevent=function(msg){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['14']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['76']++;this.msg=msg;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['77']++;DO.Error=DO.Halt;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['78']++;var YArray=Y.Array,AFTER='after',CONFIGS=['broadcast','monitored','bubbles','context','contextFn','currentTarget','defaultFn','defaultTargetOnly','details','emitFacade','fireOnce','async','host','preventable','preventedFn','queuable','silent','stoppedFn','target','type'],CONFIGS_HASH=YArray.hash(CONFIGS),nativeSlice=Array.prototype.slice,YUI3_SIGNATURE=9,YUI_LOG='yui:log',mixConfigs=function(r,s,ov){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['15']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['79']++;var p;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['80']++;for(p in s){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['81']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['17'][0]++,CONFIGS_HASH[p])&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['17'][1]++,ov)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['17'][2]++,!(p in r)))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['16'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['82']++;r[p]=s[p];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['16'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['83']++;return r;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['84']++;Y.CustomEvent=function(type,defaults){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['16']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['85']++;this._kds=Y.CustomEvent.keepDeprecatedSubs;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['86']++;this.id=Y.guid();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['87']++;this.type=type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['88']++;this.silent=this.logSystem=type===YUI_LOG;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['89']++;if(this._kds){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['18'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['90']++;this.subscribers={};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['91']++;this.afters={};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['18'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['92']++;if(defaults){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['19'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['93']++;mixConfigs(this,defaults,true);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['19'][1]++;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['94']++;Y.CustomEvent.keepDeprecatedSubs=false;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['95']++;Y.CustomEvent.mixConfigs=mixConfigs;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['96']++;Y.CustomEvent.prototype={constructor:Y.CustomEvent,signature:YUI3_SIGNATURE,context:Y,preventable:true,bubbles:true,hasSubs:function(when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['17']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['97']++;var s=0,a=0,subs=this._subscribers,afters=this._afters,sib=this.sibling;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['98']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['20'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['99']++;s=subs.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['20'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['100']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['21'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['101']++;a=afters.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['21'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['102']++;if(sib){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['22'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['103']++;subs=sib._subscribers;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['104']++;afters=sib._afters;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['105']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['23'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['106']++;s+=subs.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['23'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['107']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['24'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['108']++;a+=afters.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['24'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['22'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['109']++;if(when){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['25'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['110']++;return when==='after'?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['26'][0]++,a):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['26'][1]++,s);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['25'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['111']++;return s+a;},monitor:function(what){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['18']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['112']++;this.monitored=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['113']++;var type=this.id+'|'+this.type+'_'+what,args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['114']++;args[0]=type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['115']++;return this.host.on.apply(this.host,args);},getSubs:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['19']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['116']++;var sibling=this.sibling,subs=this._subscribers,afters=this._afters,siblingSubs,siblingAfters;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['117']++;if(sibling){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['27'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['118']++;siblingSubs=sibling._subscribers;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['119']++;siblingAfters=sibling._afters;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['27'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['120']++;if(siblingSubs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['28'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['121']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['29'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['122']++;subs=subs.concat(siblingSubs);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['29'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['123']++;subs=siblingSubs.concat();}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['28'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['124']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['30'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['125']++;subs=subs.concat();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['30'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['126']++;subs=[];}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['127']++;if(siblingAfters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['31'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['128']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['32'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['129']++;afters=afters.concat(siblingAfters);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['32'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['130']++;afters=siblingAfters.concat();}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['31'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['131']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['33'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['132']++;afters=afters.concat();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['33'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['133']++;afters=[];}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['134']++;return[subs,afters];},applyConfig:function(o,force){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['20']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['135']++;mixConfigs(this,o,force);},_on:function(fn,context,args,when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['21']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['136']++;var s=new Y.Subscriber(fn,context,args,when),firedWith;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['137']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['35'][0]++,this.fireOnce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['35'][1]++,this.fired)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['34'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['138']++;firedWith=this.firedWith;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['139']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['37'][0]++,this.emitFacade)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['37'][1]++,this._addFacadeToArgs)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['36'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['140']++;this._addFacadeToArgs(firedWith);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['36'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['141']++;if(this.async){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['38'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['142']++;setTimeout(Y.bind(this._notify,this,s,firedWith),0);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['38'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['143']++;this._notify(s,firedWith);}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['34'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['144']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['39'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['145']++;if(!this._afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['40'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['146']++;this._afters=[];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['40'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['147']++;this._afters.push(s);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['39'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['148']++;if(!this._subscribers){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['41'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['149']++;this._subscribers=[];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['41'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['150']++;this._subscribers.push(s);}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['151']++;if(this._kds){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['42'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['152']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['43'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['153']++;this.afters[s.id]=s;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['43'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['154']++;this.subscribers[s.id]=s;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['42'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['155']++;return new Y.EventHandle(this,s);},subscribe:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['22']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['156']++;var a=arguments.length>2?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['44'][0]++,nativeSlice.call(arguments,2)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['44'][1]++,null);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['157']++;return this._on(fn,context,a,true);},on:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['23']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['158']++;var a=arguments.length>2?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['45'][0]++,nativeSlice.call(arguments,2)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['45'][1]++,null);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['159']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['47'][0]++,this.monitored)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['47'][1]++,this.host)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['46'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['160']++;this.host._monitor('attach',this,{args:arguments});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['46'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['161']++;return this._on(fn,context,a,true);},after:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['24']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['162']++;var a=arguments.length>2?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['48'][0]++,nativeSlice.call(arguments,2)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['48'][1]++,null);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['163']++;return this._on(fn,context,a,AFTER);},detach:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['25']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['164']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['50'][0]++,fn)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['50'][1]++,fn.detach)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['49'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['165']++;return fn.detach();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['49'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['166']++;var i,s,found=0,subs=this._subscribers,afters=this._afters;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['167']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['51'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['168']++;for(i=subs.length;i>=0;i--){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['169']++;s=subs[i];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['170']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['53'][0]++,s)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['53'][1]++,!fn)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['53'][2]++,fn===s.fn))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['52'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['171']++;this._delete(s,subs,i);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['172']++;found++;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['52'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['51'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['173']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['54'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['174']++;for(i=afters.length;i>=0;i--){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['175']++;s=afters[i];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['176']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['56'][0]++,s)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['56'][1]++,!fn)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['56'][2]++,fn===s.fn))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['55'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['177']++;this._delete(s,afters,i);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['178']++;found++;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['55'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['54'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['179']++;return found;},unsubscribe:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['26']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['180']++;return this.detach.apply(this,arguments);},_notify:function(s,args,ef){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['27']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['181']++;var ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['182']++;ret=s.notify(args,this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['183']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['58'][0]++,false===ret)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['58'][1]++,this.stopped>1)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['57'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['184']++;return false;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['57'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['185']++;return true;},log:function(msg,cat){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['28']++;},fire:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['29']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['186']++;var args=[];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['187']++;args.push.apply(args,arguments);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['188']++;return this._fire(args);},_fire:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['30']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['189']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['60'][0]++,this.fireOnce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['60'][1]++,this.fired)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['59'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['190']++;return true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['59'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['191']++;this.fired=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['192']++;if(this.fireOnce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['61'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['193']++;this.firedWith=args;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['61'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['194']++;if(this.emitFacade){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['62'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['195']++;return this.fireComplex(args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['62'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['196']++;return this.fireSimple(args);}}},fireSimple:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['31']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['197']++;this.stopped=0;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['198']++;this.prevented=0;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['199']++;if(this.hasSubs()){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['63'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['200']++;var subs=this.getSubs();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['201']++;this._procSubs(subs[0],args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['202']++;this._procSubs(subs[1],args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['63'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['203']++;if(this.broadcast){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['64'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['204']++;this._broadcast(args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['64'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['205']++;return this.stopped?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['65'][0]++,false):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['65'][1]++,true);},fireComplex:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['32']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['206']++;args[0]=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['66'][0]++,args[0])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['66'][1]++,{});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['207']++;return this.fireSimple(args);},_procSubs:function(subs,args,ef){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['33']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['208']++;var s,i,l;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['209']++;for(i=0,l=subs.length;i<l;i++){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['210']++;s=subs[i];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['211']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['68'][0]++,s)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['68'][1]++,s.fn)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['67'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['212']++;if(false===this._notify(s,args,ef)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['69'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['213']++;this.stopped=2;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['69'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['214']++;if(this.stopped===2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['70'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['215']++;return false;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['70'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['67'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['216']++;return true;},_broadcast:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['34']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['217']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['72'][0]++,!this.stopped)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['72'][1]++,this.broadcast)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['71'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['218']++;var a=args.concat();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['219']++;a.unshift(this.type);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['220']++;if(this.host!==Y){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['73'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['221']++;Y.fire.apply(Y,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['73'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['222']++;if(this.broadcast===2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['74'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['223']++;Y.Global.fire.apply(Y.Global,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['74'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['71'][1]++;}},unsubscribeAll:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['35']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['224']++;return this.detachAll.apply(this,arguments);},detachAll:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['36']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['225']++;return this.detach();},_delete:function(s,subs,i){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['37']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['226']++;var when=s._when;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['227']++;if(!subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['75'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['228']++;subs=when===AFTER?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['76'][0]++,this._afters):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['76'][1]++,this._subscribers);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['75'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['229']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['77'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['230']++;i=YArray.indexOf(subs,s,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['231']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['79'][0]++,s)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['79'][1]++,subs[i]===s)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['78'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['232']++;subs.splice(i,1);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['78'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['77'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['233']++;if(this._kds){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['80'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['234']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['81'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['235']++;delete this.afters[s.id];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['81'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['236']++;delete this.subscribers[s.id];}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['80'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['237']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['83'][0]++,this.monitored)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['83'][1]++,this.host)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['82'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['238']++;this.host._monitor('detach',this,{ce:this,sub:s});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['82'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['239']++;if(s){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['84'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['240']++;s.deleted=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['84'][1]++;}}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['241']++;Y.Subscriber=function(fn,context,args,when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['38']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['242']++;this.fn=fn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['243']++;this.context=context;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['244']++;this.id=Y.guid();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['245']++;this.args=args;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['246']++;this._when=when;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['247']++;Y.Subscriber.prototype={constructor:Y.Subscriber,_notify:function(c,args,ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['39']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['248']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['86'][0]++,this.deleted)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['86'][1]++,!this.postponed)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['85'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['249']++;if(this.postponed){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['87'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['250']++;delete this.fn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['251']++;delete this.context;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['87'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['252']++;delete this.postponed;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['253']++;return null;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['85'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['254']++;var a=this.args,ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['255']++;switch(ce.signature){case 0:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['88'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['256']++;ret=this.fn.call(c,ce.type,args,c);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['257']++;break;case 1:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['88'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['258']++;ret=this.fn.call(c,(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['89'][0]++,args[0])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['89'][1]++,null),c);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['259']++;break;default:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['88'][2]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['260']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['91'][0]++,a)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['91'][1]++,args)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['90'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['261']++;args=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['92'][0]++,args)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['92'][1]++,[]);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['262']++;a=a?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['93'][0]++,args.concat(a)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['93'][1]++,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['263']++;ret=this.fn.apply(c,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['90'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['264']++;ret=this.fn.call(c);}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['265']++;if(this.once){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['94'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['266']++;ce._delete(this);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['94'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['267']++;return ret;},notify:function(args,ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['40']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['268']++;var c=this.context,ret=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['269']++;if(!c){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['95'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['270']++;c=ce.contextFn?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['96'][0]++,ce.contextFn()):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['96'][1]++,ce.context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['95'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['271']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['98'][0]++,Y.config)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['98'][1]++,Y.config.throwFail)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['97'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['272']++;ret=this._notify(c,args,ce);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['97'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['273']++;try{__cov_0ShtDtxkEapLmfzOgrY8Kw.s['274']++;ret=this._notify(c,args,ce);}catch(e){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['275']++;Y.error(this+' failed: '+e.message,e);}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['276']++;return ret;},contains:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['41']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['277']++;if(context){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['99'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['278']++;return(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['100'][0]++,this.fn===fn)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['100'][1]++,this.context===context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['99'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['279']++;return this.fn===fn;}},valueOf:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['42']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['280']++;return this.id;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['281']++;Y.EventHandle=function(evt,sub){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['43']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['282']++;this.evt=evt;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['283']++;this.sub=sub;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['284']++;Y.EventHandle.prototype={batch:function(f,c){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['44']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['285']++;f.call((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['101'][0]++,c)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['101'][1]++,this),this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['286']++;if(Y.Lang.isArray(this.evt)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['102'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['287']++;Y.Array.each(this.evt,function(h){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['45']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['288']++;h.batch.call((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['103'][0]++,c)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['103'][1]++,h),f);});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['102'][1]++;}},detach:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['46']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['289']++;var evt=this.evt,detached=0,i;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['290']++;if(evt){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['104'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['291']++;if(Y.Lang.isArray(evt)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['105'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['292']++;for(i=0;i<evt.length;i++){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['293']++;detached+=evt[i].detach();}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['105'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['294']++;evt._delete(this.sub);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['295']++;detached=1;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['104'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['296']++;return detached;},monitor:function(what){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['47']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['297']++;return this.evt.monitor.apply(this.evt,arguments);}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['298']++;var L=Y.Lang,PREFIX_DELIMITER=':',CATEGORY_DELIMITER='|',AFTER_PREFIX='~AFTER~',WILD_TYPE_RE=/(.*?)(:)(.*?)/,_wildType=Y.cached(function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['48']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['299']++;return type.replace(WILD_TYPE_RE,'*$2$3');}),_getType=function(type,pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['49']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['300']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['107'][0]++,!pre)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['107'][1]++,!type)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['107'][2]++,type.indexOf(PREFIX_DELIMITER)>-1)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['106'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['301']++;return type;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['106'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['302']++;return pre+PREFIX_DELIMITER+type;},_parseType=Y.cached(function(type,pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['50']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['303']++;var t=type,detachcategory,after,i;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['304']++;if(!L.isString(t)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['108'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['305']++;return t;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['108'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['306']++;i=t.indexOf(AFTER_PREFIX);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['307']++;if(i>-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['109'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['308']++;after=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['309']++;t=t.substr(AFTER_PREFIX.length);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['109'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['310']++;i=t.indexOf(CATEGORY_DELIMITER);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['311']++;if(i>-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['110'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['312']++;detachcategory=t.substr(0,i);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['313']++;t=t.substr(i+1);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['314']++;if(t==='*'){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['111'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['315']++;t=null;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['111'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['110'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['316']++;return[detachcategory,pre?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['112'][0]++,_getType(t,pre)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['112'][1]++,t),after,t];}),ET=function(opts){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['51']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['317']++;var etState=this._yuievt,etConfig;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['318']++;if(!etState){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['113'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['319']++;etState=this._yuievt={events:{},targets:null,config:{host:this,context:this},chain:Y.config.chain};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['113'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['320']++;etConfig=etState.config;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['321']++;if(opts){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['114'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['322']++;mixConfigs(etConfig,opts,true);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['323']++;if(opts.chain!==undefined){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['115'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['324']++;etState.chain=opts.chain;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['115'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['325']++;if(opts.prefix){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['116'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['326']++;etConfig.prefix=opts.prefix;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['116'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['114'][1]++;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['327']++;ET.prototype={constructor:ET,once:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['52']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['328']++;var handle=this.on.apply(this,arguments);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['329']++;handle.batch(function(hand){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['53']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['330']++;if(hand.sub){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['117'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['331']++;hand.sub.once=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['117'][1]++;}});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['332']++;return handle;},onceAfter:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['54']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['333']++;var handle=this.after.apply(this,arguments);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['334']++;handle.batch(function(hand){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['55']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['335']++;if(hand.sub){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['118'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['336']++;hand.sub.once=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['118'][1]++;}});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['337']++;return handle;},parseType:function(type,pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['56']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['338']++;return _parseType(type,(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['119'][0]++,pre)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['119'][1]++,this._yuievt.config.prefix));},on:function(type,fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['57']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['339']++;var yuievt=this._yuievt,parts=_parseType(type,yuievt.config.prefix),f,c,args,ret,ce,detachcategory,handle,store=Y.Env.evt.handles,after,adapt,shorttype,Node=Y.Node,n,domevent,isArr;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['340']++;this._monitor('attach',parts[1],{args:arguments,category:parts[0],after:parts[2]});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['341']++;if(L.isObject(type)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['120'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['342']++;if(L.isFunction(type)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['121'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['343']++;return Y.Do.before.apply(Y.Do,arguments);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['121'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['344']++;f=fn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['345']++;c=context;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['346']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['347']++;ret=[];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['348']++;if(L.isArray(type)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['122'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['349']++;isArr=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['122'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['350']++;after=type._after;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['351']++;delete type._after;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['352']++;Y.each(type,function(v,k){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['58']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['353']++;if(L.isObject(v)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['123'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['354']++;f=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['124'][0]++,v.fn)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['124'][1]++,L.isFunction(v)?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['125'][0]++,v):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['125'][1]++,f));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['355']++;c=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['126'][0]++,v.context)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['126'][1]++,c);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['123'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['356']++;var nv=after?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['127'][0]++,AFTER_PREFIX):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['127'][1]++,'');__cov_0ShtDtxkEapLmfzOgrY8Kw.s['357']++;args[0]=nv+(isArr?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['128'][0]++,v):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['128'][1]++,k));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['358']++;args[1]=f;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['359']++;args[2]=c;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['360']++;ret.push(this.on.apply(this,args));},this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['361']++;return yuievt.chain?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['129'][0]++,this):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['129'][1]++,new Y.EventHandle(ret));}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['120'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['362']++;detachcategory=parts[0];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['363']++;after=parts[2];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['364']++;shorttype=parts[3];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['365']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['131'][0]++,Node)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['131'][1]++,Y.instanceOf(this,Node))&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['131'][2]++,shorttype in Node.DOM_EVENTS)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['130'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['366']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['367']++;args.splice(2,0,Node.getDOMNode(this));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['368']++;return Y.on.apply(Y,args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['130'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['369']++;type=parts[1];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['370']++;if(Y.instanceOf(this,YUI)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['132'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['371']++;adapt=Y.Env.evt.plugins[type];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['372']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['373']++;args[0]=shorttype;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['374']++;if(Node){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['133'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['375']++;n=args[2];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['376']++;if(Y.instanceOf(n,Y.NodeList)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['134'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['377']++;n=Y.NodeList.getDOMNodes(n);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['134'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['378']++;if(Y.instanceOf(n,Node)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['135'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['379']++;n=Node.getDOMNode(n);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['135'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['380']++;domevent=shorttype in Node.DOM_EVENTS;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['381']++;if(domevent){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['136'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['382']++;args[2]=n;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['136'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['133'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['383']++;if(adapt){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['137'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['384']++;handle=adapt.on.apply(Y,args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['137'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['385']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['139'][0]++,!type)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['139'][1]++,domevent)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['138'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['386']++;handle=Y.Event._attach(args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['138'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['132'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['387']++;if(!handle){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['140'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['388']++;ce=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['141'][0]++,yuievt.events[type])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['141'][1]++,this.publish(type));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['389']++;handle=ce._on(fn,context,arguments.length>3?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['142'][0]++,nativeSlice.call(arguments,3)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['142'][1]++,null),after?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['143'][0]++,'after'):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['143'][1]++,true));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['390']++;if(type.indexOf('*:')!==-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['144'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['391']++;this._hasSiblings=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['144'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['140'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['392']++;if(detachcategory){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['145'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['393']++;store[detachcategory]=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['146'][0]++,store[detachcategory])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['146'][1]++,{});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['394']++;store[detachcategory][type]=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['147'][0]++,store[detachcategory][type])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['147'][1]++,[]);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['395']++;store[detachcategory][type].push(handle);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['145'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['396']++;return yuievt.chain?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['148'][0]++,this):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['148'][1]++,handle);},subscribe:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['59']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['397']++;return this.on.apply(this,arguments);},detach:function(type,fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['60']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['398']++;var evts=this._yuievt.events,i,Node=Y.Node,isNode=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['149'][0]++,Node)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['149'][1]++,Y.instanceOf(this,Node));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['399']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['151'][0]++,!type)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['151'][1]++,this!==Y)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['150'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['400']++;for(i in evts){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['401']++;if(evts.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['152'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['402']++;evts[i].detach(fn,context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['152'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['403']++;if(isNode){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['153'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['404']++;Y.Event.purgeElement(Node.getDOMNode(this));}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['153'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['405']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['150'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['406']++;var parts=_parseType(type,this._yuievt.config.prefix),detachcategory=L.isArray(parts)?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['154'][0]++,parts[0]):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['154'][1]++,null),shorttype=parts?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['155'][0]++,parts[3]):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['155'][1]++,null),adapt,store=Y.Env.evt.handles,detachhost,cat,args,ce,keyDetacher=function(lcat,ltype,host){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['61']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['407']++;var handles=lcat[ltype],ce,i;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['408']++;if(handles){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['156'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['409']++;for(i=handles.length-1;i>=0;--i){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['410']++;ce=handles[i].evt;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['411']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['158'][0]++,ce.host===host)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['158'][1]++,ce.el===host)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['157'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['412']++;handles[i].detach();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['157'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['156'][1]++;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['413']++;if(detachcategory){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['159'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['414']++;cat=store[detachcategory];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['415']++;type=parts[1];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['416']++;detachhost=isNode?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['160'][0]++,Y.Node.getDOMNode(this)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['160'][1]++,this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['417']++;if(cat){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['161'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['418']++;if(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['162'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['419']++;keyDetacher(cat,type,detachhost);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['162'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['420']++;for(i in cat){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['421']++;if(cat.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['163'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['422']++;keyDetacher(cat,i,detachhost);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['163'][1]++;}}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['423']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['161'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['159'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['424']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['165'][0]++,L.isObject(type))&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['165'][1]++,type.detach)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['164'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['425']++;type.detach();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['426']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['164'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['427']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['167'][0]++,isNode)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['167'][1]++,!shorttype)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['167'][2]++,shorttype in Node.DOM_EVENTS))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['166'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['428']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['429']++;args[2]=Node.getDOMNode(this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['430']++;Y.detach.apply(Y,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['431']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['166'][1]++;}}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['432']++;adapt=Y.Env.evt.plugins[shorttype];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['433']++;if(Y.instanceOf(this,YUI)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['168'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['434']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['435']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['170'][0]++,adapt)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['170'][1]++,adapt.detach)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['169'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['436']++;adapt.detach.apply(Y,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['437']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['169'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['438']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][0]++,!type)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][1]++,!adapt)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][2]++,Node)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][3]++,type in Node.DOM_EVENTS)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['171'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['439']++;args[0]=type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['440']++;Y.Event.detach.apply(Y.Event,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['441']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['171'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['168'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['442']++;ce=evts[parts[1]];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['443']++;if(ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['173'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['444']++;ce.detach(fn,context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['173'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['445']++;return this;},unsubscribe:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['62']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['446']++;return this.detach.apply(this,arguments);},detachAll:function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['63']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['447']++;return this.detach(type);},unsubscribeAll:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['64']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['448']++;return this.detachAll.apply(this,arguments);},publish:function(type,opts){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['65']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['449']++;var ret,etState=this._yuievt,etConfig=etState.config,pre=etConfig.prefix;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['450']++;if(typeof type==='string'){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['174'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['451']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['175'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['452']++;type=_getType(type,pre);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['175'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['453']++;ret=this._publish(type,etConfig,opts);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['174'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['454']++;ret={};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['455']++;Y.each(type,function(v,k){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['66']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['456']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['176'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['457']++;k=_getType(k,pre);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['176'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['458']++;ret[k]=this._publish(k,etConfig,(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['177'][0]++,v)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['177'][1]++,opts));},this);}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['459']++;return ret;},_getFullType:function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['67']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['460']++;var pre=this._yuievt.config.prefix;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['461']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['178'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['462']++;return pre+PREFIX_DELIMITER+type;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['178'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['463']++;return type;}},_publish:function(fullType,etOpts,ceOpts){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['68']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['464']++;var ce,etState=this._yuievt,etConfig=etState.config,host=etConfig.host,context=etConfig.context,events=etState.events;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['465']++;ce=events[fullType];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['466']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][0]++,etConfig.monitored)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][1]++,!ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][2]++,ce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][3]++,ce.monitored)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['179'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['467']++;this._monitor('publish',fullType,{args:arguments});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['179'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['468']++;if(!ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['181'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['469']++;ce=events[fullType]=new Y.CustomEvent(fullType,etOpts);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['470']++;if(!etOpts){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['182'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['471']++;ce.host=host;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['472']++;ce.context=context;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['182'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['181'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['473']++;if(ceOpts){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['183'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['474']++;mixConfigs(ce,ceOpts,true);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['183'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['475']++;return ce;},_monitor:function(what,eventType,o){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['69']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['476']++;var monitorevt,ce,type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['477']++;if(eventType){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['184'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['478']++;if(typeof eventType==='string'){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['185'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['479']++;type=eventType;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['480']++;ce=this.getEvent(eventType,true);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['185'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['481']++;ce=eventType;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['482']++;type=eventType.type;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['483']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][0]++,this._yuievt.config.monitored)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][1]++,!ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][2]++,ce.monitored))||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][3]++,ce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][4]++,ce.monitored)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['186'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['484']++;monitorevt=type+'_'+what;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['485']++;o.monitored=what;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['486']++;this.fire.call(this,monitorevt,o);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['186'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['184'][1]++;}},fire:function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['70']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['487']++;var typeIncluded=typeof type==='string',argCount=arguments.length,t=type,yuievt=this._yuievt,etConfig=yuievt.config,pre=etConfig.prefix,ret,ce,ce2,args;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['488']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['189'][0]++,typeIncluded)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['189'][1]++,argCount<=3)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['188'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['489']++;if(argCount===2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['190'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['490']++;args=[arguments[1]];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['190'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['491']++;if(argCount===3){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['191'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['492']++;args=[arguments[1],arguments[2]];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['191'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['493']++;args=[];}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['188'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['494']++;args=nativeSlice.call(arguments,typeIncluded?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['192'][0]++,1):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['192'][1]++,0));}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['495']++;if(!typeIncluded){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['193'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['496']++;t=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['194'][0]++,type)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['194'][1]++,type.type);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['193'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['497']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['195'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['498']++;t=_getType(t,pre);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['195'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['499']++;ce=yuievt.events[t];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['500']++;if(this._hasSiblings){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['196'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['501']++;ce2=this.getSibling(t,ce);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['502']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['198'][0]++,ce2)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['198'][1]++,!ce)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['197'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['503']++;ce=this.publish(t);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['197'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['196'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['504']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][0]++,etConfig.monitored)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][1]++,!ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][2]++,ce.monitored))||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][3]++,ce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][4]++,ce.monitored)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['505']++;this._monitor('fire',(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['201'][0]++,ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['201'][1]++,t),{args:args});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['506']++;if(!ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['202'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['507']++;if(yuievt.hasTargets){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['203'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['508']++;return this.bubble({type:t},args,this);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['203'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['509']++;ret=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['202'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['510']++;if(ce2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['204'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['511']++;ce.sibling=ce2;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['204'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['512']++;ret=ce._fire(args);}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['513']++;return yuievt.chain?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['205'][0]++,this):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['205'][1]++,ret);},getSibling:function(type,ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['71']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['514']++;var ce2;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['515']++;if(type.indexOf(PREFIX_DELIMITER)>-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['206'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['516']++;type=_wildType(type);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['517']++;ce2=this.getEvent(type,true);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['518']++;if(ce2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['207'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['519']++;ce2.applyConfig(ce);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['520']++;ce2.bubbles=false;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['521']++;ce2.broadcast=0;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['207'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['206'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['522']++;return ce2;},getEvent:function(type,prefixed){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['72']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['523']++;var pre,e;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['524']++;if(!prefixed){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['208'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['525']++;pre=this._yuievt.config.prefix;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['526']++;type=pre?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['209'][0]++,_getType(type,pre)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['209'][1]++,type);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['208'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['527']++;e=this._yuievt.events;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['528']++;return(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['210'][0]++,e[type])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['210'][1]++,null);},after:function(type,fn){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['73']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['529']++;var a=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['530']++;switch(L.type(type)){case'function':__cov_0ShtDtxkEapLmfzOgrY8Kw.b['211'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['531']++;return Y.Do.after.apply(Y.Do,arguments);case'array':__cov_0ShtDtxkEapLmfzOgrY8Kw.b['211'][1]++;case'object':__cov_0ShtDtxkEapLmfzOgrY8Kw.b['211'][2]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['532']++;a[0]._after=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['533']++;break;default:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['211'][3]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['534']++;a[0]=AFTER_PREFIX+type;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['535']++;return this.on.apply(this,a);},before:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['74']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['536']++;return this.on.apply(this,arguments);}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['537']++;Y.EventTarget=ET;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['538']++;Y.mix(Y,ET.prototype);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['539']++;ET.call(Y,{bubbles:false});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['540']++;YUI.Env.globalEvents=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['212'][0]++,YUI.Env.globalEvents)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['212'][1]++,new ET());__cov_0ShtDtxkEapLmfzOgrY8Kw.s['541']++;Y.Global=YUI.Env.globalEvents;},'@VERSION@',{'requires':['oop']});
|
public/js/components/TestComp.react.js | TRomesh/Coupley | import React from 'react';
const TestComp = React.createClass({
render () {
return (
<div>
Alo alo !
</div>
);
},
});
export default TestComp; |
pages/lab/about.js | cherniavskii/material-ui | import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from 'docs/src/pages/lab/about/about.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default withRoot(Page);
|
src/main/resources/public/js/components/CSVReader.js | ozwillo/ozwillo-portal | import React from 'react';
import PropTypes from 'prop-types';
import Tools from "../util/tools";
import { i18n } from "../config/i18n-config"
export default class CSVReader extends React.Component {
constructor() {
super();
this._tools = new Tools();
}
state = {
error: null,
fileName: ""
};
componentDidMount(){
this.props.fileName ? this.setState({fileName: this.props.fileName}) : null;
}
cleanInput = () => {
this.inputFile.value = "";
this.setState({fileName: ""});
};
_sanitizeEmailArray = (emailArray) => {
return emailArray.filter(email => this._tools.checkEmail(email));
};
_parseCSVData = (value) => {
let resultArray = value.trim().split(/[\r\n]+/g);
resultArray.filter(elm => elm !== "");
resultArray = this._sanitizeEmailArray(resultArray);
this.props.onFileRead(resultArray);
};
_extractData = (e) => {
let reader = new FileReader();
let files = e.target.files;
//check if that is a real csv
try {
if (files && files.length > 0 && files[0].name.match('.csv')) {
this._extractFileName();
this.props.onFileReading();
reader.onload = () => {
this._parseCSVData(reader.result)
};
reader.readAsText(files[0]);
this.setState({error: null})
} else if(files && files.length > 0) {
this.setState({error: i18n._('error.msg.csv-file-required')});
this.cleanInput();
}
} catch (e) {
this.cleanInput();
this.setState({error: e});
}
};
_extractFileName = () => {
const fileName = this.inputFile.value.split(/.*[\/|\\]/).pop();
this.setState({fileName: fileName})
return fileName;
};
render() {
const {error, fileName} = this.state;
const {requiered} = this.props;
return (
<div className={"csv-reader"}>
<label className="label btn btn-default" htmlFor="fileSelect">
{i18n._("organization.desc.choose-file")}
</label>
<p>
{fileName}
</p>
<input ref={inputFile => this.inputFile = inputFile}
className={"field"} required={requiered}
id="fileSelect" type="file"
accept=".csv" onChange={this._extractData}/>
{error && <div className={"csv-error"}>{error}</div>}
</div>
)
}
}
CSVReader.propTypes = {
onFileRead: PropTypes.func,
onFileReading: PropTypes.func,
fileName: PropTypes.string,
};
|
src/components/Home.js | HZ-1/HZ-1.github.io | import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
age: props.initialAge,
status: 0,
homeLink: props.initialName
}
setTimeout(() => {
this.setState({
status: 1
})
}, 3000)
console.log('Constructor');
}
onMakeOlder() {
this.setState({
age: this.state.age + 3
})
}
handleGreet() {
this.props.greet(this.state.age)
}
onChangeLink() {
this.props.changeLink(this.state.homeLink);
}
onHandleChange(event) {
this.setState({
homeLink: event.target.value
})
}
componentWillMount() {
console.log("Component will mount");
}
componentDidMount() {
console.log("Component did mount");
}
componentWillReceiveProps(nextProps) {
console.log('Component will receive props', nextProps);
}
shouldComponentUpdate(nextProps, nextState) {
console.log('Component should update', nextProps, nextState);
if (nextState.status === 1) {
return false;
}
return true;
}
componentWillUpdate(nextProps, nextState) {
console.log('Component will update', nextProps, nextState);
}
componentDidUpdate(prevProps, prevState) {
console.log('Component did update', prevProps, prevState);
}
componentWillUnmount() {
console.log('Component will unmount');
}
render() {
console.log('render');
return (
<div className="container">
<div className="row">
<div className="col-xs-1 col-xs-offset-11">
<div>your name is {this.props.name}, your age is {this.state.age}</div>
<p>Status: {this.state.status}</p>
<button onClick={() => {this.onMakeOlder()}} className="btn btn-primary">Make me older</button>
<hr />
<button onClick={this.handleGreet.bind(this)} className="btn btn-primary">Greet</button>
<hr />
<input
type="text"
defaultValue={this.props.initialName}
value={this.state.initialName}
onChange={(event) => this.onHandleChange(event)}
/>
<button onClick={this.onChangeLink.bind(this)} className="btn btn-primary">Change Header Link</button>
</div>
</div>
</div>
);
}
}
Home.propTypes = {
name: PropTypes.string,
age: PropTypes.number,
user: PropTypes.object,
greet: PropTypes.func,
initialName: PropTypes.string
};
|
node_modules/react-icons/io/social-dribbble-outline.js | bairrada97/festival |
import React from 'react'
import Icon from 'react-icon-base'
const IoSocialDribbbleOutline = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m20 5c8.3 0 15 6.7 15 15s-6.7 15-15 15-15-6.7-15-15 6.7-15 15-15z m9.5 6.9c-1.3 1.9-3.6 3.6-6.6 5 0.4 0.8 0.7 1.5 1 2.4 2.6-0.2 5.9-0.3 8.6-0.2-0.2-2.7-1.2-5.3-3-7.2z m-9.5-4.4c-1.1 0-2 0.2-3 0.4 1.8 1.8 3.3 4.1 4.8 6.8 2.7-1.1 4.8-2.6 6.2-4.3-2.2-1.8-5-2.9-8-2.9z m-5.6 1.4c-3.2 1.6-5.6 4.5-6.5 8.1h1.9c3.5 0 6.7-0.5 9.5-1.4-1.5-2.6-3.1-4.9-4.9-6.7z m-6.9 10.5v0.6c0 3.1 1.2 6.1 3.1 8.3 1.9-3.5 5.3-6.5 9.6-8.3 0.3-0.2 0.6-0.2 1.1-0.3-0.3-0.6-0.5-1.3-0.8-1.9-3.2 1-6.9 1.6-10.8 1.7-0.7 0-1.5-0.1-2.2-0.1z m12.5 13.1c1.6 0 3-0.2 4.5-0.8-0.3-1.9-0.7-4.1-1.2-6.2-0.3-1.3-0.8-2.5-1.3-3.8-0.5 0.2-1 0.3-1.3 0.5-3.7 1.7-6.7 4.4-8.4 7.6 2.2 1.7 4.8 2.7 7.7 2.7z m6.7-2c3.1-2.1 5.3-5.3 5.7-9.1-2.3-0.1-5.3-0.2-7.7 0 0.3 0.9 0.7 2 0.9 3 0.6 2.1 0.9 4 1.1 6.1z"/></g>
</Icon>
)
export default IoSocialDribbbleOutline
|
ajax/libs/yui/3.7.3/event-custom-base/event-custom-base-debug.js | smcguinness/cdnjs | YUI.add('event-custom-base', function (Y, NAME) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
* @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object
* replaces the role of this property, but is considered to be private, and
* is only mentioned to provide a migration path.
*
* If you have a use case which warrants migration to the _yuiaop property,
* please file a ticket to let us know what it's used for and we can see if
* we need to expose hooks for that functionality more formally.
*/
objs: null,
/**
* <p>Execute the supplied method before the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
* <dd>Replace the arguments that the original function will be
* called with.</dd>
* <dt></code>Y.Do.Prevent(message)</code></dt>
* <dd>Don't execute the wrapped function. Other before phase
* wrappers will be executed.</dd>
* </dl>
*
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {string} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
// Y.log('Do before: ' + sFn, 'info', 'event');
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* <p>Execute the supplied method after the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
* <dd>Return <code>returnValue</code> instead of the wrapped
* method's original return value. This can be further altered by
* other after phase wrappers.</dd>
* </dl>
*
* <p>The static properties <code>Y.Do.originalRetVal</code> and
* <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
*
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {string} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method before or after the specified function.
* Used by <code>before</code> and <code>after</code>.
*
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (!obj._yuiaop) {
// create a map entry for the obj if it doesn't exist, to hold overridden methods
obj._yuiaop = {};
}
o = obj._yuiaop;
if (!o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] = function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription.
*
* @method detach
* @param handle {string} the subscription handle
* @static
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
},
_unload: function(e, me) {
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property originalRetVal
* @static
* @since 3.2.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property currentRetVal
* @static
* @since 3.2.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
// Y.log('Y.Do._delete: ' + sid, 'info', 'Event');
delete this.before[sid];
delete this.after[sid];
};
/**
* <p>Execute the wrapped method. All arguments are passed into the wrapping
* functions. If any of the before wrappers return an instance of
* <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
* function nor any after phase subscribers will be executed.</p>
*
* <p>The return value will be the return value of the wrapped function or one
* provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
* <code>Y.Do.AlterReturn</code>.
*
* @method exec
* @param arg* {any} Arguments are passed to the wrapping and wrapped functions
* @return {any} Return value of wrapped function unless overwritten (see above)
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor == DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor == DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. Useful for Do.before subscribers. An
* example would be a service that scrubs out illegal characters prior to
* executing the core business logic.
* @class Do.AlterArgs
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newArgs {Array} Call parameters to be used for the original method
* instead of the arguments originally passed in.
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller. Useful for Do.after subscribers.
* @class Do.AlterReturn
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newRetVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet. Useful for Do.before subscribers.
* @class Do.Halt
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute. Useful
* for Do.before subscribers.
* @class Do.Prevent
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var YArray = Y.Array,
AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
CONFIGS_HASH = YArray.hash(CONFIGS),
nativeSlice = Array.prototype.slice,
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log',
mixConfigs = function(r, s, ov) {
var p;
for (p in s) {
if (CONFIGS_HASH[p] && (ov || !(p in r))) {
r[p] = s[p];
}
}
return r;
};
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} o configuration object.
* @class CustomEvent
* @constructor
*/
Y.CustomEvent = function(type, o) {
this._kds = Y.CustomEvent.keepDeprecatedSubs;
o = o || {};
this.id = Y.stamp(this);
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
this.type = type;
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
this.context = Y;
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
// this.monitored = false;
this.logSystem = (type == YUI_LOG);
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
// this.broadcast = 0;
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
this.silent = this.logSystem;
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
// this.queuable = false;
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
* @deprecated
*/
if (this._kds) {
this.subscribers = {};
}
/**
* The subscribers to this event
* @property _subscribers
* @type Subscriber []
* @private
*/
this._subscribers = [];
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
*/
if (this._kds) {
this.afters = {};
}
/**
* 'After' subscribers
* @property _afters
* @type Subscriber []
* @private
*/
this._afters = [];
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
// this.fired = false;
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
// this.firedWith;
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
// this.fireOnce = false;
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
//this.async = false;
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
// this.stopped = 0;
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
// this.prevented = 0;
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
// this.host = null;
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
// this.defaultFn = null;
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
// this.stoppedFn = null;
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
// this.preventedFn = null;
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
this.preventable = true;
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
this.bubbles = true;
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
this.signature = YUI3_SIGNATURE;
// this.subCount = 0;
// this.afterCount = 0;
// this.hasSubscribers = false;
// this.hasAfters = false;
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
// this.emitFacade = false;
this.applyConfig(o, true);
// this.log("Creating " + this.type);
};
/**
* Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a>
* and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance.
*
* These properties were changed to private properties (`_subscribers` and `_afters`), and
* converted from objects to arrays for performance reasons.
*
* Setting this property to true will populate the deprecated `subscribers` and `afters`
* properties for people who may be using them (which is expected to be rare). There will
* be a performance hit, compared to the new array based implementation.
*
* If you are using these deprecated properties for a use case which the public API
* does not support, please file an enhancement request, and we can provide an alternate
* public implementation which doesn't have the performance cost required to maintiain the
* properties as objects.
*
* @property keepDeprecatedSubs
* @static
* @for CustomEvent
* @type boolean
* @default false
* @deprecated
*/
Y.CustomEvent.keepDeprecatedSubs = false;
Y.CustomEvent.mixConfigs = mixConfigs;
Y.CustomEvent.prototype = {
constructor: Y.CustomEvent,
/**
* Returns the number of subscribers for this event as the sum of the on()
* subscribers and after() subscribers.
*
* @method hasSubs
* @return Number
*/
hasSubs: function(when) {
var s = this._subscribers.length, a = this._afters.length, sib = this.sibling;
if (sib) {
s += sib._subscribers.length;
a += sib._afters.length;
}
if (when) {
return (when == 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = nativeSlice.call(arguments, 0);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var s = this._subscribers, a = this._afters, sib = this.sibling;
s = (sib) ? s.concat(sib._subscribers) : s.concat();
a = (sib) ? a.concat(sib._afters) : a.concat();
return [s, a];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
mixConfigs(this, o, force);
},
/**
* Create the Subscription for subscribing function, context, and bound
* arguments. If this is a fireOnce event, the subscriber is immediately
* notified.
*
* @method _on
* @param fn {Function} Subscription callback
* @param [context] {Object} Override `this` in the callback
* @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()
* @param [when] {String} "after" to slot into after subscribers
* @return {EventHandle}
* @protected
*/
_on: function(fn, context, args, when) {
if (!fn) { this.log('Invalid callback for CE: ' + this.type); }
var s = new Y.Subscriber(fn, context, args, when);
if (this.fireOnce && this.fired) {
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0);
} else {
this._notify(s, this.firedWith);
}
}
if (when == AFTER) {
this._afters.push(s);
} else {
this._subscribers.push(s);
}
if (this._kds) {
if (when == AFTER) {
this.afters[s.id] = s;
} else {
this.subscribers[s.id] = s;
}
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated');
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
if (this.monitored && this.host) {
this.host._monitor('attach', this, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = this._subscribers,
afters = this._afters;
for (i = subs.length; i >= 0; i--) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, subs, i);
found++;
}
}
for (i = afters.length; i >= 0; i--) {
s = afters[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, afters, i);
found++;
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @protected
*/
_notify: function(s, args, ef) {
this.log(this.type + '->' + 'sub: ' + s.id);
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
this.log(this.type + ' cancelled by subscriber');
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
if (!this.silent) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); }
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
if (this.fireOnce && this.fired) {
this.log('fireOnce event: ' + this.type + ' already fired');
return true;
} else {
var args = nativeSlice.call(arguments, 0);
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
if (this.fireOnce) {
this.firedWith = args;
}
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
/**
* Set up for notifying subscribers of non-emitFacade events.
*
* @method fireSimple
* @param args {Array} Arguments passed to fire()
* @return Boolean false if a subscriber returned false
* @protected
*/
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
this._broadcast(args);
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
this.log('Missing event-custom-complex needed to emit a facade for: ' + this.type);
args[0] = args[0] || {};
return this.fireSimple(args);
},
/**
* Notifies a list of subscribers.
*
* @method _procSubs
* @param subs {Array} List of subscribers
* @param args {Array} Arguments passed to fire()
* @param ef {}
* @return Boolean false if a subscriber returns false or stops the event
* propagation via e.stopPropagation(),
* e.stopImmediatePropagation(), or e.halt()
* @private
*/
_procSubs: function(subs, args, ef) {
var s, i, l;
for (i = 0, l = subs.length; i < l; i++) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped == 2) {
return false;
}
}
}
return true;
},
/**
* Notifies the YUI instance if the event is configured with broadcast = 1,
* and both the YUI instance and Y.Global if configured with broadcast = 2.
*
* @method _broadcast
* @param args {Array} Arguments sent to fire()
* @private
*/
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = args.concat();
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast == 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {int} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {int} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* Deletes the subscriber from the internal store of on() and after()
* subscribers.
*
* @method _delete
* @param s subscriber object.
* @param subs (optional) on or after subscriber array
* @param index (optional) The index found.
* @private
*/
_delete: function(s, subs, i) {
var when = s._when;
if (!subs) {
subs = (when === AFTER) ? this._afters : this._subscribers;
i = YArray.indexOf(subs, s, 0);
}
if (s && subs[i] === s) {
subs.splice(i, 1);
}
if (this._kds) {
if (when === AFTER) {
delete this.afters[s.id];
} else {
delete this.subscribers[s.id];
}
}
if (this.monitored && this.host) {
this.host._monitor('detach', this, {
ce: this,
sub: s
});
}
if (s) {
s.deleted = true;
}
}
};
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args, when) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.stamp(this);
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
this._when = when;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
constructor: Y.Subscriber,
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config && Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn == fn) && this.context == context);
} else {
return (this.fn == fn);
}
},
valueOf : function() {
return this.id;
}
};
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
*
* @property evt
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
*
* @property sub
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {int} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
// Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event');
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {String} the prefix to apply to non-prefixed event names
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
WILD_TYPE_RE = /(.*?)(:)(.*?)/,
_wildType = Y.cached(function(type) {
return type.replace(WILD_TYPE_RE, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = Y.cached(function(type, pre) {
if (!pre || (typeof type !== "string") || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
}),
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
// Y.log(t);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t == '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
// Y.log('EventTarget constructor executed: ' + this._yuid);
var o = (L.isObject(opts)) ? opts : {};
this._yuievt = this._yuievt || {
id: Y.guid(),
events: {},
targets: {},
config: o,
chain: ('chain' in o) ? o.chain : Y.config.chain,
bubbling: false,
defaults: {
context: o.context || this,
host: this,
emitFacade: o.emitFacade,
fireOnce: o.fireOnce,
queuable: o.queuable,
monitored: o.monitored,
broadcast: o.broadcast,
defaultTargetOnly: o.defaultTargetOnly,
bubbles: ('bubbles' in o) ? o.bubbles : true
}
};
};
ET.prototype = {
constructor: ET,
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>after</code> except the
* listener is immediatelly detached when it is executed.
* @method onceAfter
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
onceAfter: function() {
var handle = this.after.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {String} type the type
* @param {String} [pre=this._yuievt.config.prefix] the prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe a callback function to a custom event fired by this object or
* from an object that bubbles its events to this object.
*
* Callback functions for events published with `emitFacade = true` will
* receive an `EventFacade` as the first argument (typically named "e").
* These callbacks can then call `e.preventDefault()` to disable the
* behavior published to that event's `defaultFn`. See the `EventFacade`
* API for all available properties and methods. Subscribers to
* non-`emitFacade` events will receive the arguments passed to `fire()`
* after the event name.
*
* To subscribe to multiple events at once, pass an object as the first
* argument, where the key:value pairs correspond to the eventName:callback,
* or pass an array of event names as the first argument to subscribe to
* all listed events with the same callback.
*
* Returning `false` from a callback is supported as an alternative to
* calling `e.preventDefault(); e.stopPropagation();`. However, it is
* recommended to use the event methods whenever possible.
*
* @method on
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
on: function(type, fn, context) {
var yuievt = this._yuievt,
parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = nativeSlice.call(arguments, 0);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = nativeSlice.call(arguments, 0);
args.splice(2, 0, Node.getDOMNode(this));
// Y.log("Node detected, redirecting with these args: " + args);
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = nativeSlice.call(arguments, 0);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event');
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated');
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events, i,
Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = nativeSlice.call(arguments, 0);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = nativeSlice.call(arguments, 0);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated');
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {String} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {String} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated');
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {String} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* </li>
* <li>
* 'bubbles': whether or not this event bubbles (true)
* Events can only bubble if emitFacade is true.
* </li>
* <li>
* 'context': the default execution context for the listeners (this)
* </li>
* <li>
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
* </li>
* <li>
* 'emitFacade': whether or not this event emits a facade (false)
* </li>
* <li>
* 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'
* </li>
* <li>
* 'fireOnce': if an event is configured to fire once, new subscribers after
* the fire will be notified immediately.
* </li>
* <li>
* 'async': fireOnce event listeners will fire synchronously if the event has already
* fired unless async is true.
* </li>
* <li>
* 'preventable': whether or not preventDefault() has an effect (true)
* </li>
* <li>
* 'preventedFn': a function that is executed when preventDefault is called
* </li>
* <li>
* 'queuable': whether or not this event can be queued during bubbling (false)
* </li>
* <li>
* 'silent': if silent is true, debug messages are not provided for this event.
* </li>
* <li>
* 'stoppedFn': a function that is executed when stopPropagation is called
* </li>
*
* <li>
* 'monitored': specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* </li>
* <li>
* 'type': the event type (valid option if not provided as the first parameter to publish)
* </li>
* </ul>
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var events, ce, ret, defaults,
edata = this._yuievt,
pre = edata.config.prefix;
if (L.isObject(type)) {
ret = {};
Y.each(type, function(v, k) {
ret[k] = this.publish(k, v || opts);
}, this);
return ret;
}
type = (pre) ? _getType(type, pre) : type;
events = edata.events;
ce = events[type];
this._monitor('publish', type, {
args: arguments
});
if (ce) {
// ce.log("publish applying new config to published event: '"+type+"' exists", 'info', 'event');
if (opts) {
ce.applyConfig(opts, true);
}
} else {
// TODO: Lazy publish goes here.
defaults = edata.defaults;
// apply defaults
ce = new Y.CustomEvent(type, defaults);
if (opts) {
ce.applyConfig(opts, true);
}
events[type] = ce;
}
// make sure we turn the broadcast flag off if this
// event was published as a result of bubbling
// if (opts instanceof Y.CustomEvent) {
// events[type].broadcast = false;
// }
return events[type];
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @method _monitor
* @param what {String} 'attach', 'detach', 'fire', or 'publish'
* @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object.
* @param o {Object} Information about the event interaction, such as
* fire() args, subscription category, publish config
* @private
*/
_monitor: function(what, eventType, o) {
var monitorevt, ce, type;
if (eventType) {
if (typeof eventType === "string") {
type = eventType;
ce = this.getEvent(eventType, true);
} else {
ce = eventType;
type = eventType.type;
}
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {EventTarget} the event host
*/
fire: function(type) {
var typeIncluded = L.isString(type),
t = (typeIncluded) ? type : (type && type.type),
yuievt = this._yuievt,
pre = yuievt.config.prefix,
ce, ret,
ce2,
args = (typeIncluded) ? nativeSlice.call(arguments, 1) : arguments;
t = (pre) ? _getType(t, pre) : t;
ce = this.getEvent(t, true);
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
this._monitor('fire', (ce || t), {
args: args
});
// this event has not been published or subscribed to
if (!ce) {
if (yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
ce.sibling = ce2;
ret = ce.fire.apply(ce, args);
}
return (yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
// console.log(type);
ce2 = this.getEvent(type, true);
if (ce2) {
// console.log("GOT ONE: " + type);
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
// ret = ce2.fire.apply(ce2, a);
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {String} the type, or name of the event
* @param prefixed {String} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
*
* @method after
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
after: function(type, fn) {
var a = nativeSlice.call(arguments, 0);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype);
ET.call(Y, { bubbles: false });
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
`Y.on()` can do many things:
<ul>
<li>Subscribe to custom events `publish`ed and `fire`d from Y</li>
<li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and
`fire`d from any object in the YUI instance sandbox</li>
<li>Subscribe to DOM events</li>
<li>Subscribe to the execution of a method on any object, effectively
treating that method as an event</li>
</ul>
For custom event subscriptions, pass the custom event name as the first argument and callback as the second. The `this` object in the callback will be `Y` unless an override is passed as the third argument.
Y.on('io:complete', function () {
Y.MyApp.updateStatus('Transaction complete');
});
To subscribe to DOM events, pass the name of a DOM event as the first argument
and a CSS selector string as the third argument after the callback function.
Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,
array, or simply omitted (the default is the `window` object).
Y.on('click', function (e) {
e.preventDefault();
// proceed with ajax form submission
var url = this.get('action');
...
}, '#my-form');
The `this` object in DOM event callbacks will be the `Node` targeted by the CSS
selector or other identifier.
`on()` subscribers for DOM events or custom events `publish`ed with a
`defaultFn` can prevent the default behavior with `e.preventDefault()` from the
event object passed as the first parameter to the subscription callback.
To subscribe to the execution of an object method, pass arguments corresponding to the call signature for
<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>.
NOTE: The formal parameter list below is for events, not for function
injection. See `Y.Do.before` for that signature.
@method on
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@see Do.before
@for YUI
**/
/**
Listen for an event one time. Equivalent to `on()`, except that
the listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see on
@method once
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Listen for an event one time. Equivalent to `once()`, except, like `after()`,
the subscription callback executes after all `on()` subscribers and the event's
`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase
subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`
subscribers will execute.
The listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see once
@method onceAfter
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Like `on()`, this method creates a subscription to a custom event or to the
execution of a method on an object.
For events, `after()` subscribers are executed after the event's
`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
NOTE: The subscription signature shown is for events, not for function
injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a>
for that signature.
@see on
@see Do.after
@method after
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [args*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
}, '@VERSION@', {"requires": ["oop"]});
|
node_modules/babel-core/lib/transformation/file/options/removed.js | preetam-yadav/tncReactApp | "use strict";
module.exports = {
"auxiliaryComment": {
"message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
},
"blacklist": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"breakConfig": {
"message": "This is not a necessary option in Babel 6"
},
"experimental": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"externalHelpers": {
"message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
},
"extra": {
"message": ""
},
"jsxPragma": {
"message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
},
"loose": {
"message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
},
"metadataUsedHelpers": {
"message": "Not required anymore as this is enabled by default"
},
"modules": {
"message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
},
"nonStandard": {
"message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
},
"optional": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"sourceMapName": {
"message": "Use the `sourceMapTarget` option"
},
"stage": {
"message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
},
"whitelist": {
"message": "Put the specific transforms you want in the `plugins` option"
}
}; |
node_modules/react-bootstrap/es/Button.js | Chen-Hailin/iTCM.github.io | import _Object$values from 'babel-runtime/core-js/object/values';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _extends from 'babel-runtime/helpers/extends';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import elementType from 'react-prop-types/lib/elementType';
import { bsClass, bsSizes, bsStyles, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
import { Size, State, Style } from './utils/StyleConfig';
import SafeAnchor from './SafeAnchor';
var propTypes = {
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
block: React.PropTypes.bool,
onClick: React.PropTypes.func,
componentClass: elementType,
href: React.PropTypes.string,
/**
* Defines HTML button type attribute
* @defaultValue 'button'
*/
type: React.PropTypes.oneOf(['button', 'reset', 'submit'])
};
var defaultProps = {
active: false,
block: false,
disabled: false
};
var Button = function (_React$Component) {
_inherits(Button, _React$Component);
function Button() {
_classCallCheck(this, Button);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Button.prototype.renderAnchor = function renderAnchor(elementProps, className) {
return React.createElement(SafeAnchor, _extends({}, elementProps, {
className: classNames(className, elementProps.disabled && 'disabled')
}));
};
Button.prototype.renderButton = function renderButton(_ref, className) {
var componentClass = _ref.componentClass;
var elementProps = _objectWithoutProperties(_ref, ['componentClass']);
var Component = componentClass || 'button';
return React.createElement(Component, _extends({}, elementProps, {
type: elementProps.type || 'button',
className: className
}));
};
Button.prototype.render = function render() {
var _extends2;
var _props = this.props;
var active = _props.active;
var block = _props.block;
var className = _props.className;
var props = _objectWithoutProperties(_props, ['active', 'block', 'className']);
var _splitBsProps = splitBsProps(props);
var bsProps = _splitBsProps[0];
var elementProps = _splitBsProps[1];
var classes = _extends({}, getClassSet(bsProps), (_extends2 = {
active: active
}, _extends2[prefix(bsProps, 'block')] = block, _extends2));
var fullClassName = classNames(className, classes);
if (elementProps.href) {
return this.renderAnchor(elementProps, fullClassName);
}
return this.renderButton(elementProps, fullClassName);
};
return Button;
}(React.Component);
Button.propTypes = propTypes;
Button.defaultProps = defaultProps;
export default bsClass('btn', bsSizes([Size.LARGE, Size.SMALL, Size.XSMALL], bsStyles([].concat(_Object$values(State), [Style.DEFAULT, Style.PRIMARY, Style.LINK]), Style.DEFAULT, Button))); |
files/core-js/0.8.1/shim.js | Craga89/jsdelivr | /**
* Core.js 0.8.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(undefined){
var __e = null, __g = null;
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
require('./es5');
require('./es6.symbol');
require('./es6.object.assign');
require('./es6.object.is');
require('./es6.object.set-prototype-of');
require('./es6.object.to-string');
require('./es6.object.statics-accept-primitives');
require('./es6.function.name');
require('./es6.number.constructor');
require('./es6.number.statics');
require('./es6.math');
require('./es6.string.from-code-point');
require('./es6.string.raw');
require('./es6.string.iterator');
require('./es6.string.code-point-at');
require('./es6.string.ends-with');
require('./es6.string.includes');
require('./es6.string.repeat');
require('./es6.string.starts-with');
require('./es6.array.from');
require('./es6.array.of');
require('./es6.array.iterator');
require('./es6.array.species');
require('./es6.array.copy-within');
require('./es6.array.fill');
require('./es6.array.find');
require('./es6.array.find-index');
require('./es6.regexp');
require('./es6.promise');
require('./es6.map');
require('./es6.set');
require('./es6.weak-map');
require('./es6.weak-set');
require('./es6.reflect');
require('./es7.array.includes');
require('./es7.string.at');
require('./es7.regexp.escape');
require('./es7.object.get-own-property-descriptors');
require('./es7.object.to-array');
require('./web.immediate');
require('./web.dom.iterable');
require('./web.timers');
require('./js.array.statics');
},{"./es5":27,"./es6.array.copy-within":28,"./es6.array.fill":29,"./es6.array.find":31,"./es6.array.find-index":30,"./es6.array.from":32,"./es6.array.iterator":33,"./es6.array.of":34,"./es6.array.species":35,"./es6.function.name":36,"./es6.map":37,"./es6.math":38,"./es6.number.constructor":39,"./es6.number.statics":40,"./es6.object.assign":41,"./es6.object.is":42,"./es6.object.set-prototype-of":43,"./es6.object.statics-accept-primitives":44,"./es6.object.to-string":45,"./es6.promise":46,"./es6.reflect":47,"./es6.regexp":48,"./es6.set":49,"./es6.string.code-point-at":50,"./es6.string.ends-with":51,"./es6.string.from-code-point":52,"./es6.string.includes":53,"./es6.string.iterator":54,"./es6.string.raw":55,"./es6.string.repeat":56,"./es6.string.starts-with":57,"./es6.symbol":58,"./es6.weak-map":59,"./es6.weak-set":60,"./es7.array.includes":61,"./es7.object.get-own-property-descriptors":62,"./es7.object.to-array":63,"./es7.regexp.escape":64,"./es7.string.at":65,"./js.array.statics":66,"./web.dom.iterable":67,"./web.immediate":68,"./web.timers":69}],2:[function(require,module,exports){
'use strict';
// false -> Array#indexOf
// true -> Array#includes
var $ = require('./$');
module.exports = function(IS_INCLUDES){
return function(el /*, fromIndex = 0 */){
var O = $.toObject(this)
, length = $.toLength(O.length)
, index = $.toIndex(arguments[1], length)
, value;
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index;
} return !IS_INCLUDES && -1;
};
};
},{"./$":15}],3:[function(require,module,exports){
'use strict';
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var $ = require('./$')
, ctx = require('./$.ctx');
module.exports = function(TYPE){
var IS_MAP = TYPE == 1
, IS_FILTER = TYPE == 2
, IS_SOME = TYPE == 3
, IS_EVERY = TYPE == 4
, IS_FIND_INDEX = TYPE == 6
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function(callbackfn/*, that = undefined */){
var O = Object($.assertDefined(this))
, self = $.ES5Object(O)
, f = ctx(callbackfn, arguments[1], 3)
, length = $.toLength(self.length)
, index = 0
, result = IS_MAP ? Array(length) : IS_FILTER ? [] : undefined
, val, res;
for(;length > index; index++)if(NO_HOLES || index in self){
val = self[index];
res = f(val, index, O);
if(TYPE){
if(IS_MAP)result[index] = res; // map
else if(res)switch(TYPE){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(IS_EVERY)return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
},{"./$":15,"./$.ctx":10}],4:[function(require,module,exports){
var $ = require('./$');
function assert(condition, msg1, msg2){
if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1);
}
assert.def = $.assertDefined;
assert.fn = function(it){
if(!$.isFunction(it))throw TypeError(it + ' is not a function!');
return it;
};
assert.obj = function(it){
if(!$.isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
assert.inst = function(it, Constructor, name){
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
return it;
};
module.exports = assert;
},{"./$":15}],5:[function(require,module,exports){
var $ = require('./$');
// 19.1.2.1 Object.assign(target, source, ...)
module.exports = Object.assign || function(target, source){ // eslint-disable-line no-unused-vars
var T = Object($.assertDefined(target))
, l = arguments.length
, i = 1;
while(l > i){
var S = $.ES5Object(arguments[i++])
, keys = $.getKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)T[key = keys[j++]] = S[key];
}
return T;
};
},{"./$":15}],6:[function(require,module,exports){
var $ = require('./$')
, TAG = require('./$.wks')('toStringTag')
, toString = {}.toString;
function cof(it){
return toString.call(it).slice(8, -1);
}
cof.classof = function(it){
var O, T;
return it == undefined ? it === undefined ? 'Undefined' : 'Null'
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T : cof(O);
};
cof.set = function(it, tag, stat){
if(it && !$.has(it = stat ? it : it.prototype, TAG))$.hide(it, TAG, tag);
};
module.exports = cof;
},{"./$":15,"./$.wks":26}],7:[function(require,module,exports){
'use strict';
var $ = require('./$')
, ctx = require('./$.ctx')
, safe = require('./$.uid').safe
, assert = require('./$.assert')
, $iter = require('./$.iter')
, has = $.has
, set = $.set
, isObject = $.isObject
, hide = $.hide
, step = $iter.step
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, ID = safe('id')
, O1 = safe('O1')
, LAST = safe('last')
, FIRST = safe('first')
, ITER = safe('iter')
, SIZE = $.DESC ? safe('size') : 'size'
, id = 0;
function fastKey(it, create){
// return primitive with prefix
if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
// can't set id to frozen object
if(isFrozen(it))return 'F';
if(!has(it, ID)){
// not necessary to add id
if(!create)return 'E';
// add missing object id
hide(it, ID, ++id);
// return object id with prefix
} return 'O' + it[ID];
}
function getEntry(that, key){
// fast case
var index = fastKey(key), entry;
if(index != 'F')return that[O1][index];
// frozen object case
for(entry = that[FIRST]; entry; entry = entry.n){
if(entry.k == key)return entry;
}
}
module.exports = {
getConstructor: function(NAME, IS_MAP, ADDER){
function C(iterable){
var that = assert.inst(this, C, NAME);
set(that, O1, $.create(null));
set(that, SIZE, 0);
set(that, LAST, undefined);
set(that, FIRST, undefined);
if(iterable != undefined)$iter.forOf(iterable, IS_MAP, that[ADDER], that);
}
$.mix(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function(){
for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that[FIRST] = that[LAST] = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that[O1][entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that[FIRST] == entry)that[FIRST] = next;
if(that[LAST] == entry)that[LAST] = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments[1], 3)
, entry;
while(entry = entry ? entry.n : this[FIRST]){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function(key){
return !!getEntry(this, key);
}
});
if($.DESC)$.setDesc(C.prototype, 'size', {
get: function(){
return assert.def(this[SIZE]);
}
});
return C;
},
def: function(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry){
entry.v = value;
// create new entry
} else {
that[LAST] = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that[LAST], // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that[FIRST])that[FIRST] = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index != 'F')that[O1][index] = entry;
} return that;
},
getEntry: getEntry,
getIterConstructor: function(){
return function(iterated, kind){
set(this, ITER, {o: iterated, k: kind});
};
},
next: function(){
var iter = this[ITER]
, kind = iter.k
, entry = iter.l;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){
// or finish the iteration
iter.o = undefined;
return step(1);
}
// return step by kind
if(kind == 'key' )return step(0, entry.k);
if(kind == 'value')return step(0, entry.v);
return step(0, [entry.k, entry.v]);
}
};
},{"./$":15,"./$.assert":4,"./$.ctx":10,"./$.iter":14,"./$.uid":24}],8:[function(require,module,exports){
'use strict';
var $ = require('./$')
, safe = require('./$.uid').safe
, assert = require('./$.assert')
, forOf = require('./$.iter').forOf
, has = $.has
, isObject = $.isObject
, hide = $.hide
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, id = 0
, ID = safe('id')
, WEAK = safe('weak')
, LEAK = safe('leak')
, method = require('./$.array-methods')
, find = method(5)
, findIndex = method(6);
function findFrozen(store, key){
return find.call(store.array, function(it){
return it[0] === key;
});
}
// fallback for frozen keys
function leakStore(that){
return that[LEAK] || hide(that, LEAK, {
array: [],
get: function(key){
var entry = findFrozen(this, key);
if(entry)return entry[1];
},
has: function(key){
return !!findFrozen(this, key);
},
set: function(key, value){
var entry = findFrozen(this, key);
if(entry)entry[1] = value;
else this.array.push([key, value]);
},
'delete': function(key){
var index = findIndex.call(this.array, function(it){
return it[0] === key;
});
if(~index)this.array.splice(index, 1);
return !!~index;
}
})[LEAK];
}
module.exports = {
getConstructor: function(NAME, IS_MAP, ADDER){
function C(iterable){
$.set(assert.inst(this, C, NAME), ID, id++);
if(iterable != undefined)forOf(iterable, IS_MAP, this[ADDER], this);
}
$.mix(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this)['delete'](key);
return has(key, WEAK) && has(key[WEAK], this[ID]) && delete key[WEAK][this[ID]];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this).has(key);
return has(key, WEAK) && has(key[WEAK], this[ID]);
}
});
return C;
},
def: function(that, key, value){
if(isFrozen(assert.obj(key))){
leakStore(that).set(key, value);
} else {
has(key, WEAK) || hide(key, WEAK, {});
key[WEAK][that[ID]] = value;
} return that;
},
leakStore: leakStore,
WEAK: WEAK,
ID: ID
};
},{"./$":15,"./$.array-methods":3,"./$.assert":4,"./$.iter":14,"./$.uid":24}],9:[function(require,module,exports){
'use strict';
var $ = require('./$')
, $def = require('./$.def')
, $iter = require('./$.iter')
, assertInstance = require('./$.assert').inst;
module.exports = function(NAME, methods, common, IS_MAP, isWeak){
var Base = $.g[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
function fixMethod(KEY, CHAIN){
var method = proto[KEY];
if($.FW)proto[KEY] = function(a, b){
var result = method.call(this, a === 0 ? 0 : a, b);
return CHAIN ? this : result;
};
}
if(!$.isFunction(C) || !(isWeak || !$iter.BUGGY && proto.forEach && proto.entries)){
// create collection constructor
C = common.getConstructor(NAME, IS_MAP, ADDER);
$.mix(C.prototype, methods);
} else {
var inst = new C
, chain = inst[ADDER](isWeak ? {} : -0, 1)
, buggyZero;
// wrap for init collections from iterable
if($iter.fail(function(iter){
new C(iter); // eslint-disable-line no-new
}) || $iter.DANGER_CLOSING){
C = function(iterable){
assertInstance(this, C, NAME);
var that = new Base;
if(iterable != undefined)$iter.forOf(iterable, IS_MAP, that[ADDER], that);
return that;
};
C.prototype = proto;
if($.FW)proto.constructor = C;
}
isWeak || inst.forEach(function(val, key){
buggyZero = 1 / key === -Infinity;
});
// fix converting -0 key to +0
if(buggyZero){
fixMethod('delete');
fixMethod('has');
IS_MAP && fixMethod('get');
}
// + fix .add & .set for chaining
if(buggyZero || chain !== inst)fixMethod(ADDER, true);
}
require('./$.cof').set(C, NAME);
require('./$.species')(C);
O[NAME] = C;
$def($def.G + $def.W + $def.F * (C != Base), O);
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
if(!isWeak)$iter.std(
C, NAME,
common.getIterConstructor(), common.next,
IS_MAP ? 'key+value' : 'value' , !IS_MAP, true
);
return C;
};
},{"./$":15,"./$.assert":4,"./$.cof":6,"./$.def":11,"./$.iter":14,"./$.species":21}],10:[function(require,module,exports){
// Optional / simple context binding
var assertFunction = require('./$.assert').fn;
module.exports = function(fn, that, length){
assertFunction(fn);
if(~length && that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
} return function(/* ...args */){
return fn.apply(that, arguments);
};
};
},{"./$.assert":4}],11:[function(require,module,exports){
var $ = require('./$')
, global = $.g
, core = $.core
, isFunction = $.isFunction;
function ctx(fn, that){
return function(){
return fn.apply(that, arguments);
};
}
global.core = core;
// type bitmap
$def.F = 1; // forced
$def.G = 2; // global
$def.S = 4; // static
$def.P = 8; // proto
$def.B = 16; // bind
$def.W = 32; // wrap
function $def(type, name, source){
var key, own, out, exp
, isGlobal = type & $def.G
, target = isGlobal ? global : type & $def.S
? global[name] : (global[name] || {}).prototype
, exports = isGlobal ? core : core[name] || (core[name] = {});
if(isGlobal)source = name;
for(key in source){
// contains in native
own = !(type & $def.F) && target && key in target;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
if(type & $def.B && own)exp = ctx(out, global);
else exp = type & $def.P && isFunction(out) ? ctx(Function.call, out) : out;
// extend global
if(target && !own){
if(isGlobal)target[key] = out;
else delete target[key] && $.hide(target, key, out);
}
// export
if(exports[key] != out)$.hide(exports, key, exp);
}
}
module.exports = $def;
},{"./$":15}],12:[function(require,module,exports){
module.exports = function($){
$.FW = true;
$.path = $.g;
return $;
};
},{}],13:[function(require,module,exports){
// Fast apply
// http://jsperf.lnkit.com/fast-apply/5
module.exports = function(fn, args, that){
var un = that === undefined;
switch(args.length){
case 0: return un ? fn()
: fn.call(that);
case 1: return un ? fn(args[0])
: fn.call(that, args[0]);
case 2: return un ? fn(args[0], args[1])
: fn.call(that, args[0], args[1]);
case 3: return un ? fn(args[0], args[1], args[2])
: fn.call(that, args[0], args[1], args[2]);
case 4: return un ? fn(args[0], args[1], args[2], args[3])
: fn.call(that, args[0], args[1], args[2], args[3]);
case 5: return un ? fn(args[0], args[1], args[2], args[3], args[4])
: fn.call(that, args[0], args[1], args[2], args[3], args[4]);
} return fn.apply(that, args);
};
},{}],14:[function(require,module,exports){
'use strict';
var $ = require('./$')
, ctx = require('./$.ctx')
, cof = require('./$.cof')
, $def = require('./$.def')
, assertObject = require('./$.assert').obj
, SYMBOL_ITERATOR = require('./$.wks')('iterator')
, FF_ITERATOR = '@@iterator'
, Iterators = {}
, IteratorPrototype = {};
// Safari has byggy iterators w/o `next`
var BUGGY = 'keys' in [] && !('next' in [].keys());
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
setIterator(IteratorPrototype, $.that);
function setIterator(O, value){
$.hide(O, SYMBOL_ITERATOR, value);
// Add iterator for FF iterator protocol
if(FF_ITERATOR in [])$.hide(O, FF_ITERATOR, value);
}
function defineIterator(Constructor, NAME, value, DEFAULT){
var proto = Constructor.prototype
, iter = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] || value;
// Define iterator
if($.FW)setIterator(proto, iter);
if(iter !== value){
var iterProto = $.getProto(iter.call(new Constructor));
// Set @@toStringTag to native iterators
cof.set(iterProto, NAME + ' Iterator', true);
// FF fix
if($.FW)$.has(proto, FF_ITERATOR) && setIterator(iterProto, $.that);
}
// Plug for library
Iterators[NAME] = iter;
// FF & v8 fix
Iterators[NAME + ' Iterator'] = $.that;
return iter;
}
function getIterator(it){
var Symbol = $.g.Symbol
, ext = it[Symbol && Symbol.iterator || FF_ITERATOR]
, getIter = ext || it[SYMBOL_ITERATOR] || Iterators[cof.classof(it)];
return assertObject(getIter.call(it));
}
function closeIterator(iterator){
var ret = iterator['return'];
if(ret !== undefined)assertObject(ret.call(iterator));
}
function stepCall(iterator, fn, value, entries){
try {
return entries ? fn(assertObject(value)[0], value[1]) : fn(value);
} catch(e){
closeIterator(iterator);
throw e;
}
}
var DANGER_CLOSING = true;
!function(){
try {
var iter = [1].keys();
iter['return'] = function(){ DANGER_CLOSING = false; };
Array.from(iter, function(){ throw 2; });
} catch(e){ /* empty */ }
}();
var $iter = module.exports = {
BUGGY: BUGGY,
DANGER_CLOSING: DANGER_CLOSING,
fail: function(exec){
var fail = true;
try {
var arr = [[{}, 1]]
, iter = arr[SYMBOL_ITERATOR]()
, next = iter.next;
iter.next = function(){
fail = false;
return next.call(this);
};
arr[SYMBOL_ITERATOR] = function(){
return iter;
};
exec(arr);
} catch(e){ /* empty */ }
return fail;
},
Iterators: Iterators,
prototype: IteratorPrototype,
step: function(done, value){
return {value: value, done: !!done};
},
stepCall: stepCall,
close: closeIterator,
is: function(it){
var O = Object(it)
, Symbol = $.g.Symbol
, SYM = Symbol && Symbol.iterator || FF_ITERATOR;
return SYM in O || SYMBOL_ITERATOR in O || $.has(Iterators, cof.classof(O));
},
get: getIterator,
set: setIterator,
create: function(Constructor, NAME, next, proto){
Constructor.prototype = $.create(proto || $iter.prototype, {next: $.desc(1, next)});
cof.set(Constructor, NAME + ' Iterator');
},
define: defineIterator,
std: function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){
function createIter(kind){
return function(){
return new Constructor(this, kind);
};
}
$iter.create(Constructor, NAME, next);
var entries = createIter('key+value')
, values = createIter('value')
, proto = Base.prototype
, methods, key;
if(DEFAULT == 'value')values = defineIterator(Base, NAME, values, 'values');
else entries = defineIterator(Base, NAME, entries, 'entries');
if(DEFAULT){
methods = {
entries: entries,
keys: IS_SET ? values : createIter('key'),
values: values
};
$def($def.P + $def.F * BUGGY, NAME, methods);
if(FORCE)for(key in methods){
if(!(key in proto))$.hide(proto, key, methods[key]);
}
}
},
forOf: function(iterable, entries, fn, that){
var iterator = getIterator(iterable)
, f = ctx(fn, that, entries ? 2 : 1)
, step;
while(!(step = iterator.next()).done){
if(stepCall(iterator, f, step.value, entries) === false){
return closeIterator(iterator);
}
}
}
};
},{"./$":15,"./$.assert":4,"./$.cof":6,"./$.ctx":10,"./$.def":11,"./$.wks":26}],15:[function(require,module,exports){
'use strict';
var global = typeof self != 'undefined' ? self : Function('return this')()
, core = {}
, defineProperty = Object.defineProperty
, hasOwnProperty = {}.hasOwnProperty
, ceil = Math.ceil
, floor = Math.floor
, max = Math.max
, min = Math.min;
// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.
var DESC = !!function(){
try {
return defineProperty({}, 'a', {get: function(){ return 2; }}).a == 2;
} catch(e){ /* empty */ }
}();
var hide = createDefiner(1);
// 7.1.4 ToInteger
function toInteger(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
}
function desc(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
}
function simpleSet(object, key, value){
object[key] = value;
return object;
}
function createDefiner(bitmap){
return DESC ? function(object, key, value){
return $.setDesc(object, key, desc(bitmap, value)); // eslint-disable-line no-use-before-define
} : simpleSet;
}
function isObject(it){
return it !== null && (typeof it == 'object' || typeof it == 'function');
}
function isFunction(it){
return typeof it == 'function';
}
function assertDefined(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
}
var $ = module.exports = require('./$.fw')({
g: global,
core: core,
html: global.document && document.documentElement,
// http://jsperf.com/core-js-isobject
isObject: isObject,
isFunction: isFunction,
it: function(it){
return it;
},
that: function(){
return this;
},
// 7.1.4 ToInteger
toInteger: toInteger,
// 7.1.15 ToLength
toLength: function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
},
toIndex: function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
},
has: function(it, key){
return hasOwnProperty.call(it, key);
},
create: Object.create,
getProto: Object.getPrototypeOf,
DESC: DESC,
desc: desc,
getDesc: Object.getOwnPropertyDescriptor,
setDesc: defineProperty,
getKeys: Object.keys,
getNames: Object.getOwnPropertyNames,
getSymbols: Object.getOwnPropertySymbols,
// Dummy, fix for not array-like ES3 string in es5 module
assertDefined: assertDefined,
ES5Object: Object,
toObject: function(it){
return $.ES5Object(assertDefined(it));
},
hide: hide,
def: createDefiner(0),
set: global.Symbol ? simpleSet : hide,
mix: function(target, src){
for(var key in src)hide(target, key, src[key]);
return target;
},
each: [].forEach
});
if(typeof __e != 'undefined')__e = core;
if(typeof __g != 'undefined')__g = global;
},{"./$.fw":12}],16:[function(require,module,exports){
var $ = require('./$');
module.exports = function(object, el){
var O = $.toObject(object)
, keys = $.getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
},{"./$":15}],17:[function(require,module,exports){
var $ = require('./$')
, assertObject = require('./$.assert').obj;
module.exports = function(it){
assertObject(it);
return $.getSymbols ? $.getNames(it).concat($.getSymbols(it)) : $.getNames(it);
};
},{"./$":15,"./$.assert":4}],18:[function(require,module,exports){
'use strict';
var $ = require('./$')
, invoke = require('./$.invoke')
, assertFunction = require('./$.assert').fn;
module.exports = function(/* ...pargs */){
var fn = assertFunction(this)
, length = arguments.length
, pargs = Array(length)
, i = 0
, _ = $.path._
, holder = false;
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
return function(/* ...args */){
var that = this
, _length = arguments.length
, j = 0, k = 0, args;
if(!holder && !_length)return invoke(fn, pargs, that);
args = pargs.slice();
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
while(_length > k)args.push(arguments[k++]);
return invoke(fn, args, that);
};
};
},{"./$":15,"./$.assert":4,"./$.invoke":13}],19:[function(require,module,exports){
'use strict';
module.exports = function(regExp, replace, isStatic){
var replacer = replace === Object(replace) ? function(part){
return replace[part];
} : replace;
return function(it){
return String(isStatic ? it : this).replace(regExp, replacer);
};
};
},{}],20:[function(require,module,exports){
// Works with __proto__ only. Old v8 can't works with null proto objects.
/*eslint-disable no-proto */
var $ = require('./$')
, assert = require('./$.assert');
module.exports = Object.setPrototypeOf || ('__proto__' in {} // eslint-disable-line
? function(buggy, set){
try {
set = require('./$.ctx')(Function.call, $.getDesc(Object.prototype, '__proto__').set, 2);
set({}, []);
} catch(e){ buggy = true; }
return function(O, proto){
assert.obj(O);
assert(proto === null || $.isObject(proto), proto, ": can't set as prototype!");
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}()
: undefined);
},{"./$":15,"./$.assert":4,"./$.ctx":10}],21:[function(require,module,exports){
var $ = require('./$');
module.exports = function(C){
if($.DESC && $.FW)$.setDesc(C, require('./$.wks')('species'), {
configurable: true,
get: $.that
});
};
},{"./$":15,"./$.wks":26}],22:[function(require,module,exports){
'use strict';
// true -> String#at
// false -> String#codePointAt
var $ = require('./$');
module.exports = function(TO_STRING){
return function(pos){
var s = String($.assertDefined(this))
, i = $.toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l
|| (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
},{"./$":15}],23:[function(require,module,exports){
'use strict';
var $ = require('./$')
, ctx = require('./$.ctx')
, cof = require('./$.cof')
, invoke = require('./$.invoke')
, global = $.g
, isFunction = $.isFunction
, setTask = global.setImmediate
, clearTask = global.clearImmediate
, postMessage = global.postMessage
, addEventListener = global.addEventListener
, MessageChannel = global.MessageChannel
, counter = 0
, queue = {}
, ONREADYSTATECHANGE = 'onreadystatechange'
, defer, channel, port;
function run(){
var id = +this;
if($.has(queue, id)){
var fn = queue[id];
delete queue[id];
fn();
}
}
function listner(event){
run.call(event.data);
}
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!isFunction(setTask) || !isFunction(clearTask)){
setTask = function(fn){
var args = [], i = 1;
while(arguments.length > i)args.push(arguments[i++]);
queue[++counter] = function(){
invoke(isFunction(fn) ? fn : Function(fn), args);
};
defer(counter);
return counter;
};
clearTask = function(id){
delete queue[id];
};
// Node.js 0.8-
if(cof(global.process) == 'process'){
defer = function(id){
global.process.nextTick(ctx(run, id, 1));
};
// Modern browsers, skip implementation for WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is object
} else if(addEventListener && isFunction(postMessage) && !$.g.importScripts){
defer = function(id){
postMessage(id, '*');
};
addEventListener('message', listner, false);
// WebWorkers
} else if(isFunction(MessageChannel)){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// IE8-
} else if($.g.document && ONREADYSTATECHANGE in document.createElement('script')){
defer = function(id){
$.html.appendChild(document.createElement('script'))[ONREADYSTATECHANGE] = function(){
$.html.removeChild(this);
run.call(id);
};
};
// Rest old browsers
} else {
defer = function(id){
setTimeout(ctx(run, id, 1), 0);
};
}
}
module.exports = {
set: setTask,
clear: clearTask
};
},{"./$":15,"./$.cof":6,"./$.ctx":10,"./$.invoke":13}],24:[function(require,module,exports){
var sid = 0;
function uid(key){
return 'Symbol(' + key + ')_' + (++sid + Math.random()).toString(36);
}
uid.safe = require('./$').g.Symbol || uid;
module.exports = uid;
},{"./$":15}],25:[function(require,module,exports){
// 22.1.3.31 Array.prototype[@@unscopables]
var $ = require('./$')
, UNSCOPABLES = require('./$.wks')('unscopables');
if($.FW && !(UNSCOPABLES in []))$.hide(Array.prototype, UNSCOPABLES, {});
module.exports = function(key){
if($.FW)[][UNSCOPABLES][key] = true;
};
},{"./$":15,"./$.wks":26}],26:[function(require,module,exports){
var global = require('./$').g
, store = {};
module.exports = function(name){
return store[name] || (store[name] =
global.Symbol && global.Symbol[name] || require('./$.uid').safe('Symbol.' + name));
};
},{"./$":15,"./$.uid":24}],27:[function(require,module,exports){
var $ = require('./$')
, cof = require('./$.cof')
, $def = require('./$.def')
, invoke = require('./$.invoke')
, arrayMethod = require('./$.array-methods')
, IE_PROTO = require('./$.uid').safe('__proto__')
, assert = require('./$.assert')
, assertObject = assert.obj
, ObjectProto = Object.prototype
, A = []
, slice = A.slice
, indexOf = A.indexOf
, classof = cof.classof
, defineProperties = Object.defineProperties
, has = $.has
, defineProperty = $.setDesc
, getOwnDescriptor = $.getDesc
, isFunction = $.isFunction
, toObject = $.toObject
, toLength = $.toLength
, IE8_DOM_DEFINE = false;
if(!$.DESC){
try {
IE8_DOM_DEFINE = defineProperty(document.createElement('div'), 'x',
{get: function(){ return 8; }}
).x == 8;
} catch(e){ /* empty */ }
$.setDesc = function(O, P, Attributes){
if(IE8_DOM_DEFINE)try {
return defineProperty(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)assertObject(O)[P] = Attributes.value;
return O;
};
$.getDesc = function(O, P){
if(IE8_DOM_DEFINE)try {
return getOwnDescriptor(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return $.desc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
};
defineProperties = function(O, Properties){
assertObject(O);
var keys = $.getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
return O;
};
}
$def($def.S + $def.F * !$.DESC, 'Object', {
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $.getDesc,
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
defineProperty: $.setDesc,
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
defineProperties: defineProperties
});
// IE 8- don't enum bug keys
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
'toLocaleString,toString,valueOf').split(',')
// Additional keys for getOwnPropertyNames
, keys2 = keys1.concat('length', 'prototype')
, keysLen1 = keys1.length;
// Create object with `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = document.createElement('iframe')
, i = keysLen1
, iframeDocument;
iframe.style.display = 'none';
$.html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write('<script>document.F=Object</script>');
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict.prototype[keys1[i]];
return createDict();
};
function createGetKeys(names, length){
return function(object){
var O = toObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(length > i)if(has(O, key = names[i++])){
~indexOf.call(result, key) || result.push(key);
}
return result;
};
}
function isPrimitive(it){ return !$.isObject(it); }
function Empty(){}
$def($def.S, 'Object', {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
getPrototypeOf: $.getProto = $.getProto || function(O){
O = Object(assert.def(O));
if(has(O, IE_PROTO))return O[IE_PROTO];
if(isFunction(O.constructor) && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
},
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
create: $.create = $.create || function(O, /*?*/Properties){
var result;
if(O !== null){
Empty.prototype = assertObject(O);
result = new Empty();
Empty.prototype = null;
// add "__proto__" for Object.getPrototypeOf shim
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
},
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false),
// 19.1.2.17 / 15.2.3.8 Object.seal(O)
seal: $.it, // <- cap
// 19.1.2.5 / 15.2.3.9 Object.freeze(O)
freeze: $.it, // <- cap
// 19.1.2.15 / 15.2.3.10 Object.preventExtensions(O)
preventExtensions: $.it, // <- cap
// 19.1.2.13 / 15.2.3.11 Object.isSealed(O)
isSealed: isPrimitive, // <- cap
// 19.1.2.12 / 15.2.3.12 Object.isFrozen(O)
isFrozen: isPrimitive, // <- cap
// 19.1.2.11 / 15.2.3.13 Object.isExtensible(O)
isExtensible: $.isObject // <- cap
});
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
$def($def.P, 'Function', {
bind: function(that /*, args... */){
var fn = assert.fn(this)
, partArgs = slice.call(arguments, 1);
function bound(/* args... */){
var args = partArgs.concat(slice.call(arguments));
return invoke(fn, args, this instanceof bound ? $.create(fn.prototype) : that);
}
if(fn.prototype)bound.prototype = fn.prototype;
return bound;
}
});
// Fix for not array-like ES3 string
function arrayMethodFix(fn){
return function(){
return fn.apply($.ES5Object(this), arguments);
};
}
if(!(0 in Object('z') && 'z'[0] == 'z')){
$.ES5Object = function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
}
$def($def.P + $def.F * ($.ES5Object != Object), 'Array', {
slice: arrayMethodFix(slice),
join: arrayMethodFix(A.join)
});
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
$def($def.S, 'Array', {
isArray: function(arg){
return cof(arg) == 'Array';
}
});
function createArrayReduce(isRight){
return function(callbackfn, memo){
assert.fn(callbackfn);
var O = toObject(this)
, length = toLength(O.length)
, index = isRight ? length - 1 : 0
, i = isRight ? -1 : 1;
if(arguments.length < 2)for(;;){
if(index in O){
memo = O[index];
index += i;
break;
}
index += i;
assert(isRight ? index >= 0 : length > index, 'Reduce of empty array with no initial value');
}
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
memo = callbackfn(memo, O[index], index, this);
}
return memo;
};
}
$def($def.P, 'Array', {
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
forEach: $.each = $.each || arrayMethod(0),
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map: arrayMethod(1),
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter: arrayMethod(2),
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
some: arrayMethod(3),
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
every: arrayMethod(4),
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
reduce: createArrayReduce(false),
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
reduceRight: createArrayReduce(true),
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
indexOf: indexOf = indexOf || require('./$.array-includes')(false),
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
lastIndexOf: function(el, fromIndex /* = @[*-1] */){
var O = toObject(this)
, length = toLength(O.length)
, index = length - 1;
if(arguments.length > 1)index = Math.min(index, $.toInteger(fromIndex));
if(index < 0)index = toLength(length + index);
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
return -1;
}
});
// 21.1.3.25 / 15.5.4.20 String.prototype.trim()
$def($def.P, 'String', {trim: require('./$.replacer')(/^\s*([\s\S]*\S)?\s*$/, '$1')});
// 20.3.3.1 / 15.9.4.4 Date.now()
$def($def.S, 'Date', {now: function(){
return +new Date;
}});
function lz(num){
return num > 9 ? num : '0' + num;
}
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
$def($def.P, 'Date', {toISOString: function(){
if(!isFinite(this))throw RangeError('Invalid time value');
var d = this
, y = d.getUTCFullYear()
, m = d.getUTCMilliseconds()
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
}});
if(classof(function(){ return arguments; }()) == 'Object')cof.classof = function(it){
var tag = classof(it);
return tag == 'Object' && isFunction(it.callee) ? 'Arguments' : tag;
};
},{"./$":15,"./$.array-includes":2,"./$.array-methods":3,"./$.assert":4,"./$.cof":6,"./$.def":11,"./$.invoke":13,"./$.replacer":19,"./$.uid":24}],28:[function(require,module,exports){
'use strict';
var $ = require('./$')
, $def = require('./$.def')
, toIndex = $.toIndex;
$def($def.P, 'Array', {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
copyWithin: function(target/* = 0 */, start /* = 0, end = @length */){
var O = Object($.assertDefined(this))
, len = $.toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, end = arguments[2]
, fin = end === undefined ? len : toIndex(end, len)
, count = Math.min(fin - from, len - to)
, inc = 1;
if(from < to && to < from + count){
inc = -1;
from = from + count - 1;
to = to + count - 1;
}
while(count-- > 0){
if(from in O)O[to] = O[from];
else delete O[to];
to += inc;
from += inc;
} return O;
}
});
require('./$.unscope')('copyWithin');
},{"./$":15,"./$.def":11,"./$.unscope":25}],29:[function(require,module,exports){
'use strict';
var $ = require('./$')
, $def = require('./$.def')
, toIndex = $.toIndex;
$def($def.P, 'Array', {
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
fill: function(value /*, start = 0, end = @length */){
var O = Object($.assertDefined(this))
, length = $.toLength(O.length)
, index = toIndex(arguments[1], length)
, end = arguments[2]
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
}
});
require('./$.unscope')('fill');
},{"./$":15,"./$.def":11,"./$.unscope":25}],30:[function(require,module,exports){
var $def = require('./$.def');
$def($def.P, 'Array', {
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
findIndex: require('./$.array-methods')(6)
});
require('./$.unscope')('findIndex');
},{"./$.array-methods":3,"./$.def":11,"./$.unscope":25}],31:[function(require,module,exports){
var $def = require('./$.def');
$def($def.P, 'Array', {
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
find: require('./$.array-methods')(5)
});
require('./$.unscope')('find');
},{"./$.array-methods":3,"./$.def":11,"./$.unscope":25}],32:[function(require,module,exports){
var $ = require('./$')
, ctx = require('./$.ctx')
, $def = require('./$.def')
, $iter = require('./$.iter')
, stepCall = $iter.stepCall;
$def($def.S + $def.F * $iter.DANGER_CLOSING, 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = Object($.assertDefined(arrayLike))
, mapfn = arguments[1]
, mapping = mapfn !== undefined
, f = mapping ? ctx(mapfn, arguments[2], 2) : undefined
, index = 0
, length, result, step, iterator;
if($iter.is(O)){
iterator = $iter.get(O);
// strange IE quirks mode bug -> use typeof instead of isFunction
result = new (typeof this == 'function' ? this : Array);
for(; !(step = iterator.next()).done; index++){
result[index] = mapping ? stepCall(iterator, f, [step.value, index], true) : step.value;
}
} else {
// strange IE quirks mode bug -> use typeof instead of isFunction
result = new (typeof this == 'function' ? this : Array)(length = $.toLength(O.length));
for(; length > index; index++){
result[index] = mapping ? f(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
},{"./$":15,"./$.ctx":10,"./$.def":11,"./$.iter":14}],33:[function(require,module,exports){
var $ = require('./$')
, setUnscope = require('./$.unscope')
, ITER = require('./$.uid').safe('iter')
, $iter = require('./$.iter')
, step = $iter.step
, Iterators = $iter.Iterators;
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
$iter.std(Array, 'Array', function(iterated, kind){
$.set(this, ITER, {o: $.toObject(iterated), i: 0, k: kind});
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, kind = iter.k
, index = iter.i++;
if(!O || index >= O.length){
iter.o = undefined;
return step(1);
}
if(kind == 'key' )return step(0, index);
if(kind == 'value')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'value');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
setUnscope('keys');
setUnscope('values');
setUnscope('entries');
},{"./$":15,"./$.iter":14,"./$.uid":24,"./$.unscope":25}],34:[function(require,module,exports){
var $def = require('./$.def');
$def($def.S, 'Array', {
// 22.1.2.3 Array.of( ...items)
of: function(/* ...args */){
var index = 0
, length = arguments.length
// strange IE quirks mode bug -> use typeof instead of isFunction
, result = new (typeof this == 'function' ? this : Array)(length);
while(length > index)result[index] = arguments[index++];
result.length = length;
return result;
}
});
},{"./$.def":11}],35:[function(require,module,exports){
require('./$.species')(Array);
},{"./$.species":21}],36:[function(require,module,exports){
'use strict';
var $ = require('./$')
, NAME = 'name'
, setDesc = $.setDesc
, FunctionProto = Function.prototype;
// 19.2.4.2 name
NAME in FunctionProto || $.FW && $.DESC && setDesc(FunctionProto, NAME, {
configurable: true,
get: function(){
var match = String(this).match(/^\s*function ([^ (]*)/)
, name = match ? match[1] : '';
$.has(this, NAME) || setDesc(this, NAME, $.desc(5, name));
return name;
},
set: function(value){
$.has(this, NAME) || setDesc(this, NAME, $.desc(0, value));
}
});
},{"./$":15}],37:[function(require,module,exports){
'use strict';
var strong = require('./$.collection-strong');
// 23.1 Map Objects
require('./$.collection')('Map', {
// 23.1.3.6 Map.prototype.get(key)
get: function(key){
var entry = strong.getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function(key, value){
return strong.def(this, key === 0 ? 0 : key, value);
}
}, strong, true);
},{"./$.collection":9,"./$.collection-strong":7}],38:[function(require,module,exports){
var Infinity = 1 / 0
, $def = require('./$.def')
, E = Math.E
, pow = Math.pow
, abs = Math.abs
, exp = Math.exp
, log = Math.log
, sqrt = Math.sqrt
, ceil = Math.ceil
, floor = Math.floor
, sign = Math.sign || function(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
// 20.2.2.5 Math.asinh(x)
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
}
// 20.2.2.14 Math.expm1(x)
function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
}
$def($def.S, 'Math', {
// 20.2.2.3 Math.acosh(x)
acosh: function(x){
return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x;
},
// 20.2.2.5 Math.asinh(x)
asinh: asinh,
// 20.2.2.7 Math.atanh(x)
atanh: function(x){
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
},
// 20.2.2.9 Math.cbrt(x)
cbrt: function(x){
return sign(x = +x) * pow(abs(x), 1 / 3);
},
// 20.2.2.11 Math.clz32(x)
clz32: function(x){
return (x >>>= 0) ? 32 - x.toString(2).length : 32;
},
// 20.2.2.12 Math.cosh(x)
cosh: function(x){
return (exp(x = +x) + exp(-x)) / 2;
},
// 20.2.2.14 Math.expm1(x)
expm1: expm1,
// 20.2.2.16 Math.fround(x)
// TODO: fallback for IE9-
fround: function(x){
return new Float32Array([x])[0];
},
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
hypot: function(value1, value2){ // eslint-disable-line no-unused-vars
var sum = 0
, len1 = arguments.length
, len2 = len1
, args = Array(len1)
, larg = -Infinity
, arg;
while(len1--){
arg = args[len1] = +arguments[len1];
if(arg == Infinity || arg == -Infinity)return Infinity;
if(arg > larg)larg = arg;
}
larg = arg || 1;
while(len2--)sum += pow(args[len2] / larg, 2);
return larg * sqrt(sum);
},
// 20.2.2.18 Math.imul(x, y)
imul: function(x, y){
var UInt16 = 0xffff
, xn = +x
, yn = +y
, xl = UInt16 & xn
, yl = UInt16 & yn;
return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0);
},
// 20.2.2.20 Math.log1p(x)
log1p: function(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
},
// 20.2.2.21 Math.log10(x)
log10: function(x){
return log(x) / Math.LN10;
},
// 20.2.2.22 Math.log2(x)
log2: function(x){
return log(x) / Math.LN2;
},
// 20.2.2.28 Math.sign(x)
sign: sign,
// 20.2.2.30 Math.sinh(x)
sinh: function(x){
return abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
},
// 20.2.2.33 Math.tanh(x)
tanh: function(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
},
// 20.2.2.34 Math.trunc(x)
trunc: function(it){
return (it > 0 ? floor : ceil)(it);
}
});
},{"./$.def":11}],39:[function(require,module,exports){
'use strict';
var $ = require('./$')
, isObject = $.isObject
, isFunction = $.isFunction
, NUMBER = 'Number'
, Number = $.g[NUMBER]
, Base = Number
, proto = Number.prototype;
function toPrimitive(it){
var fn, val;
if(isFunction(fn = it.valueOf) && !isObject(val = fn.call(it)))return val;
if(isFunction(fn = it.toString) && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to number");
}
function toNumber(it){
if(isObject(it))it = toPrimitive(it);
if(typeof it == 'string' && it.length > 2 && it.charCodeAt(0) == 48){
var binary = false;
switch(it.charCodeAt(1)){
case 66 : case 98 : binary = true;
case 79 : case 111 : return parseInt(it.slice(2), binary ? 2 : 8);
}
} return +it;
}
if($.FW && !(Number('0o1') && Number('0b1'))){
Number = function Number(it){
return this instanceof Number ? new Base(toNumber(it)) : toNumber(it);
};
$.each.call($.DESC ? $.getNames(Base) : (
// ES3:
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
// ES6 (in case, if modules with ES6 Number statics required before):
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
).split(','), function(key){
if($.has(Base, key) && !$.has(Number, key)){
$.setDesc(Number, key, $.getDesc(Base, key));
}
}
);
Number.prototype = proto;
proto.constructor = Number;
$.hide($.g, NUMBER, Number);
}
},{"./$":15}],40:[function(require,module,exports){
var $ = require('./$')
, $def = require('./$.def')
, abs = Math.abs
, floor = Math.floor
, MAX_SAFE_INTEGER = 0x1fffffffffffff; // pow(2, 53) - 1 == 9007199254740991;
function isInteger(it){
return !$.isObject(it) && isFinite(it) && floor(it) === it;
}
$def($def.S, 'Number', {
// 20.1.2.1 Number.EPSILON
EPSILON: Math.pow(2, -52),
// 20.1.2.2 Number.isFinite(number)
isFinite: function(it){
return typeof it == 'number' && isFinite(it);
},
// 20.1.2.3 Number.isInteger(number)
isInteger: isInteger,
// 20.1.2.4 Number.isNaN(number)
isNaN: function(number){
return number != number;
},
// 20.1.2.5 Number.isSafeInteger(number)
isSafeInteger: function(number){
return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER;
},
// 20.1.2.6 Number.MAX_SAFE_INTEGER
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
// 20.1.2.10 Number.MIN_SAFE_INTEGER
MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER,
// 20.1.2.12 Number.parseFloat(string)
parseFloat: parseFloat,
// 20.1.2.13 Number.parseInt(string, radix)
parseInt: parseInt
});
},{"./$":15,"./$.def":11}],41:[function(require,module,exports){
// 19.1.3.1 Object.assign(target, source)
var $def = require('./$.def');
$def($def.S, 'Object', {assign: require('./$.assign')});
},{"./$.assign":5,"./$.def":11}],42:[function(require,module,exports){
// 19.1.3.10 Object.is(value1, value2)
var $def = require('./$.def');
$def($def.S, 'Object', {
is: function(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
}
});
},{"./$.def":11}],43:[function(require,module,exports){
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $def = require('./$.def');
$def($def.S, 'Object', {setPrototypeOf: require('./$.set-proto')});
},{"./$.def":11,"./$.set-proto":20}],44:[function(require,module,exports){
var $ = require('./$')
, $def = require('./$.def')
, isObject = $.isObject
, toObject = $.toObject;
function wrapObjectMethod(METHOD, MODE){
var fn = ($.core.Object || {})[METHOD] || Object[METHOD]
, f = 0
, o = {};
o[METHOD] = MODE == 1 ? function(it){
return isObject(it) ? fn(it) : it;
} : MODE == 2 ? function(it){
return isObject(it) ? fn(it) : true;
} : MODE == 3 ? function(it){
return isObject(it) ? fn(it) : false;
} : MODE == 4 ? function(it, key){
return fn(toObject(it), key);
} : MODE == 5 ? function(it){
return fn(Object($.assertDefined(it)));
} : function(it){
return fn(toObject(it));
};
try {
fn('z');
} catch(e){
f = 1;
}
$def($def.S + $def.F * f, 'Object', o);
}
wrapObjectMethod('freeze', 1);
wrapObjectMethod('seal', 1);
wrapObjectMethod('preventExtensions', 1);
wrapObjectMethod('isFrozen', 2);
wrapObjectMethod('isSealed', 2);
wrapObjectMethod('isExtensible', 3);
wrapObjectMethod('getOwnPropertyDescriptor', 4);
wrapObjectMethod('getPrototypeOf', 5);
wrapObjectMethod('keys');
wrapObjectMethod('getOwnPropertyNames');
},{"./$":15,"./$.def":11}],45:[function(require,module,exports){
'use strict';
// 19.1.3.6 Object.prototype.toString()
var $ = require('./$')
, cof = require('./$.cof')
, tmp = {};
tmp[require('./$.wks')('toStringTag')] = 'z';
if($.FW && cof(tmp) != 'z')$.hide(Object.prototype, 'toString', function(){
return '[object ' + cof.classof(this) + ']';
});
},{"./$":15,"./$.cof":6,"./$.wks":26}],46:[function(require,module,exports){
'use strict';
var $ = require('./$')
, ctx = require('./$.ctx')
, cof = require('./$.cof')
, $def = require('./$.def')
, assert = require('./$.assert')
, $iter = require('./$.iter')
, SPECIES = require('./$.wks')('species')
, RECORD = require('./$.uid').safe('record')
, forOf = $iter.forOf
, PROMISE = 'Promise'
, global = $.g
, process = global.process
, asap = process && process.nextTick || require('./$.task').set
, Promise = global[PROMISE]
, Base = Promise
, isFunction = $.isFunction
, isObject = $.isObject
, assertFunction = assert.fn
, assertObject = assert.obj
, test;
function getConstructor(C){
var S = assertObject(C)[SPECIES];
return S != undefined ? S : C;
}
isFunction(Promise) && isFunction(Promise.resolve)
&& Promise.resolve(test = new Promise(function(){})) == test
|| function(){
function isThenable(it){
var then;
if(isObject(it))then = it.then;
return isFunction(then) ? then : false;
}
function handledRejectionOrHasOnRejected(promise){
var record = promise[RECORD]
, chain = record.c
, i = 0
, react;
if(record.h)return true;
while(chain.length > i){
react = chain[i++];
if(react.fail || handledRejectionOrHasOnRejected(react.P))return true;
}
}
function notify(record, isReject){
var chain = record.c;
if(isReject || chain.length)asap(function(){
var promise = record.p
, value = record.v
, ok = record.s == 1
, i = 0;
if(isReject && !handledRejectionOrHasOnRejected(promise)){
setTimeout(function(){
if(!handledRejectionOrHasOnRejected(promise)){
if(cof(process) == 'process'){
process.emit('unhandledRejection', value, promise);
} else if(global.console && isFunction(console.error)){
console.error('Unhandled promise rejection', value);
}
}
}, 1e3);
} else while(chain.length > i)!function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError(PROMISE + '-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
}(chain[i++]);
chain.length = 0;
});
}
function reject(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
notify(record, true);
}
function resolve(value){
var record = this
, then, wrapper;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
wrapper = {r: record, d: false}; // wrap
then.call(value, ctx(resolve, wrapper, 1), ctx(reject, wrapper, 1));
} else {
record.v = value;
record.s = 1;
notify(record);
}
} catch(err){
reject.call(wrapper || {r: record, d: false}, err); // wrap
}
}
// 25.4.3.1 Promise(executor)
Promise = function(executor){
assertFunction(executor);
var record = {
p: assert.inst(this, Promise, PROMISE), // <- promise
c: [], // <- chain
s: 0, // <- state
d: false, // <- done
v: undefined, // <- value
h: false // <- handled rejection
};
$.hide(this, RECORD, record);
try {
executor(ctx(resolve, record, 1), ctx(reject, record, 1));
} catch(err){
reject.call(record, err);
}
};
$.mix(Promise.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function(onFulfilled, onRejected){
var S = assertObject(assertObject(this).constructor)[SPECIES];
var react = {
ok: isFunction(onFulfilled) ? onFulfilled : true,
fail: isFunction(onRejected) ? onRejected : false
};
var P = react.P = new (S != undefined ? S : Promise)(function(res, rej){
react.res = assertFunction(res);
react.rej = assertFunction(rej);
});
var record = this[RECORD];
record.c.push(react);
record.s && notify(record);
return P;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
}();
$def($def.G + $def.W + $def.F * (Promise != Base), {Promise: Promise});
$def($def.S, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function(r){
return new (getConstructor(this))(function(res, rej){
rej(r);
});
},
// 25.4.4.6 Promise.resolve(x)
resolve: function(x){
return isObject(x) && RECORD in x && $.getProto(x) === this.prototype
? x : new (getConstructor(this))(function(res){
res(x);
});
}
});
$def($def.S + $def.F * ($iter.fail(function(iter){
Promise.all(iter)['catch'](function(){});
}) || $iter.DANGER_CLOSING), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function(iterable){
var C = getConstructor(this)
, values = [];
return new C(function(resolve, reject){
forOf(iterable, false, values.push, values);
var remaining = values.length
, results = Array(remaining);
if(remaining)$.each.call(values, function(promise, index){
C.resolve(promise).then(function(value){
results[index] = value;
--remaining || resolve(results);
}, reject);
});
else resolve(results);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function(iterable){
var C = getConstructor(this);
return new C(function(resolve, reject){
forOf(iterable, false, function(promise){
C.resolve(promise).then(resolve, reject);
});
});
}
});
cof.set(Promise, PROMISE);
require('./$.species')(Promise);
},{"./$":15,"./$.assert":4,"./$.cof":6,"./$.ctx":10,"./$.def":11,"./$.iter":14,"./$.species":21,"./$.task":23,"./$.uid":24,"./$.wks":26}],47:[function(require,module,exports){
var $ = require('./$')
, $def = require('./$.def')
, setProto = require('./$.set-proto')
, $iter = require('./$.iter')
, ITER = require('./$.uid').safe('iter')
, step = $iter.step
, assert = require('./$.assert')
, isObject = $.isObject
, getDesc = $.getDesc
, setDesc = $.setDesc
, getProto = $.getProto
, apply = Function.apply
, assertObject = assert.obj
, isExtensible = Object.isExtensible || $.it;
function Enumerate(iterated){
var keys = [], key;
for(key in iterated)keys.push(key);
$.set(this, ITER, {o: iterated, a: keys, i: 0});
}
$iter.create(Enumerate, 'Object', function(){
var iter = this[ITER]
, keys = iter.a
, key;
do {
if(iter.i >= keys.length)return step(1);
} while(!((key = keys[iter.i++]) in iter.o));
return step(0, key);
});
function wrap(fn){
return function(it){
assertObject(it);
try {
fn.apply(undefined, arguments);
return true;
} catch(e){
return false;
}
};
}
function reflectGet(target, propertyKey/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc = getDesc(assertObject(target), propertyKey), proto;
if(desc)return $.has(desc, 'value')
? desc.value
: desc.get === undefined
? undefined
: desc.get.call(receiver);
return isObject(proto = getProto(target))
? reflectGet(proto, propertyKey, receiver)
: undefined;
}
function reflectSet(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = getDesc(assertObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = getProto(target))){
return reflectSet(proto, propertyKey, V, receiver);
}
ownDesc = $.desc(0);
}
if($.has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = getDesc(receiver, propertyKey) || $.desc(0);
existingDescriptor.value = V;
setDesc(receiver, propertyKey, existingDescriptor);
return true;
}
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}
var reflect = {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
apply: require('./$.ctx')(Function.call, apply, 3),
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
construct: function(target, argumentsList /*, newTarget*/){
var proto = assert.fn(arguments.length < 3 ? target : arguments[2]).prototype
, instance = $.create(isObject(proto) ? proto : Object.prototype)
, result = apply.call(target, instance, argumentsList);
return isObject(result) ? result : instance;
},
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
defineProperty: wrap(setDesc),
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
deleteProperty: function(target, propertyKey){
var desc = getDesc(assertObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
},
// 26.1.5 Reflect.enumerate(target)
enumerate: function(target){
return new Enumerate(assertObject(target));
},
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
get: reflectGet,
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
getOwnPropertyDescriptor: function(target, propertyKey){
return getDesc(assertObject(target), propertyKey);
},
// 26.1.8 Reflect.getPrototypeOf(target)
getPrototypeOf: function(target){
return getProto(assertObject(target));
},
// 26.1.9 Reflect.has(target, propertyKey)
has: function(target, propertyKey){
return propertyKey in target;
},
// 26.1.10 Reflect.isExtensible(target)
isExtensible: function(target){
return !!isExtensible(assertObject(target));
},
// 26.1.11 Reflect.ownKeys(target)
ownKeys: require('./$.own-keys'),
// 26.1.12 Reflect.preventExtensions(target)
preventExtensions: wrap(Object.preventExtensions || $.it),
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
set: reflectSet
};
// 26.1.14 Reflect.setPrototypeOf(target, proto)
if(setProto)reflect.setPrototypeOf = function(target, proto){
setProto(assertObject(target), proto);
return true;
};
$def($def.G, {Reflect: {}});
$def($def.S, 'Reflect', reflect);
},{"./$":15,"./$.assert":4,"./$.ctx":10,"./$.def":11,"./$.iter":14,"./$.own-keys":17,"./$.set-proto":20,"./$.uid":24}],48:[function(require,module,exports){
var $ = require('./$')
, cof = require('./$.cof')
, RegExp = $.g.RegExp
, Base = RegExp
, proto = RegExp.prototype;
if($.FW && $.DESC){
// RegExp allows a regex with flags as the pattern
if(!function(){try{ return RegExp(/a/g, 'i') == '/a/i'; }catch(e){ /* empty */ }}()){
RegExp = function RegExp(pattern, flags){
return new Base(cof(pattern) == 'RegExp' && flags !== undefined
? pattern.source : pattern, flags);
};
$.each.call($.getNames(Base), function(key){
key in RegExp || $.setDesc(RegExp, key, {
configurable: true,
get: function(){ return Base[key]; },
set: function(it){ Base[key] = it; }
});
});
proto.constructor = RegExp;
RegExp.prototype = proto;
$.hide($.g, 'RegExp', RegExp);
}
// 21.2.5.3 get RegExp.prototype.flags()
if(/./g.flags != 'g')$.setDesc(proto, 'flags', {
configurable: true,
get: require('./$.replacer')(/^.*\/(\w*)$/, '$1')
});
}
require('./$.species')(RegExp);
},{"./$":15,"./$.cof":6,"./$.replacer":19,"./$.species":21}],49:[function(require,module,exports){
'use strict';
var strong = require('./$.collection-strong');
// 23.2 Set Objects
require('./$.collection')('Set', {
// 23.2.3.1 Set.prototype.add(value)
add: function(value){
return strong.def(this, value = value === 0 ? 0 : value, value);
}
}, strong);
},{"./$.collection":9,"./$.collection-strong":7}],50:[function(require,module,exports){
var $def = require('./$.def');
$def($def.P, 'String', {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: require('./$.string-at')(false)
});
},{"./$.def":11,"./$.string-at":22}],51:[function(require,module,exports){
'use strict';
var $ = require('./$')
, cof = require('./$.cof')
, $def = require('./$.def')
, toLength = $.toLength;
$def($def.P, 'String', {
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
endsWith: function(searchString /*, endPosition = @length */){
if(cof(searchString) == 'RegExp')throw TypeError();
var that = String($.assertDefined(this))
, endPosition = arguments[1]
, len = toLength(that.length)
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
searchString += '';
return that.slice(end - searchString.length, end) === searchString;
}
});
},{"./$":15,"./$.cof":6,"./$.def":11}],52:[function(require,module,exports){
var $def = require('./$.def')
, toIndex = require('./$').toIndex
, fromCharCode = String.fromCharCode;
$def($def.S, 'String', {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function(x){ // eslint-disable-line no-unused-vars
var res = []
, len = arguments.length
, i = 0
, code;
while(len > i){
code = +arguments[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
}
});
},{"./$":15,"./$.def":11}],53:[function(require,module,exports){
'use strict';
var $ = require('./$')
, cof = require('./$.cof')
, $def = require('./$.def');
$def($def.P, 'String', {
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
includes: function(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
return !!~String($.assertDefined(this)).indexOf(searchString, arguments[1]);
}
});
},{"./$":15,"./$.cof":6,"./$.def":11}],54:[function(require,module,exports){
var set = require('./$').set
, at = require('./$.string-at')(true)
, ITER = require('./$.uid').safe('iter')
, $iter = require('./$.iter')
, step = $iter.step;
// 21.1.3.27 String.prototype[@@iterator]()
$iter.std(String, 'String', function(iterated){
set(this, ITER, {o: String(iterated), i: 0});
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, index = iter.i
, point;
if(index >= O.length)return step(1);
point = at.call(O, index);
iter.i += point.length;
return step(0, point);
});
},{"./$":15,"./$.iter":14,"./$.string-at":22,"./$.uid":24}],55:[function(require,module,exports){
var $ = require('./$')
, $def = require('./$.def');
$def($def.S, 'String', {
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function(callSite){
var raw = $.toObject(callSite.raw)
, len = $.toLength(raw.length)
, sln = arguments.length
, res = []
, i = 0;
while(len > i){
res.push(String(raw[i++]));
if(i < sln)res.push(String(arguments[i]));
} return res.join('');
}
});
},{"./$":15,"./$.def":11}],56:[function(require,module,exports){
'use strict';
var $ = require('./$')
, $def = require('./$.def');
$def($def.P, 'String', {
// 21.1.3.13 String.prototype.repeat(count)
repeat: function(count){
var str = String($.assertDefined(this))
, res = ''
, n = $.toInteger(count);
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
return res;
}
});
},{"./$":15,"./$.def":11}],57:[function(require,module,exports){
'use strict';
var $ = require('./$')
, cof = require('./$.cof')
, $def = require('./$.def');
$def($def.P, 'String', {
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
startsWith: function(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
var that = String($.assertDefined(this))
, index = $.toLength(Math.min(arguments[1], that.length));
searchString += '';
return that.slice(index, index + searchString.length) === searchString;
}
});
},{"./$":15,"./$.cof":6,"./$.def":11}],58:[function(require,module,exports){
'use strict';
// ECMAScript 6 symbols shim
var $ = require('./$')
, setTag = require('./$.cof').set
, uid = require('./$.uid')
, $def = require('./$.def')
, keyOf = require('./$.keyof')
, has = $.has
, hide = $.hide
, getNames = $.getNames
, toObject = $.toObject
, Symbol = $.g.Symbol
, Base = Symbol
, setter = false
, TAG = uid.safe('tag')
, SymbolRegistry = {}
, AllSymbols = {};
function wrap(tag){
var sym = AllSymbols[tag] = $.set($.create(Symbol.prototype), TAG, tag);
$.DESC && setter && $.setDesc(Object.prototype, tag, {
configurable: true,
set: function(value){
hide(this, tag, value);
}
});
return sym;
}
// 19.4.1.1 Symbol([description])
if(!$.isFunction(Symbol)){
Symbol = function(description){
if(this instanceof Symbol)throw TypeError('Symbol is not a constructor');
return wrap(uid(description));
};
hide(Symbol.prototype, 'toString', function(){
return this[TAG];
});
}
$def($def.G + $def.W, {Symbol: Symbol});
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function(key){
return keyOf(SymbolRegistry, key);
},
pure: uid.safe,
set: $.set,
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
$.each.call((
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
'species,split,toPrimitive,toStringTag,unscopables'
).split(','), function(it){
var sym = require('./$.wks')(it);
symbolStatics[it] = Symbol === Base ? sym : wrap(sym);
}
);
setter = true;
$def($def.S, 'Symbol', symbolStatics);
$def($def.S + $def.F * (Symbol != Base), 'Object', {
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: function(it){
var names = getNames(toObject(it)), result = [], key, i = 0;
while(names.length > i)has(AllSymbols, key = names[i++]) || result.push(key);
return result;
},
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: function(it){
var names = getNames(toObject(it)), result = [], key, i = 0;
while(names.length > i)has(AllSymbols, key = names[i++]) && result.push(AllSymbols[key]);
return result;
}
});
setTag(Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setTag($.g.JSON, 'JSON', true);
},{"./$":15,"./$.cof":6,"./$.def":11,"./$.keyof":16,"./$.uid":24,"./$.wks":26}],59:[function(require,module,exports){
'use strict';
var $ = require('./$')
, weak = require('./$.collection-weak')
, leakStore = weak.leakStore
, ID = weak.ID
, WEAK = weak.WEAK
, has = $.has
, isObject = $.isObject
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, tmp = {};
// 23.3 WeakMap Objects
var WeakMap = require('./$.collection')('WeakMap', {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function(key){
if(isObject(key)){
if(isFrozen(key))return leakStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this[ID]];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function(key, value){
return weak.def(this, key, value);
}
}, weak, true, true);
// IE11 WeakMap frozen keys fix
if($.FW && new WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
$.each.call(['delete', 'has', 'get', 'set'], function(key){
var method = WeakMap.prototype[key];
WeakMap.prototype[key] = function(a, b){
// store frozen objects on leaky map
if(isObject(a) && isFrozen(a)){
var result = leakStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
};
});
}
},{"./$":15,"./$.collection":9,"./$.collection-weak":8}],60:[function(require,module,exports){
'use strict';
var weak = require('./$.collection-weak');
// 23.4 WeakSet Objects
require('./$.collection')('WeakSet', {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function(value){
return weak.def(this, value, true);
}
}, weak, false, true);
},{"./$.collection":9,"./$.collection-weak":8}],61:[function(require,module,exports){
// https://github.com/domenic/Array.prototype.includes
var $def = require('./$.def');
$def($def.P, 'Array', {
includes: require('./$.array-includes')(true)
});
require('./$.unscope')('includes');
},{"./$.array-includes":2,"./$.def":11,"./$.unscope":25}],62:[function(require,module,exports){
// https://gist.github.com/WebReflection/9353781
var $ = require('./$')
, $def = require('./$.def')
, ownKeys = require('./$.own-keys');
$def($def.S, 'Object', {
getOwnPropertyDescriptors: function(object){
var O = $.toObject(object)
, result = {};
$.each.call(ownKeys(O), function(key){
$.setDesc(result, key, $.desc(0, $.getDesc(O, key)));
});
return result;
}
});
},{"./$":15,"./$.def":11,"./$.own-keys":17}],63:[function(require,module,exports){
// http://goo.gl/XkBrjD
var $ = require('./$')
, $def = require('./$.def');
function createObjectToArray(isEntries){
return function(object){
var O = $.toObject(object)
, keys = $.getKeys(object)
, length = keys.length
, i = 0
, result = Array(length)
, key;
if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]];
else while(length > i)result[i] = O[keys[i++]];
return result;
};
}
$def($def.S, 'Object', {
values: createObjectToArray(false),
entries: createObjectToArray(true)
});
},{"./$":15,"./$.def":11}],64:[function(require,module,exports){
// https://gist.github.com/kangax/9698100
var $def = require('./$.def');
$def($def.S, 'RegExp', {
escape: require('./$.replacer')(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
});
},{"./$.def":11,"./$.replacer":19}],65:[function(require,module,exports){
// https://github.com/mathiasbynens/String.prototype.at
var $def = require('./$.def');
$def($def.P, 'String', {
at: require('./$.string-at')(true)
});
},{"./$.def":11,"./$.string-at":22}],66:[function(require,module,exports){
// JavaScript 1.6 / Strawman array statics shim
var $ = require('./$')
, $def = require('./$.def')
, core = $.core
, statics = {};
function setStatics(keys, length){
$.each.call(keys.split(','), function(key){
if(length == undefined && key in core.Array)statics[key] = core.Array[key];
else if(key in [])statics[key] = require('./$.ctx')(Function.call, [][key], length);
});
}
setStatics('pop,reverse,shift,keys,values,entries', 1);
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
'reduce,reduceRight,copyWithin,fill,turn');
$def($def.S, 'Array', statics);
},{"./$":15,"./$.ctx":10,"./$.def":11}],67:[function(require,module,exports){
require('./es6.array.iterator');
var $ = require('./$')
, Iterators = require('./$.iter').Iterators
, ITERATOR = require('./$.wks')('iterator')
, NodeList = $.g.NodeList;
if($.FW && NodeList && !(ITERATOR in NodeList.prototype)){
$.hide(NodeList.prototype, ITERATOR, Iterators.Array);
}
Iterators.NodeList = Iterators.Array;
},{"./$":15,"./$.iter":14,"./$.wks":26,"./es6.array.iterator":33}],68:[function(require,module,exports){
var $def = require('./$.def')
, $task = require('./$.task');
$def($def.G + $def.B, {
setImmediate: $task.set,
clearImmediate: $task.clear
});
},{"./$.def":11,"./$.task":23}],69:[function(require,module,exports){
// ie9- setTimeout & setInterval additional parameters fix
var $ = require('./$')
, $def = require('./$.def')
, invoke = require('./$.invoke')
, partial = require('./$.partial')
, MSIE = !!$.g.navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
function wrap(set){
return MSIE ? function(fn, time /*, ...args */){
return set(invoke(
partial,
[].slice.call(arguments, 2),
$.isFunction(fn) ? fn : Function(fn)
), time);
} : set;
}
$def($def.G + $def.B + $def.F * MSIE, {
setTimeout: wrap($.g.setTimeout),
setInterval: wrap($.g.setInterval)
});
},{"./$":15,"./$.def":11,"./$.invoke":13,"./$.partial":18}]},{},[1]);
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = __e;
// RequireJS export
else if(typeof define == 'function' && define.amd)define(function(){return __e});
// Export to global object
else __g.core = __e;
}(); |
fields/types/datetime/DatetimeField.js | cermati/keystone | import DateInput from '../../components/DateInput';
import Field from '../Field';
import moment from 'moment';
import React from 'react';
import {
Button,
FormField,
FormInput,
FormNote,
InlineGroup as Group,
InlineGroupSection as Section,
} from '../../../admin/client/App/elemental';
module.exports = Field.create({
displayName: 'DatetimeField',
statics: {
type: 'Datetime',
},
focusTargetRef: 'dateInput',
// default input formats
dateInputFormat: 'YYYY-MM-DD',
timeInputFormat: 'h:mm:ss a',
tzOffsetInputFormat: 'Z',
// parse formats (duplicated from lib/fieldTypes/datetime.js)
parseFormats: ['YYYY-MM-DD', 'YYYY-MM-DD h:m:s a', 'YYYY-MM-DD h:m a', 'YYYY-MM-DD H:m:s', 'YYYY-MM-DD H:m'],
getInitialState () {
return {
dateValue: this.props.value && this.moment(this.props.value).format(this.dateInputFormat),
timeValue: this.props.value && this.moment(this.props.value).format(this.timeInputFormat),
tzOffsetValue: this.props.value ? this.moment(this.props.value).format(this.tzOffsetInputFormat) : this.moment().format(this.tzOffsetInputFormat),
};
},
getDefaultProps () {
return {
formatString: 'Do MMM YYYY, h:mm:ss a',
};
},
moment () {
if (this.props.isUTC) return moment.utc.apply(moment, arguments);
else return moment.apply(undefined, arguments);
},
// TODO: Move isValid() so we can share with server-side code
isValid (value) {
return this.moment(value, this.parseFormats).isValid();
},
// TODO: Move format() so we can share with server-side code
format (value, format) {
format = format || this.dateInputFormat + ' ' + this.timeInputFormat;
return value ? this.moment(value).format(format) : '';
},
handleChange (dateValue, timeValue, tzOffsetValue) {
var value = dateValue + ' ' + timeValue;
var datetimeFormat = this.dateInputFormat + ' ' + this.timeInputFormat;
// if the change included a timezone offset, include that in the calculation (so NOW works correctly during DST changes)
if (typeof tzOffsetValue !== 'undefined') {
value += ' ' + tzOffsetValue;
datetimeFormat += ' ' + this.tzOffsetInputFormat;
}
// if not, calculate the timezone offset based on the date (respect different DST values)
else {
this.setState({ tzOffsetValue: this.moment(value, datetimeFormat).format(this.tzOffsetInputFormat) });
}
this.props.onChange({
path: this.props.path,
value: this.isValid(value) ? this.moment(value, datetimeFormat).toISOString() : null,
});
},
dateChanged ({ value }) {
this.setState({ dateValue: value });
this.handleChange(value, this.state.timeValue);
},
timeChanged (evt) {
this.setState({ timeValue: evt.target.value });
this.handleChange(this.state.dateValue, evt.target.value);
},
setNow () {
var dateValue = this.moment().format(this.dateInputFormat);
var timeValue = this.moment().format(this.timeInputFormat);
var tzOffsetValue = this.moment().format(this.tzOffsetInputFormat);
this.setState({
dateValue: dateValue,
timeValue: timeValue,
tzOffsetValue: tzOffsetValue,
});
this.handleChange(dateValue, timeValue, tzOffsetValue);
},
renderNote () {
if (!this.props.note) return null;
return <FormNote note={this.props.note} />;
},
renderUI () {
var input;
if (this.shouldRenderField()) {
input = (
<div>
<Group>
<Section grow>
<DateInput
format={this.dateInputFormat}
name={this.getInputName(this.props.paths.date)}
onChange={this.dateChanged}
ref="dateInput"
value={this.state.dateValue}
/>
</Section>
<Section grow>
<FormInput
autoComplete="off"
name={this.getInputName(this.props.paths.time)}
onChange={this.timeChanged}
placeholder="HH:MM:SS am/pm"
value={this.state.timeValue}
/>
</Section>
<Section>
<Button onClick={this.setNow}>Now</Button>
</Section>
</Group>
<input
name={this.getInputName(this.props.paths.tzOffset)}
type="hidden"
value={this.state.tzOffsetValue}
/>
</div>
);
} else {
input = (
<FormInput noedit>
{this.format(this.props.value, this.props.formatString)}
</FormInput>
);
}
return (
<FormField label={this.props.label} className="field-type-datetime" htmlFor={this.getInputName(this.props.path)}>
{input}
{this.renderNote()}
</FormField>
);
},
});
|
files/core-js/1.1.1/shim.js | iMega/jsdelivr | /**
* core-js 1.1.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(__e, __g, undefined){
'use strict';
/******/ (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] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = 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;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(1);
__webpack_require__(30);
__webpack_require__(38);
__webpack_require__(40);
__webpack_require__(42);
__webpack_require__(44);
__webpack_require__(46);
__webpack_require__(48);
__webpack_require__(49);
__webpack_require__(50);
__webpack_require__(51);
__webpack_require__(52);
__webpack_require__(53);
__webpack_require__(54);
__webpack_require__(55);
__webpack_require__(56);
__webpack_require__(57);
__webpack_require__(58);
__webpack_require__(59);
__webpack_require__(60);
__webpack_require__(61);
__webpack_require__(62);
__webpack_require__(64);
__webpack_require__(65);
__webpack_require__(66);
__webpack_require__(67);
__webpack_require__(68);
__webpack_require__(69);
__webpack_require__(70);
__webpack_require__(72);
__webpack_require__(73);
__webpack_require__(74);
__webpack_require__(76);
__webpack_require__(77);
__webpack_require__(78);
__webpack_require__(80);
__webpack_require__(81);
__webpack_require__(82);
__webpack_require__(83);
__webpack_require__(84);
__webpack_require__(85);
__webpack_require__(86);
__webpack_require__(87);
__webpack_require__(88);
__webpack_require__(89);
__webpack_require__(90);
__webpack_require__(91);
__webpack_require__(92);
__webpack_require__(94);
__webpack_require__(96);
__webpack_require__(98);
__webpack_require__(99);
__webpack_require__(101);
__webpack_require__(102);
__webpack_require__(107);
__webpack_require__(112);
__webpack_require__(113);
__webpack_require__(116);
__webpack_require__(118);
__webpack_require__(119);
__webpack_require__(120);
__webpack_require__(121);
__webpack_require__(122);
__webpack_require__(124);
__webpack_require__(125);
__webpack_require__(127);
__webpack_require__(128);
__webpack_require__(129);
__webpack_require__(130);
__webpack_require__(136);
__webpack_require__(139);
__webpack_require__(140);
__webpack_require__(142);
__webpack_require__(143);
__webpack_require__(144);
__webpack_require__(145);
__webpack_require__(146);
__webpack_require__(147);
__webpack_require__(148);
__webpack_require__(149);
__webpack_require__(150);
__webpack_require__(151);
__webpack_require__(152);
__webpack_require__(153);
__webpack_require__(155);
__webpack_require__(156);
__webpack_require__(157);
__webpack_require__(158);
__webpack_require__(159);
__webpack_require__(160);
__webpack_require__(162);
__webpack_require__(163);
__webpack_require__(164);
__webpack_require__(165);
__webpack_require__(167);
__webpack_require__(168);
__webpack_require__(170);
__webpack_require__(171);
__webpack_require__(173);
__webpack_require__(174);
__webpack_require__(175);
__webpack_require__(176);
__webpack_require__(179);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, SUPPORT_DESC = __webpack_require__(3)
, createDesc = __webpack_require__(5)
, html = __webpack_require__(6)
, cel = __webpack_require__(8)
, has = __webpack_require__(10)
, cof = __webpack_require__(11)
, $def = __webpack_require__(12)
, invoke = __webpack_require__(17)
, arrayMethod = __webpack_require__(18)
, IE_PROTO = __webpack_require__(16)('__proto__')
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(26)
, aFunction = __webpack_require__(20)
, toObject = __webpack_require__(22)
, toIObject = __webpack_require__(27)
, toInteger = __webpack_require__(25)
, toIndex = __webpack_require__(28)
, toLength = __webpack_require__(24)
, IObject = __webpack_require__(21)
, fails = __webpack_require__(4)
, ObjectProto = Object.prototype
, A = []
, _slice = A.slice
, _join = A.join
, defineProperty = $.setDesc
, getOwnDescriptor = $.getDesc
, defineProperties = $.setDescs
, $indexOf = __webpack_require__(29)(false)
, factories = {}
, IE8_DOM_DEFINE;
if(!SUPPORT_DESC){
IE8_DOM_DEFINE = !fails(function(){
return defineProperty(cel('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
$.setDesc = function(O, P, Attributes){
if(IE8_DOM_DEFINE)try {
return defineProperty(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)anObject(O)[P] = Attributes.value;
return O;
};
$.getDesc = function(O, P){
if(IE8_DOM_DEFINE)try {
return getOwnDescriptor(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return createDesc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
};
$.setDescs = defineProperties = function(O, Properties){
anObject(O);
var keys = $.getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
return O;
};
}
$def($def.S + $def.F * !SUPPORT_DESC, 'Object', {
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $.getDesc,
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
defineProperty: $.setDesc,
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
defineProperties: defineProperties
});
// IE 8- don't enum bug keys
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
'toLocaleString,toString,valueOf').split(',')
// Additional keys for getOwnPropertyNames
, keys2 = keys1.concat('length', 'prototype')
, keysLen1 = keys1.length;
// Create object with `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = cel('iframe')
, i = keysLen1
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write('<script>document.F=Object</script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict.prototype[keys1[i]];
return createDict();
};
var createGetKeys = function(names, length){
return function(object){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(length > i)if(has(O, key = names[i++])){
~$indexOf(result, key) || result.push(key);
}
return result;
};
};
var Empty = function(){};
$def($def.S, 'Object', {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
getPrototypeOf: $.getProto = $.getProto || function(O){
O = toObject(O);
if(has(O, IE_PROTO))return O[IE_PROTO];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
},
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
create: $.create = $.create || function(O, /*?*/Properties){
var result;
if(O !== null){
Empty.prototype = anObject(O);
result = new Empty();
Empty.prototype = null;
// add "__proto__" for Object.getPrototypeOf shim
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
},
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false)
});
var construct = function(F, len, args){
if(!(len in factories)){
for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
}
return factories[len](F, args);
};
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
$def($def.P, 'Function', {
bind: function bind(that /*, args... */){
var fn = aFunction(this)
, partArgs = _slice.call(arguments, 1);
var bound = function(/* args... */){
var args = partArgs.concat(_slice.call(arguments));
return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
};
if(isObject(fn.prototype))bound.prototype = fn.prototype;
return bound;
}
});
// fallback for not array-like ES3 strings and DOM objects
var buggySlice = fails(function(){
if(html)_slice.call(html);
});
$def($def.P + $def.F * buggySlice, 'Array', {
slice: function(begin, end){
var len = toLength(this.length)
, klass = cof(this);
end = end === undefined ? len : end;
if(klass == 'Array')return _slice.call(this, begin, end);
var start = toIndex(begin, len)
, upTo = toIndex(end, len)
, size = toLength(upTo - start)
, cloned = Array(size)
, i = 0;
for(; i < size; i++)cloned[i] = klass == 'String'
? this.charAt(start + i)
: this[start + i];
return cloned;
}
});
$def($def.P + $def.F * (IObject != Object), 'Array', {
join: function(){
return _join.apply(IObject(this), arguments);
}
});
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
$def($def.S, 'Array', {isArray: function(arg){ return cof(arg) == 'Array'; }});
var createArrayReduce = function(isRight){
return function(callbackfn, memo){
aFunction(callbackfn);
var O = IObject(this)
, length = toLength(O.length)
, index = isRight ? length - 1 : 0
, i = isRight ? -1 : 1;
if(arguments.length < 2)for(;;){
if(index in O){
memo = O[index];
index += i;
break;
}
index += i;
if(isRight ? index < 0 : length <= index){
throw TypeError('Reduce of empty array with no initial value');
}
}
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
memo = callbackfn(memo, O[index], index, this);
}
return memo;
};
};
var methodize = function($fn){
return function(arg1/*, arg2 = undefined */){
return $fn(this, arg1, arguments[1]);
};
};
$def($def.P, 'Array', {
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
forEach: $.each = $.each || methodize(arrayMethod(0)),
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map: methodize(arrayMethod(1)),
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter: methodize(arrayMethod(2)),
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
some: methodize(arrayMethod(3)),
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
every: methodize(arrayMethod(4)),
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
reduce: createArrayReduce(false),
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
reduceRight: createArrayReduce(true),
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
indexOf: methodize($indexOf),
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
lastIndexOf: function(el, fromIndex /* = @[*-1] */){
var O = toIObject(this)
, length = toLength(O.length)
, index = length - 1;
if(arguments.length > 1)index = Math.min(index, toInteger(fromIndex));
if(index < 0)index = toLength(length + index);
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
return -1;
}
});
// 20.3.3.1 / 15.9.4.4 Date.now()
$def($def.S, 'Date', {now: function(){ return +new Date; }});
var lz = function(num){
return num > 9 ? num : '0' + num;
};
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
// PhantomJS and old webkit had a broken Date implementation.
var date = new Date(-5e13 - 1)
, brokenDate = !(date.toISOString && date.toISOString() == '0385-07-25T07:06:39.999Z'
&& fails(function(){ new Date(NaN).toISOString(); }));
$def($def.P + $def.F * brokenDate, 'Date', {
toISOString: function toISOString(){
if(!isFinite(this))throw RangeError('Invalid time value');
var d = this
, y = d.getUTCFullYear()
, m = d.getUTCMilliseconds()
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
}
});
/***/ },
/* 2 */
/***/ function(module, exports) {
var $Object = Object;
module.exports = {
create: $Object.create,
getProto: $Object.getPrototypeOf,
isEnum: {}.propertyIsEnumerable,
getDesc: $Object.getOwnPropertyDescriptor,
setDesc: $Object.defineProperty,
setDescs: $Object.defineProperties,
getKeys: $Object.keys,
getNames: $Object.getOwnPropertyNames,
getSymbols: $Object.getOwnPropertySymbols,
each: [].forEach
};
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(4)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 4 */
/***/ function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ },
/* 5 */
/***/ function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7).document && document.documentElement;
/***/ },
/* 7 */
/***/ function(module, exports) {
var global = typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
module.exports = global;
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(9)
, document = __webpack_require__(7).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ },
/* 9 */
/***/ function(module, exports) {
// http://jsperf.com/core-js-isobject
module.exports = function(it){
return it !== null && (typeof it == 'object' || typeof it == 'function');
};
/***/ },
/* 10 */
/***/ function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ },
/* 11 */
/***/ function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, core = __webpack_require__(13)
, hide = __webpack_require__(14)
, $redef = __webpack_require__(15)
, PROTOTYPE = 'prototype';
var ctx = function(fn, that){
return function(){
return fn.apply(that, arguments);
};
};
var $def = function(type, name, source){
var key, own, out, exp
, isGlobal = type & $def.G
, isProto = type & $def.P
, target = isGlobal ? global : type & $def.S
? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
, exports = isGlobal ? core : core[name] || (core[name] = {});
if(isGlobal)source = name;
for(key in source){
// contains in native
own = !(type & $def.F) && target && key in target;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
if(type & $def.B && own)exp = ctx(out, global);
else exp = isProto && typeof out == 'function' ? ctx(Function.call, out) : out;
// extend global
if(target && !own)$redef(target, key, out);
// export
if(exports[key] != out)hide(exports, key, exp);
if(isProto)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
}
};
global.core = core;
// type bitmap
$def.F = 1; // forced
$def.G = 2; // global
$def.S = 4; // static
$def.P = 8; // proto
$def.B = 16; // bind
$def.W = 32; // wrap
module.exports = $def;
/***/ },
/* 13 */
/***/ function(module, exports) {
var core = module.exports = {};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, createDesc = __webpack_require__(5);
module.exports = __webpack_require__(3) ? function(object, key, value){
return $.setDesc(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
// add fake Function#toString
// for correct work wrapped methods / constructors with methods like LoDash isNative
var global = __webpack_require__(7)
, hide = __webpack_require__(14)
, SRC = __webpack_require__(16)('src')
, TO_STRING = 'toString'
, $toString = Function[TO_STRING]
, TPL = ('' + $toString).split(TO_STRING);
__webpack_require__(13).inspectSource = function(it){
return $toString.call(it);
};
(module.exports = function(O, key, val, safe){
if(typeof val == 'function'){
hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if(!('name' in val))val.name = key;
}
if(O === global){
O[key] = val;
} else {
if(!safe)delete O[key];
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString(){
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ },
/* 16 */
/***/ function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ },
/* 17 */
/***/ function(module, exports) {
// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function(fn, args, that){
var un = that === undefined;
switch(args.length){
case 0: return un ? fn()
: fn.call(that);
case 1: return un ? fn(args[0])
: fn.call(that, args[0]);
case 2: return un ? fn(args[0], args[1])
: fn.call(that, args[0], args[1]);
case 3: return un ? fn(args[0], args[1], args[2])
: fn.call(that, args[0], args[1], args[2]);
case 4: return un ? fn(args[0], args[1], args[2], args[3])
: fn.call(that, args[0], args[1], args[2], args[3]);
} return fn.apply(that, args);
};
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var ctx = __webpack_require__(19)
, IObject = __webpack_require__(21)
, toObject = __webpack_require__(22)
, toLength = __webpack_require__(24);
module.exports = function(TYPE){
var IS_MAP = TYPE == 1
, IS_FILTER = TYPE == 2
, IS_SOME = TYPE == 3
, IS_EVERY = TYPE == 4
, IS_FIND_INDEX = TYPE == 6
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function($this, callbackfn, that){
var O = toObject($this)
, self = IObject(O)
, f = ctx(callbackfn, that, 3)
, length = toLength(self.length)
, index = 0
, result = IS_MAP ? Array(length) : IS_FILTER ? [] : undefined
, val, res;
for(;length > index; index++)if(NO_HOLES || index in self){
val = self[index];
res = f(val, index, O);
if(TYPE){
if(IS_MAP)result[index] = res; // map
else if(res)switch(TYPE){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(IS_EVERY)return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(20);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
} return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 20 */
/***/ function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
// indexed object, fallback for non-array-like ES3 strings
var cof = __webpack_require__(11);
module.exports = 0 in Object('z') ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(23);
module.exports = function(it){
return Object(defined(it));
};
/***/ },
/* 23 */
/***/ function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(25)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ },
/* 25 */
/***/ function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(9);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(21)
, defined = __webpack_require__(23);
module.exports = function(it){
return IObject(defined(it));
};
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(25)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(27)
, toLength = __webpack_require__(24)
, toIndex = __webpack_require__(28);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index;
} return !IS_INCLUDES && -1;
};
};
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var $ = __webpack_require__(2)
, global = __webpack_require__(7)
, has = __webpack_require__(10)
, SUPPORT_DESC = __webpack_require__(3)
, $def = __webpack_require__(12)
, $redef = __webpack_require__(15)
, shared = __webpack_require__(31)
, setTag = __webpack_require__(32)
, uid = __webpack_require__(16)
, wks = __webpack_require__(33)
, keyOf = __webpack_require__(34)
, $names = __webpack_require__(35)
, enumKeys = __webpack_require__(36)
, anObject = __webpack_require__(26)
, toIObject = __webpack_require__(27)
, createDesc = __webpack_require__(5)
, getDesc = $.getDesc
, setDesc = $.setDesc
, $create = $.create
, getNames = $names.get
, $Symbol = global.Symbol
, setter = false
, HIDDEN = wks('_hidden')
, isEnum = $.isEnum
, SymbolRegistry = shared('symbol-registry')
, AllSymbols = shared('symbols')
, useNative = typeof $Symbol == 'function'
, ObjectProto = Object.prototype;
var setSymbolDesc = SUPPORT_DESC ? function(){ // fallback for old Android
try {
return $create(setDesc({}, HIDDEN, {
get: function(){
return setDesc(this, HIDDEN, {value: false})[HIDDEN];
}
}))[HIDDEN] || setDesc;
} catch(e){
return function(it, key, D){
var protoDesc = getDesc(ObjectProto, key);
if(protoDesc)delete ObjectProto[key];
setDesc(it, key, D);
if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
};
}
}() : setDesc;
var wrap = function(tag){
var sym = AllSymbols[tag] = $create($Symbol.prototype);
sym._k = tag;
SUPPORT_DESC && setter && setSymbolDesc(ObjectProto, tag, {
configurable: true,
set: function(value){
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
}
});
return sym;
};
function defineProperty(it, key, D){
if(D && has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D = $create(D, {enumerable: createDesc(0, false)});
} return setSymbolDesc(it, key, D);
} return setDesc(it, key, D);
}
function defineProperties(it, P){
anObject(it);
var keys = enumKeys(P = toIObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)defineProperty(it, key = keys[i++], P[key]);
return it;
}
function create(it, P){
return P === undefined ? $create(it) : defineProperties($create(it), P);
}
function propertyIsEnumerable(key){
var E = isEnum.call(this, key);
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
? E : true;
}
function getOwnPropertyDescriptor(it, key){
var D = getDesc(it = toIObject(it), key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
}
function getOwnPropertyNames(it){
var names = getNames(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
return result;
}
function getOwnPropertySymbols(it){
var names = getNames(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
return result;
}
// 19.4.1.1 Symbol([description])
if(!useNative){
$Symbol = function Symbol(){
if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor');
return wrap(uid(arguments[0]));
};
$redef($Symbol.prototype, 'toString', function(){
return this._k;
});
$.create = create;
$.isEnum = propertyIsEnumerable;
$.getDesc = getOwnPropertyDescriptor;
$.setDesc = defineProperty;
$.setDescs = defineProperties;
$.getNames = $names.get = getOwnPropertyNames;
$.getSymbols = getOwnPropertySymbols;
if(SUPPORT_DESC && !__webpack_require__(37)){
$redef(ObjectProto, 'propertyIsEnumerable', propertyIsEnumerable, true);
}
}
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
return keyOf(SymbolRegistry, key);
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
$.each.call((
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
'species,split,toPrimitive,toStringTag,unscopables'
).split(','), function(it){
var sym = wks(it);
symbolStatics[it] = useNative ? sym : wrap(sym);
}
);
setter = true;
$def($def.G + $def.W, {Symbol: $Symbol});
$def($def.S, 'Symbol', symbolStatics);
$def($def.S + $def.F * !useNative, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: getOwnPropertySymbols
});
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setTag(global.JSON, 'JSON', true);
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, SHARED = '__core-js_shared__'
, store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
return store[key] || (store[key] = {});
};
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
var has = __webpack_require__(10)
, hide = __webpack_require__(14)
, TAG = __webpack_require__(33)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))hide(it, TAG, tag);
};
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
var store = __webpack_require__(31)('wks')
, Symbol = __webpack_require__(7).Symbol;
module.exports = function(name){
return store[name] || (store[name] =
Symbol && Symbol[name] || (Symbol || __webpack_require__(16))('Symbol.' + name));
};
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, toIObject = __webpack_require__(27);
module.exports = function(object, el){
var O = toIObject(object)
, keys = $.getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toString = {}.toString
, toIObject = __webpack_require__(27)
, getNames = __webpack_require__(2).getNames;
var windowNames = typeof window == 'object' && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function(it){
try {
return getNames(it);
} catch(e){
return windowNames.slice();
}
};
module.exports.get = function getOwnPropertyNames(it){
if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);
return getNames(toIObject(it));
};
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var $ = __webpack_require__(2);
module.exports = function(it){
var keys = $.getKeys(it)
, getSymbols = $.getSymbols;
if(getSymbols){
var symbols = getSymbols(it)
, isEnum = $.isEnum
, i = 0
, key;
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);
}
return keys;
};
/***/ },
/* 37 */
/***/ function(module, exports) {
module.exports = false;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $def = __webpack_require__(12);
$def($def.S, 'Object', {assign: __webpack_require__(39)});
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.1 Object.assign(target, source, ...)
var toObject = __webpack_require__(22)
, IObject = __webpack_require__(21)
, enumKeys = __webpack_require__(36);
/* eslint-disable no-unused-vars */
module.exports = Object.assign || function assign(target, source){
/* eslint-enable no-unused-vars */
var T = toObject(target)
, l = arguments.length
, i = 1;
while(l > i){
var S = IObject(arguments[i++])
, keys = enumKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)T[key = keys[j++]] = S[key];
}
return T;
};
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.10 Object.is(value1, value2)
var $def = __webpack_require__(12);
$def($def.S, 'Object', {
is: __webpack_require__(41)
});
/***/ },
/* 41 */
/***/ function(module, exports) {
module.exports = Object.is || function is(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $def = __webpack_require__(12);
$def($def.S, 'Object', {setPrototypeOf: __webpack_require__(43).set});
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var getDesc = __webpack_require__(2).getDesc
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(26);
var check = function(O, proto){
anObject(O);
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} // eslint-disable-line
? function(buggy, set){
try {
set = __webpack_require__(19)(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
set({}, []);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}()
: undefined),
check: check
};
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 19.1.3.6 Object.prototype.toString()
var classof = __webpack_require__(45)
, test = {};
test[__webpack_require__(33)('toStringTag')] = 'z';
if(test + '' != '[object z]'){
__webpack_require__(15)(Object.prototype, 'toString', function toString(){
return '[object ' + classof(this) + ']';
}, true);
}
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(11)
, TAG = __webpack_require__(33)('toStringTag')
// ES3 wrong here
, ARG = cof(function(){ return arguments; }()) == 'Arguments';
module.exports = function(it){
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.5 Object.freeze(O)
var isObject = __webpack_require__(9);
__webpack_require__(47)('freeze', function($freeze){
return function freeze(it){
return $freeze && isObject(it) ? $freeze(it) : it;
};
});
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
module.exports = function(KEY, exec){
var $def = __webpack_require__(12)
, fn = (__webpack_require__(13).Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$def($def.S + $def.F * __webpack_require__(4)(function(){ fn(1); }), 'Object', exp);
};
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.17 Object.seal(O)
var isObject = __webpack_require__(9);
__webpack_require__(47)('seal', function($seal){
return function seal(it){
return $seal && isObject(it) ? $seal(it) : it;
};
});
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.15 Object.preventExtensions(O)
var isObject = __webpack_require__(9);
__webpack_require__(47)('preventExtensions', function($preventExtensions){
return function preventExtensions(it){
return $preventExtensions && isObject(it) ? $preventExtensions(it) : it;
};
});
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.12 Object.isFrozen(O)
var isObject = __webpack_require__(9);
__webpack_require__(47)('isFrozen', function($isFrozen){
return function isFrozen(it){
return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
};
});
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.13 Object.isSealed(O)
var isObject = __webpack_require__(9);
__webpack_require__(47)('isSealed', function($isSealed){
return function isSealed(it){
return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
};
});
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.11 Object.isExtensible(O)
var isObject = __webpack_require__(9);
__webpack_require__(47)('isExtensible', function($isExtensible){
return function isExtensible(it){
return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
};
});
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject = __webpack_require__(27);
__webpack_require__(47)('getOwnPropertyDescriptor', function($getOwnPropertyDescriptor){
return function getOwnPropertyDescriptor(it, key){
return $getOwnPropertyDescriptor(toIObject(it), key);
};
});
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(22);
__webpack_require__(47)('getPrototypeOf', function($getPrototypeOf){
return function getPrototypeOf(it){
return $getPrototypeOf(toObject(it));
};
});
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(22);
__webpack_require__(47)('keys', function($keys){
return function keys(it){
return $keys(toObject(it));
};
});
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.7 Object.getOwnPropertyNames(O)
__webpack_require__(47)('getOwnPropertyNames', function(){
return __webpack_require__(35).get;
});
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
var setDesc = __webpack_require__(2).setDesc
, createDesc = __webpack_require__(5)
, has = __webpack_require__(10)
, FProto = Function.prototype
, nameRE = /^\s*function ([^ (]*)/
, NAME = 'name';
// 19.2.4.2 name
NAME in FProto || __webpack_require__(3) && setDesc(FProto, NAME, {
configurable: true,
get: function(){
var match = ('' + this).match(nameRE)
, name = match ? match[1] : '';
has(this, NAME) || setDesc(this, NAME, createDesc(5, name));
return name;
}
});
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, isObject = __webpack_require__(9)
, HAS_INSTANCE = __webpack_require__(33)('hasInstance')
, FunctionProto = Function.prototype;
// 19.2.3.6 Function.prototype[@@hasInstance](V)
if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto, HAS_INSTANCE, {value: function(O){
if(typeof this != 'function' || !isObject(O))return false;
if(!isObject(this.prototype))return O instanceof this;
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
while(O = $.getProto(O))if(this.prototype === O)return true;
return false;
}});
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, global = __webpack_require__(7)
, has = __webpack_require__(10)
, cof = __webpack_require__(11)
, isObject = __webpack_require__(9)
, fails = __webpack_require__(4)
, NUMBER = 'Number'
, $Number = global[NUMBER]
, Base = $Number
, proto = $Number.prototype
// Opera ~12 has broken Object#toString
, BROKEN_COF = cof($.create(proto)) == NUMBER;
var toPrimitive = function(it){
var fn, val;
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
if(typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to number");
};
var toNumber = function(it){
if(isObject(it))it = toPrimitive(it);
if(typeof it == 'string' && it.length > 2 && it.charCodeAt(0) == 48){
var binary = false;
switch(it.charCodeAt(1)){
case 66 : case 98 : binary = true;
case 79 : case 111 : return parseInt(it.slice(2), binary ? 2 : 8);
}
} return +it;
};
if(!($Number('0o1') && $Number('0b1'))){
$Number = function Number(it){
var that = this;
return that instanceof $Number
// check on 1..constructor(foo) case
&& (BROKEN_COF ? fails(function(){ proto.valueOf.call(that); }) : cof(that) != NUMBER)
? new Base(toNumber(it)) : toNumber(it);
};
$.each.call(__webpack_require__(3) ? $.getNames(Base) : (
// ES3:
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
// ES6 (in case, if modules with ES6 Number statics required before):
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
).split(','), function(key){
if(has(Base, key) && !has($Number, key)){
$.setDesc($Number, key, $.getDesc(Base, key));
}
}
);
$Number.prototype = proto;
proto.constructor = $Number;
__webpack_require__(15)(global, NUMBER, $Number);
}
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.1 Number.EPSILON
var $def = __webpack_require__(12);
$def($def.S, 'Number', {EPSILON: Math.pow(2, -52)});
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.2 Number.isFinite(number)
var $def = __webpack_require__(12)
, _isFinite = __webpack_require__(7).isFinite;
$def($def.S, 'Number', {
isFinite: function isFinite(it){
return typeof it == 'number' && _isFinite(it);
}
});
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.3 Number.isInteger(number)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {isInteger: __webpack_require__(63)});
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.3 Number.isInteger(number)
var isObject = __webpack_require__(9)
, floor = Math.floor;
module.exports = function isInteger(it){
return !isObject(it) && isFinite(it) && floor(it) === it;
};
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.4 Number.isNaN(number)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {
isNaN: function isNaN(number){
return number != number;
}
});
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.5 Number.isSafeInteger(number)
var $def = __webpack_require__(12)
, isInteger = __webpack_require__(63)
, abs = Math.abs;
$def($def.S, 'Number', {
isSafeInteger: function isSafeInteger(number){
return isInteger(number) && abs(number) <= 0x1fffffffffffff;
}
});
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.6 Number.MAX_SAFE_INTEGER
var $def = __webpack_require__(12);
$def($def.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.10 Number.MIN_SAFE_INTEGER
var $def = __webpack_require__(12);
$def($def.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff});
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.12 Number.parseFloat(string)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {parseFloat: parseFloat});
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
// 20.1.2.13 Number.parseInt(string, radix)
var $def = __webpack_require__(12);
$def($def.S, 'Number', {parseInt: parseInt});
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.3 Math.acosh(x)
var $def = __webpack_require__(12)
, log1p = __webpack_require__(71)
, sqrt = Math.sqrt
, $acosh = Math.acosh;
// V8 bug https://code.google.com/p/v8/issues/detail?id=3509
$def($def.S + $def.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', {
acosh: function acosh(x){
return (x = +x) < 1 ? NaN : x > 94906265.62425156
? Math.log(x) + Math.LN2
: log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
}
});
/***/ },
/* 71 */
/***/ function(module, exports) {
// 20.2.2.20 Math.log1p(x)
module.exports = Math.log1p || function log1p(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
};
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.5 Math.asinh(x)
var $def = __webpack_require__(12);
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
}
$def($def.S, 'Math', {asinh: asinh});
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.7 Math.atanh(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
atanh: function atanh(x){
return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
}
});
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.9 Math.cbrt(x)
var $def = __webpack_require__(12)
, sign = __webpack_require__(75);
$def($def.S, 'Math', {
cbrt: function cbrt(x){
return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
}
});
/***/ },
/* 75 */
/***/ function(module, exports) {
// 20.2.2.28 Math.sign(x)
module.exports = Math.sign || function sign(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.11 Math.clz32(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
clz32: function clz32(x){
return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
}
});
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.12 Math.cosh(x)
var $def = __webpack_require__(12)
, exp = Math.exp;
$def($def.S, 'Math', {
cosh: function cosh(x){
return (exp(x = +x) + exp(-x)) / 2;
}
});
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.14 Math.expm1(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {expm1: __webpack_require__(79)});
/***/ },
/* 79 */
/***/ function(module, exports) {
// 20.2.2.14 Math.expm1(x)
module.exports = Math.expm1 || function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
};
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.16 Math.fround(x)
var $def = __webpack_require__(12)
, sign = __webpack_require__(75)
, pow = Math.pow
, EPSILON = pow(2, -52)
, EPSILON32 = pow(2, -23)
, MAX32 = pow(2, 127) * (2 - EPSILON32)
, MIN32 = pow(2, -126);
var roundTiesToEven = function(n){
return n + 1 / EPSILON - 1 / EPSILON;
};
$def($def.S, 'Math', {
fround: function fround(x){
var $abs = Math.abs(x)
, $sign = sign(x)
, a, result;
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
a = (1 + EPSILON32 / EPSILON) * $abs;
result = a - (a - $abs);
if(result > MAX32 || result != result)return $sign * Infinity;
return $sign * result;
}
});
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
var $def = __webpack_require__(12)
, abs = Math.abs;
$def($def.S, 'Math', {
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
var sum = 0
, i = 0
, len = arguments.length
, larg = 0
, arg, div;
while(i < len){
arg = abs(arguments[i++]);
if(larg < arg){
div = larg / arg;
sum = sum * div * div + 1;
larg = arg;
} else if(arg > 0){
div = arg / larg;
sum += div * div;
} else sum += arg;
}
return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
}
});
/***/ },
/* 82 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.18 Math.imul(x, y)
var $def = __webpack_require__(12);
// WebKit fails with big numbers
$def($def.S + $def.F * __webpack_require__(4)(function(){
return Math.imul(0xffffffff, 5) != -5;
}), 'Math', {
imul: function imul(x, y){
var UINT16 = 0xffff
, xn = +x
, yn = +y
, xl = UINT16 & xn
, yl = UINT16 & yn;
return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
}
});
/***/ },
/* 83 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.21 Math.log10(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
log10: function log10(x){
return Math.log(x) / Math.LN10;
}
});
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.20 Math.log1p(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {log1p: __webpack_require__(71)});
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.22 Math.log2(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
log2: function log2(x){
return Math.log(x) / Math.LN2;
}
});
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.28 Math.sign(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {sign: __webpack_require__(75)});
/***/ },
/* 87 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.30 Math.sinh(x)
var $def = __webpack_require__(12)
, expm1 = __webpack_require__(79)
, exp = Math.exp;
$def($def.S, 'Math', {
sinh: function sinh(x){
return Math.abs(x = +x) < 1
? (expm1(x) - expm1(-x)) / 2
: (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
}
});
/***/ },
/* 88 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.33 Math.tanh(x)
var $def = __webpack_require__(12)
, expm1 = __webpack_require__(79)
, exp = Math.exp;
$def($def.S, 'Math', {
tanh: function tanh(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
}
});
/***/ },
/* 89 */
/***/ function(module, exports, __webpack_require__) {
// 20.2.2.34 Math.trunc(x)
var $def = __webpack_require__(12);
$def($def.S, 'Math', {
trunc: function trunc(it){
return (it > 0 ? Math.floor : Math.ceil)(it);
}
});
/***/ },
/* 90 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, toIndex = __webpack_require__(28)
, fromCharCode = String.fromCharCode
, $fromCodePoint = String.fromCodePoint;
// length should be 1, old FF problem
$def($def.S + $def.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
var res = []
, len = arguments.length
, i = 0
, code;
while(len > i){
code = +arguments[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
}
});
/***/ },
/* 91 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, toIObject = __webpack_require__(27)
, toLength = __webpack_require__(24);
$def($def.S, 'String', {
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function raw(callSite){
var tpl = toIObject(callSite.raw)
, len = toLength(tpl.length)
, sln = arguments.length
, res = []
, i = 0;
while(len > i){
res.push(String(tpl[i++]));
if(i < sln)res.push(String(arguments[i]));
} return res.join('');
}
});
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 21.1.3.25 String.prototype.trim()
__webpack_require__(93)('trim', function($trim){
return function trim(){
return $trim(this, 3);
};
});
/***/ },
/* 93 */
/***/ function(module, exports, __webpack_require__) {
// 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim = function(string, TYPE){
string = String(defined(string));
if(TYPE & 1)string = string.replace(ltrim, '');
if(TYPE & 2)string = string.replace(rtrim, '');
return string;
};
var $def = __webpack_require__(12)
, defined = __webpack_require__(23)
, spaces = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'
, space = '[' + spaces + ']'
, non = '\u200b\u0085'
, ltrim = RegExp('^' + space + space + '*')
, rtrim = RegExp(space + space + '*$');
module.exports = function(KEY, exec){
var exp = {};
exp[KEY] = exec(trim);
$def($def.P + $def.F * __webpack_require__(4)(function(){
return !!spaces[KEY]() || non[KEY]() != non;
}), 'String', exp);
};
/***/ },
/* 94 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $at = __webpack_require__(95)(false);
$def($def.P, 'String', {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: function codePointAt(pos){
return $at(this, pos);
}
});
/***/ },
/* 95 */
/***/ function(module, exports, __webpack_require__) {
// true -> String#at
// false -> String#codePointAt
var toInteger = __webpack_require__(25)
, defined = __webpack_require__(23);
module.exports = function(TO_STRING){
return function(that, pos){
var s = String(defined(that))
, i = toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l
|| (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ },
/* 96 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, toLength = __webpack_require__(24)
, context = __webpack_require__(97);
// should throw error on regex
$def($def.P + $def.F * !__webpack_require__(4)(function(){ 'q'.endsWith(/./); }), 'String', {
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
endsWith: function endsWith(searchString /*, endPosition = @length */){
var that = context(this, searchString, 'endsWith')
, endPosition = arguments[1]
, len = toLength(that.length)
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len)
, search = String(searchString);
return that.slice(end - search.length, end) === search;
}
});
/***/ },
/* 97 */
/***/ function(module, exports, __webpack_require__) {
// helper for String#{startsWith, endsWith, includes}
var defined = __webpack_require__(23)
, cof = __webpack_require__(11);
module.exports = function(that, searchString, NAME){
if(cof(searchString) == 'RegExp')throw TypeError('String#' + NAME + " doesn't accept regex!");
return String(defined(that));
};
/***/ },
/* 98 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, context = __webpack_require__(97);
$def($def.P, 'String', {
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
includes: function includes(searchString /*, position = 0 */){
return !!~context(this, searchString, 'includes').indexOf(searchString, arguments[1]);
}
});
/***/ },
/* 99 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12);
$def($def.P, 'String', {
// 21.1.3.13 String.prototype.repeat(count)
repeat: __webpack_require__(100)
});
/***/ },
/* 100 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var toInteger = __webpack_require__(25)
, defined = __webpack_require__(23);
module.exports = function repeat(count){
var str = String(defined(this))
, res = ''
, n = toInteger(count);
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
return res;
};
/***/ },
/* 101 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, toLength = __webpack_require__(24)
, context = __webpack_require__(97);
// should throw error on regex
$def($def.P + $def.F * !__webpack_require__(4)(function(){ 'q'.startsWith(/./); }), 'String', {
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
startsWith: function startsWith(searchString /*, position = 0 */){
var that = context(this, searchString, 'startsWith')
, index = toLength(Math.min(arguments[1], that.length))
, search = String(searchString);
return that.slice(index, index + search.length) === search;
}
});
/***/ },
/* 102 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(95)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(103)(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
/***/ },
/* 103 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(37)
, $def = __webpack_require__(12)
, $redef = __webpack_require__(15)
, hide = __webpack_require__(14)
, has = __webpack_require__(10)
, SYMBOL_ITERATOR = __webpack_require__(33)('iterator')
, Iterators = __webpack_require__(104)
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){
__webpack_require__(105)(Constructor, NAME, next);
var createMethod = function(kind){
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, proto = Base.prototype
, _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, _default = _native || createMethod(DEFAULT)
, methods, key;
// Fix native
if(_native){
var IteratorPrototype = __webpack_require__(2).getProto(_default.call(new Base));
// Set @@toStringTag to native iterators
__webpack_require__(32)(IteratorPrototype, TAG, true);
// FF fix
if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, SYMBOL_ITERATOR, returnThis);
}
// Define iterator
if(!LIBRARY || FORCE)hide(proto, SYMBOL_ITERATOR, _default);
// Plug for library
Iterators[NAME] = _default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
keys: IS_SET ? _default : createMethod(KEYS),
values: DEFAULT == VALUES ? _default : createMethod(VALUES),
entries: DEFAULT != VALUES ? _default : createMethod('entries')
};
if(FORCE)for(key in methods){
if(!(key in proto))$redef(proto, key, methods[key]);
} else $def($def.P + $def.F * __webpack_require__(106), NAME, methods);
}
};
/***/ },
/* 104 */
/***/ function(module, exports) {
module.exports = {};
/***/ },
/* 105 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(14)(IteratorPrototype, __webpack_require__(33)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = $.create(IteratorPrototype, {next: __webpack_require__(5)(1,next)});
__webpack_require__(32)(Constructor, NAME + ' Iterator');
};
/***/ },
/* 106 */
/***/ function(module, exports) {
// Safari has buggy iterators w/o `next`
module.exports = 'keys' in [] && !('next' in [].keys());
/***/ },
/* 107 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ctx = __webpack_require__(19)
, $def = __webpack_require__(12)
, toObject = __webpack_require__(22)
, call = __webpack_require__(108)
, isArrayIter = __webpack_require__(109)
, toLength = __webpack_require__(24)
, getIterFn = __webpack_require__(110);
$def($def.S + $def.F * !__webpack_require__(111)(function(iter){ Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = toObject(arrayLike)
, C = typeof this == 'function' ? this : Array
, mapfn = arguments[1]
, mapping = mapfn !== undefined
, index = 0
, iterFn = getIterFn(O)
, length, result, step, iterator;
if(mapping)mapfn = ctx(mapfn, arguments[2], 2);
// if object isn't iterable or it's array with default iterator - use simple case
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;
}
} else {
for(result = new C(length = toLength(O.length)); length > index; index++){
result[index] = mapping ? mapfn(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
/***/ },
/* 108 */
/***/ function(module, exports, __webpack_require__) {
// call something on iterator step with safe closing on error
var anObject = __webpack_require__(26);
module.exports = function(iterator, fn, value, entries){
try {
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch(e){
var ret = iterator['return'];
if(ret !== undefined)anObject(ret.call(iterator));
throw e;
}
};
/***/ },
/* 109 */
/***/ function(module, exports, __webpack_require__) {
// check on default Array iterator
var Iterators = __webpack_require__(104)
, ITERATOR = __webpack_require__(33)('iterator');
module.exports = function(it){
return (Iterators.Array || Array.prototype[ITERATOR]) === it;
};
/***/ },
/* 110 */
/***/ function(module, exports, __webpack_require__) {
var classof = __webpack_require__(45)
, ITERATOR = __webpack_require__(33)('iterator')
, Iterators = __webpack_require__(104);
module.exports = __webpack_require__(13).getIteratorMethod = function(it){
if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
};
/***/ },
/* 111 */
/***/ function(module, exports, __webpack_require__) {
var SYMBOL_ITERATOR = __webpack_require__(33)('iterator')
, SAFE_CLOSING = false;
try {
var riter = [7][SYMBOL_ITERATOR]();
riter['return'] = function(){ SAFE_CLOSING = true; };
Array.from(riter, function(){ throw 2; });
} catch(e){ /* empty */ }
module.exports = function(exec){
if(!SAFE_CLOSING)return false;
var safe = false;
try {
var arr = [7]
, iter = arr[SYMBOL_ITERATOR]();
iter.next = function(){ safe = true; };
arr[SYMBOL_ITERATOR] = function(){ return iter; };
exec(arr);
} catch(e){ /* empty */ }
return safe;
};
/***/ },
/* 112 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12);
$def($def.S, 'Array', {
// 22.1.2.3 Array.of( ...items)
of: function of(/* ...args */){
var index = 0
, length = arguments.length
, result = new (typeof this == 'function' ? this : Array)(length);
while(length > index)result[index] = arguments[index++];
result.length = length;
return result;
}
});
/***/ },
/* 113 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var setUnscope = __webpack_require__(114)
, step = __webpack_require__(115)
, Iterators = __webpack_require__(104)
, toIObject = __webpack_require__(27);
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
__webpack_require__(103)(Array, 'Array', function(iterated, kind){
this._t = toIObject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var O = this._t
, kind = this._k
, index = this._i++;
if(!O || index >= O.length){
this._t = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
setUnscope('keys');
setUnscope('values');
setUnscope('entries');
/***/ },
/* 114 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES = __webpack_require__(33)('unscopables');
if(!(UNSCOPABLES in []))__webpack_require__(14)(Array.prototype, UNSCOPABLES, {});
module.exports = function(key){
[][UNSCOPABLES][key] = true;
};
/***/ },
/* 115 */
/***/ function(module, exports) {
module.exports = function(done, value){
return {value: value, done: !!done};
};
/***/ },
/* 116 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(117)(Array);
/***/ },
/* 117 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, SPECIES = __webpack_require__(33)('species');
module.exports = function(C){
if(__webpack_require__(3) && !(SPECIES in C))$.setDesc(C, SPECIES, {
configurable: true,
get: function(){ return this; }
});
};
/***/ },
/* 118 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, toObject = __webpack_require__(22)
, toIndex = __webpack_require__(28)
, toLength = __webpack_require__(24);
$def($def.P, 'Array', {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
copyWithin: function copyWithin(target/* = 0 */, start /* = 0, end = @length */){
var O = toObject(this)
, len = toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, end = arguments[2]
, fin = end === undefined ? len : toIndex(end, len)
, count = Math.min(fin - from, len - to)
, inc = 1;
if(from < to && to < from + count){
inc = -1;
from = from + count - 1;
to = to + count - 1;
}
while(count-- > 0){
if(from in O)O[to] = O[from];
else delete O[to];
to += inc;
from += inc;
} return O;
}
});
__webpack_require__(114)('copyWithin');
/***/ },
/* 119 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, toObject = __webpack_require__(22)
, toIndex = __webpack_require__(28)
, toLength = __webpack_require__(24);
$def($def.P, 'Array', {
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
fill: function fill(value /*, start = 0, end = @length */){
var O = toObject(this, true)
, length = toLength(O.length)
, index = toIndex(arguments[1], length)
, end = arguments[2]
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
}
});
__webpack_require__(114)('fill');
/***/ },
/* 120 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
var KEY = 'find'
, $def = __webpack_require__(12)
, forced = true
, $find = __webpack_require__(18)(5);
// Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
$def($def.P + $def.F * forced, 'Array', {
find: function find(callbackfn/*, that = undefined */){
return $find(this, callbackfn, arguments[1]);
}
});
__webpack_require__(114)(KEY);
/***/ },
/* 121 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
var KEY = 'findIndex'
, $def = __webpack_require__(12)
, forced = true
, $find = __webpack_require__(18)(6);
// Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){ forced = false; });
$def($def.P + $def.F * forced, 'Array', {
findIndex: function findIndex(callbackfn/*, that = undefined */){
return $find(this, callbackfn, arguments[1]);
}
});
__webpack_require__(114)(KEY);
/***/ },
/* 122 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, global = __webpack_require__(7)
, cof = __webpack_require__(11)
, $flags = __webpack_require__(123)
, $RegExp = global.RegExp
, Base = $RegExp
, proto = $RegExp.prototype
, re = /a/g
// "new" creates a new object
, CORRECT_NEW = new $RegExp(re) !== re
// RegExp allows a regex with flags as the pattern
, ALLOWS_RE_WITH_FLAGS = function(){
try {
return $RegExp(re, 'i') == '/a/i';
} catch(e){ /* empty */ }
}();
if(__webpack_require__(3)){
if(!CORRECT_NEW || !ALLOWS_RE_WITH_FLAGS){
$RegExp = function RegExp(pattern, flags){
var patternIsRegExp = cof(pattern) == 'RegExp'
, flagsIsUndefined = flags === undefined;
if(!(this instanceof $RegExp) && patternIsRegExp && flagsIsUndefined)return pattern;
return CORRECT_NEW
? new Base(patternIsRegExp && !flagsIsUndefined ? pattern.source : pattern, flags)
: new Base(patternIsRegExp ? pattern.source : pattern
, patternIsRegExp && flagsIsUndefined ? $flags.call(pattern) : flags);
};
$.each.call($.getNames(Base), function(key){
key in $RegExp || $.setDesc($RegExp, key, {
configurable: true,
get: function(){ return Base[key]; },
set: function(it){ Base[key] = it; }
});
});
proto.constructor = $RegExp;
$RegExp.prototype = proto;
__webpack_require__(15)(global, 'RegExp', $RegExp);
}
}
__webpack_require__(117)($RegExp);
/***/ },
/* 123 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 21.2.5.3 get RegExp.prototype.flags
var anObject = __webpack_require__(26);
module.exports = function(){
var that = anObject(this)
, result = '';
if(that.global)result += 'g';
if(that.ignoreCase)result += 'i';
if(that.multiline)result += 'm';
if(that.unicode)result += 'u';
if(that.sticky)result += 'y';
return result;
};
/***/ },
/* 124 */
/***/ function(module, exports, __webpack_require__) {
// 21.2.5.3 get RegExp.prototype.flags()
var $ = __webpack_require__(2);
if(__webpack_require__(3) && /./g.flags != 'g')$.setDesc(RegExp.prototype, 'flags', {
configurable: true,
get: __webpack_require__(123)
});
/***/ },
/* 125 */
/***/ function(module, exports, __webpack_require__) {
// @@match logic
__webpack_require__(126)('match', 1, function(defined, MATCH){
// 21.1.3.11 String.prototype.match(regexp)
return function match(regexp){
'use strict';
var O = defined(this)
, fn = regexp == undefined ? undefined : regexp[MATCH];
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
};
});
/***/ },
/* 126 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = function(KEY, length, exec){
var defined = __webpack_require__(23)
, SYMBOL = __webpack_require__(33)(KEY)
, original = ''[KEY];
if(__webpack_require__(4)(function(){
var O = {};
O[SYMBOL] = function(){ return 7; };
return ''[KEY](O) != 7;
})){
__webpack_require__(15)(String.prototype, KEY, exec(defined, SYMBOL, original));
__webpack_require__(14)(RegExp.prototype, SYMBOL, length == 2
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
? function(string, arg){ return original.call(string, this, arg); }
// 21.2.5.6 RegExp.prototype[@@match](string)
// 21.2.5.9 RegExp.prototype[@@search](string)
: function(string){ return original.call(string, this); }
);
}
};
/***/ },
/* 127 */
/***/ function(module, exports, __webpack_require__) {
// @@replace logic
__webpack_require__(126)('replace', 2, function(defined, REPLACE, $replace){
// 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
return function replace(searchValue, replaceValue){
'use strict';
var O = defined(this)
, fn = searchValue == undefined ? undefined : searchValue[REPLACE];
return fn !== undefined
? fn.call(searchValue, O, replaceValue)
: $replace.call(String(O), searchValue, replaceValue);
};
});
/***/ },
/* 128 */
/***/ function(module, exports, __webpack_require__) {
// @@search logic
__webpack_require__(126)('search', 1, function(defined, SEARCH){
// 21.1.3.15 String.prototype.search(regexp)
return function search(regexp){
'use strict';
var O = defined(this)
, fn = regexp == undefined ? undefined : regexp[SEARCH];
return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
};
});
/***/ },
/* 129 */
/***/ function(module, exports, __webpack_require__) {
// @@split logic
__webpack_require__(126)('split', 2, function(defined, SPLIT, $split){
// 21.1.3.17 String.prototype.split(separator, limit)
return function split(separator, limit){
'use strict';
var O = defined(this)
, fn = separator == undefined ? undefined : separator[SPLIT];
return fn !== undefined
? fn.call(separator, O, limit)
: $split.call(String(O), separator, limit);
};
});
/***/ },
/* 130 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, LIBRARY = __webpack_require__(37)
, global = __webpack_require__(7)
, ctx = __webpack_require__(19)
, classof = __webpack_require__(45)
, $def = __webpack_require__(12)
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(26)
, aFunction = __webpack_require__(20)
, strictNew = __webpack_require__(131)
, forOf = __webpack_require__(132)
, setProto = __webpack_require__(43).set
, same = __webpack_require__(41)
, species = __webpack_require__(117)
, SPECIES = __webpack_require__(33)('species')
, RECORD = __webpack_require__(16)('record')
, asap = __webpack_require__(133)
, PROMISE = 'Promise'
, process = global.process
, isNode = classof(process) == 'process'
, P = global[PROMISE]
, Wrapper;
var testResolve = function(sub){
var test = new P(function(){});
if(sub)test.constructor = Object;
return P.resolve(test) === test;
};
var useNative = function(){
var works = false;
function P2(x){
var self = new P(x);
setProto(self, P2.prototype);
return self;
}
try {
works = P && P.resolve && testResolve();
setProto(P2, P);
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
// actual Firefox has broken subclass support, test that
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
works = false;
}
// actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162
if(works && __webpack_require__(3)){
var thenableThenGotten = false;
P.resolve($.setDesc({}, 'then', {
get: function(){ thenableThenGotten = true; }
}));
works = thenableThenGotten;
}
} catch(e){ works = false; }
return works;
}();
// helpers
var isPromise = function(it){
return isObject(it) && (useNative ? classof(it) == 'Promise' : RECORD in it);
};
var sameConstructor = function(a, b){
// library wrapper special case
if(LIBRARY && a === P && b === Wrapper)return true;
return same(a, b);
};
var getConstructor = function(C){
var S = anObject(C)[SPECIES];
return S != undefined ? S : C;
};
var isThenable = function(it){
var then;
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var notify = function(record, isReject){
if(record.n)return;
record.n = true;
var chain = record.c;
asap(function(){
var value = record.v
, ok = record.s == 1
, i = 0;
var run = function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError('Promise-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
};
while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
chain.length = 0;
record.n = false;
if(isReject)setTimeout(function(){
asap(function(){
if(isUnhandled(record.p)){
if(isNode){
process.emit('unhandledRejection', value, record.p);
} else if(global.console && console.error){
console.error('Unhandled promise rejection', value);
}
}
record.a = undefined;
});
}, 1);
});
};
var isUnhandled = function(promise){
var record = promise[RECORD]
, chain = record.a || record.c
, i = 0
, react;
if(record.h)return false;
while(chain.length > i){
react = chain[i++];
if(react.fail || !isUnhandled(react.P))return false;
} return true;
};
var $reject = function(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
record.a = record.c.slice();
notify(record, true);
};
var $resolve = function(value){
var record = this
, then;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
asap(function(){
var wrapper = {r: record, d: false}; // wrap
try {
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
} catch(e){
$reject.call(wrapper, e);
}
});
} else {
record.v = value;
record.s = 1;
notify(record, false);
}
} catch(e){
$reject.call({r: record, d: false}, e); // wrap
}
};
// constructor polyfill
if(!useNative){
// 25.4.3.1 Promise(executor)
P = function Promise(executor){
aFunction(executor);
var record = {
p: strictNew(this, P, PROMISE), // <- promise
c: [], // <- awaiting reactions
a: undefined, // <- checked in isUnhandled reactions
s: 0, // <- state
d: false, // <- done
v: undefined, // <- value
h: false, // <- handled rejection
n: false // <- notify
};
this[RECORD] = record;
try {
executor(ctx($resolve, record, 1), ctx($reject, record, 1));
} catch(err){
$reject.call(record, err);
}
};
__webpack_require__(135)(P.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function then(onFulfilled, onRejected){
var S = anObject(anObject(this).constructor)[SPECIES];
var react = {
ok: typeof onFulfilled == 'function' ? onFulfilled : true,
fail: typeof onRejected == 'function' ? onRejected : false
};
var promise = react.P = new (S != undefined ? S : P)(function(res, rej){
react.res = aFunction(res);
react.rej = aFunction(rej);
});
var record = this[RECORD];
record.c.push(react);
if(record.a)record.a.push(react);
if(record.s)notify(record, false);
return promise;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
}
// export
$def($def.G + $def.W + $def.F * !useNative, {Promise: P});
__webpack_require__(32)(P, PROMISE);
species(P);
species(Wrapper = __webpack_require__(13)[PROMISE]);
// statics
$def($def.S + $def.F * !useNative, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r){
return new this(function(res, rej){ rej(r); });
}
});
$def($def.S + $def.F * (!useNative || testResolve(true)), PROMISE, {
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x){
return isPromise(x) && sameConstructor(x.constructor, this)
? x : new this(function(res){ res(x); });
}
});
$def($def.S + $def.F * !(useNative && __webpack_require__(111)(function(iter){
P.all(iter)['catch'](function(){});
})), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function all(iterable){
var C = getConstructor(this)
, values = [];
return new C(function(res, rej){
forOf(iterable, false, values.push, values);
var remaining = values.length
, results = Array(remaining);
if(remaining)$.each.call(values, function(promise, index){
C.resolve(promise).then(function(value){
results[index] = value;
--remaining || res(results);
}, rej);
});
else res(results);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function race(iterable){
var C = getConstructor(this);
return new C(function(res, rej){
forOf(iterable, false, function(promise){
C.resolve(promise).then(res, rej);
});
});
}
});
/***/ },
/* 131 */
/***/ function(module, exports) {
module.exports = function(it, Constructor, name){
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
return it;
};
/***/ },
/* 132 */
/***/ function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(19)
, call = __webpack_require__(108)
, isArrayIter = __webpack_require__(109)
, anObject = __webpack_require__(26)
, toLength = __webpack_require__(24)
, getIterFn = __webpack_require__(110);
module.exports = function(iterable, entries, fn, that){
var iterFn = getIterFn(iterable)
, f = ctx(fn, that, entries ? 2 : 1)
, index = 0
, length, step, iterator;
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
// fast case for arrays with default iterator
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
call(iterator, f, step.value, entries);
}
};
/***/ },
/* 133 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(7)
, macrotask = __webpack_require__(134).set
, Observer = global.MutationObserver || global.WebKitMutationObserver
, process = global.process
, head, last, notify;
function flush(){
while(head){
head.fn.call(); // <- currently we use it only for Promise - try / catch not required
head = head.next;
} last = undefined;
}
// Node.js
if(__webpack_require__(11)(process) == 'process'){
notify = function(){
process.nextTick(flush);
};
// browsers with MutationObserver
} else if(Observer){
var toggle = 1
, node = document.createTextNode('');
new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
notify = function(){
node.data = toggle = -toggle;
};
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
// - window.postMessag
// - onreadystatechange
// - setTimeout
} else {
notify = function(){
// strange IE + webpack dev server bug - use .call(global)
macrotask.call(global, flush);
};
}
module.exports = function asap(fn){
var task = {fn: fn, next: undefined};
if(last)last.next = task;
if(!head){
head = task;
notify();
} last = task;
};
/***/ },
/* 134 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ctx = __webpack_require__(19)
, invoke = __webpack_require__(17)
, html = __webpack_require__(6)
, cel = __webpack_require__(8)
, global = __webpack_require__(7)
, process = global.process
, setTask = global.setImmediate
, clearTask = global.clearImmediate
, MessageChannel = global.MessageChannel
, counter = 0
, queue = {}
, ONREADYSTATECHANGE = 'onreadystatechange'
, defer, channel, port;
var run = function(){
var id = +this;
if(queue.hasOwnProperty(id)){
var fn = queue[id];
delete queue[id];
fn();
}
};
var listner = function(event){
run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!setTask || !clearTask){
setTask = function setImmediate(fn){
var args = [], i = 1;
while(arguments.length > i)args.push(arguments[i++]);
queue[++counter] = function(){
invoke(typeof fn == 'function' ? fn : Function(fn), args);
};
defer(counter);
return counter;
};
clearTask = function clearImmediate(id){
delete queue[id];
};
// Node.js 0.8-
if(__webpack_require__(11)(process) == 'process'){
defer = function(id){
process.nextTick(ctx(run, id, 1));
};
// Browsers with MessageChannel, includes WebWorkers
} else if(MessageChannel){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if(global.addEventListener && typeof postMessage == 'function' && !global.importScript){
defer = function(id){
global.postMessage(id + '', '*');
};
global.addEventListener('message', listner, false);
// IE8-
} else if(ONREADYSTATECHANGE in cel('script')){
defer = function(id){
html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
html.removeChild(this);
run.call(id);
};
};
// Rest old browsers
} else {
defer = function(id){
setTimeout(ctx(run, id, 1), 0);
};
}
}
module.exports = {
set: setTask,
clear: clearTask
};
/***/ },
/* 135 */
/***/ function(module, exports, __webpack_require__) {
var $redef = __webpack_require__(15);
module.exports = function(target, src){
for(var key in src)$redef(target, key, src[key]);
return target;
};
/***/ },
/* 136 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(137);
// 23.1 Map Objects
__webpack_require__(138)('Map', function(get){
return function Map(){ return get(this, arguments[0]); };
}, {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key){
var entry = strong.getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value){
return strong.def(this, key === 0 ? 0 : key, value);
}
}, strong, true);
/***/ },
/* 137 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, hide = __webpack_require__(14)
, ctx = __webpack_require__(19)
, species = __webpack_require__(117)
, strictNew = __webpack_require__(131)
, defined = __webpack_require__(23)
, forOf = __webpack_require__(132)
, step = __webpack_require__(115)
, ID = __webpack_require__(16)('id')
, $has = __webpack_require__(10)
, isObject = __webpack_require__(9)
, isExtensible = Object.isExtensible || isObject
, SUPPORT_DESC = __webpack_require__(3)
, SIZE = SUPPORT_DESC ? '_s' : 'size'
, id = 0;
var fastKey = function(it, create){
// return primitive with prefix
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if(!$has(it, ID)){
// can't set id to frozen object
if(!isExtensible(it))return 'F';
// not necessary to add id
if(!create)return 'E';
// add missing object id
hide(it, ID, ++id);
// return object id with prefix
} return 'O' + it[ID];
};
var getEntry = function(that, key){
// fast case
var index = fastKey(key), entry;
if(index !== 'F')return that._i[index];
// frozen object case
for(entry = that._f; entry; entry = entry.n){
if(entry.k == key)return entry;
}
};
module.exports = {
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
var C = wrapper(function(that, iterable){
strictNew(that, C, NAME);
that._i = $.create(null); // index
that._f = undefined; // first entry
that._l = undefined; // last entry
that[SIZE] = 0; // size
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
});
__webpack_require__(135)(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear(){
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that._f = that._l = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that._i[entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that._f == entry)that._f = next;
if(that._l == entry)that._l = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments[1], 3)
, entry;
while(entry = entry ? entry.n : this._f){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key){
return !!getEntry(this, key);
}
});
if(SUPPORT_DESC)$.setDesc(C.prototype, 'size', {
get: function(){
return defined(this[SIZE]);
}
});
return C;
},
def: function(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry){
entry.v = value;
// create new entry
} else {
that._l = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that._l, // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that._f)that._f = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index !== 'F')that._i[index] = entry;
} return that;
},
getEntry: getEntry,
setStrong: function(C, NAME, IS_MAP){
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
__webpack_require__(103)(C, NAME, function(iterated, kind){
this._t = iterated; // target
this._k = kind; // kind
this._l = undefined; // previous
}, function(){
var that = this
, kind = that._k
, entry = that._l;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
// or finish the iteration
that._t = undefined;
return step(1);
}
// return step by kind
if(kind == 'keys' )return step(0, entry.k);
if(kind == 'values')return step(0, entry.v);
return step(0, [entry.k, entry.v]);
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
// add [@@species], 23.1.2.2, 23.2.2.2
species(C);
species(__webpack_require__(13)[NAME]); // for wrapper
}
};
/***/ },
/* 138 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var global = __webpack_require__(7)
, $def = __webpack_require__(12)
, BUGGY = __webpack_require__(106)
, forOf = __webpack_require__(132)
, strictNew = __webpack_require__(131);
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
var Base = global[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
var fixMethod = function(KEY){
var fn = proto[KEY];
__webpack_require__(15)(proto, KEY,
KEY == 'delete' ? function(a){ return fn.call(this, a === 0 ? 0 : a); }
: KEY == 'has' ? function has(a){ return fn.call(this, a === 0 ? 0 : a); }
: KEY == 'get' ? function get(a){ return fn.call(this, a === 0 ? 0 : a); }
: KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
: function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
);
};
if(typeof C != 'function' || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
// create collection constructor
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
__webpack_require__(135)(C.prototype, methods);
} else {
var inst = new C
, chain = inst[ADDER](IS_WEAK ? {} : -0, 1)
, buggyZero;
// wrap for init collections from iterable
if(!__webpack_require__(111)(function(iter){ new C(iter); })){ // eslint-disable-line no-new
C = wrapper(function(target, iterable){
strictNew(target, C, NAME);
var that = new Base;
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
return that;
});
C.prototype = proto;
proto.constructor = C;
}
IS_WEAK || inst.forEach(function(val, key){
buggyZero = 1 / key === -Infinity;
});
// fix converting -0 key to +0
if(buggyZero){
fixMethod('delete');
fixMethod('has');
IS_MAP && fixMethod('get');
}
// + fix .add & .set for chaining
if(buggyZero || chain !== inst)fixMethod(ADDER);
// weak collections should not contains .clear method
if(IS_WEAK && proto.clear)delete proto.clear;
}
__webpack_require__(32)(C, NAME);
O[NAME] = C;
$def($def.G + $def.W + $def.F * (C != Base), O);
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
return C;
};
/***/ },
/* 139 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(137);
// 23.2 Set Objects
__webpack_require__(138)('Set', function(get){
return function Set(){ return get(this, arguments[0]); };
}, {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value){
return strong.def(this, value = value === 0 ? 0 : value, value);
}
}, strong);
/***/ },
/* 140 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(2)
, weak = __webpack_require__(141)
, isObject = __webpack_require__(9)
, has = __webpack_require__(10)
, frozenStore = weak.frozenStore
, WEAK = weak.WEAK
, isExtensible = Object.isExtensible || isObject
, tmp = {};
// 23.3 WeakMap Objects
var $WeakMap = __webpack_require__(138)('WeakMap', function(get){
return function WeakMap(){ return get(this, arguments[0]); };
}, {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key){
if(isObject(key)){
if(!isExtensible(key))return frozenStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this._i];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value){
return weak.def(this, key, value);
}
}, weak, true, true);
// IE11 WeakMap frozen keys fix
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
$.each.call(['delete', 'has', 'get', 'set'], function(key){
var proto = $WeakMap.prototype
, method = proto[key];
__webpack_require__(15)(proto, key, function(a, b){
// store frozen objects on leaky map
if(isObject(a) && !isExtensible(a)){
var result = frozenStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
});
});
}
/***/ },
/* 141 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var hide = __webpack_require__(14)
, anObject = __webpack_require__(26)
, strictNew = __webpack_require__(131)
, forOf = __webpack_require__(132)
, method = __webpack_require__(18)
, WEAK = __webpack_require__(16)('weak')
, isObject = __webpack_require__(9)
, $has = __webpack_require__(10)
, isExtensible = Object.isExtensible || isObject
, find = method(5)
, findIndex = method(6)
, id = 0;
// fallback for frozen keys
var frozenStore = function(that){
return that._l || (that._l = new FrozenStore);
};
var FrozenStore = function(){
this.a = [];
};
var findFrozen = function(store, key){
return find(store.a, function(it){
return it[0] === key;
});
};
FrozenStore.prototype = {
get: function(key){
var entry = findFrozen(this, key);
if(entry)return entry[1];
},
has: function(key){
return !!findFrozen(this, key);
},
set: function(key, value){
var entry = findFrozen(this, key);
if(entry)entry[1] = value;
else this.a.push([key, value]);
},
'delete': function(key){
var index = findIndex(this.a, function(it){
return it[0] === key;
});
if(~index)this.a.splice(index, 1);
return !!~index;
}
};
module.exports = {
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
var C = wrapper(function(that, iterable){
strictNew(that, C, NAME);
that._i = id++; // collection id
that._l = undefined; // leak store for frozen objects
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
});
__webpack_require__(135)(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(!isExtensible(key))return frozenStore(this)['delete'](key);
return $has(key, WEAK) && $has(key[WEAK], this._i) && delete key[WEAK][this._i];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key){
if(!isObject(key))return false;
if(!isExtensible(key))return frozenStore(this).has(key);
return $has(key, WEAK) && $has(key[WEAK], this._i);
}
});
return C;
},
def: function(that, key, value){
if(!isExtensible(anObject(key))){
frozenStore(that).set(key, value);
} else {
$has(key, WEAK) || hide(key, WEAK, {});
key[WEAK][that._i] = value;
} return that;
},
frozenStore: frozenStore,
WEAK: WEAK
};
/***/ },
/* 142 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var weak = __webpack_require__(141);
// 23.4 WeakSet Objects
__webpack_require__(138)('WeakSet', function(get){
return function WeakSet(){ return get(this, arguments[0]); };
}, {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function add(value){
return weak.def(this, value, true);
}
}, weak, false, true);
/***/ },
/* 143 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
var $def = __webpack_require__(12)
, _apply = Function.apply;
$def($def.S, 'Reflect', {
apply: function apply(target, thisArgument, argumentsList){
return _apply.call(target, thisArgument, argumentsList);
}
});
/***/ },
/* 144 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, aFunction = __webpack_require__(20)
, anObject = __webpack_require__(26)
, isObject = __webpack_require__(9)
, bind = Function.bind || __webpack_require__(13).Function.prototype.bind;
$def($def.S, 'Reflect', {
construct: function construct(Target, args /*, newTarget*/){
aFunction(Target);
if(arguments.length < 3){
// w/o newTarget, optimization for 0-4 arguments
if(args != undefined)switch(anObject(args).length){
case 0: return new Target;
case 1: return new Target(args[0]);
case 2: return new Target(args[0], args[1]);
case 3: return new Target(args[0], args[1], args[2]);
case 4: return new Target(args[0], args[1], args[2], args[3]);
}
// w/o newTarget, lot of arguments case
var $args = [null];
$args.push.apply($args, args);
return new (bind.apply(Target, $args));
}
// with newTarget, not support built-in constructors
var proto = aFunction(arguments[2]).prototype
, instance = $.create(isObject(proto) ? proto : Object.prototype)
, result = Function.apply.call(Target, instance, args);
return isObject(result) ? result : instance;
}
});
/***/ },
/* 145 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, anObject = __webpack_require__(26);
// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
$def($def.S + $def.F * __webpack_require__(4)(function(){
Reflect.defineProperty($.setDesc({}, 1, {value: 1}), 1, {value: 2});
}), 'Reflect', {
defineProperty: function defineProperty(target, propertyKey, attributes){
anObject(target);
try {
$.setDesc(target, propertyKey, attributes);
return true;
} catch(e){
return false;
}
}
});
/***/ },
/* 146 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
var $def = __webpack_require__(12)
, getDesc = __webpack_require__(2).getDesc
, anObject = __webpack_require__(26);
$def($def.S, 'Reflect', {
deleteProperty: function deleteProperty(target, propertyKey){
var desc = getDesc(anObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
}
});
/***/ },
/* 147 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 26.1.5 Reflect.enumerate(target)
var $def = __webpack_require__(12)
, anObject = __webpack_require__(26);
var Enumerate = function(iterated){
this._t = anObject(iterated); // target
this._i = 0; // next index
var keys = this._k = [] // keys
, key;
for(key in iterated)keys.push(key);
};
__webpack_require__(105)(Enumerate, 'Object', function(){
var that = this
, keys = that._k
, key;
do {
if(that._i >= keys.length)return {value: undefined, done: true};
} while(!((key = keys[that._i++]) in that._t));
return {value: key, done: false};
});
$def($def.S, 'Reflect', {
enumerate: function enumerate(target){
return new Enumerate(target);
}
});
/***/ },
/* 148 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
var $ = __webpack_require__(2)
, has = __webpack_require__(10)
, $def = __webpack_require__(12)
, isObject = __webpack_require__(9)
, anObject = __webpack_require__(26);
function get(target, propertyKey/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc, proto;
if(anObject(target) === receiver)return target[propertyKey];
if(desc = $.getDesc(target, propertyKey))return has(desc, 'value')
? desc.value
: desc.get !== undefined
? desc.get.call(receiver)
: undefined;
if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver);
}
$def($def.S, 'Reflect', {get: get});
/***/ },
/* 149 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, anObject = __webpack_require__(26);
$def($def.S, 'Reflect', {
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
return $.getDesc(anObject(target), propertyKey);
}
});
/***/ },
/* 150 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.8 Reflect.getPrototypeOf(target)
var $def = __webpack_require__(12)
, getProto = __webpack_require__(2).getProto
, anObject = __webpack_require__(26);
$def($def.S, 'Reflect', {
getPrototypeOf: function getPrototypeOf(target){
return getProto(anObject(target));
}
});
/***/ },
/* 151 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.9 Reflect.has(target, propertyKey)
var $def = __webpack_require__(12);
$def($def.S, 'Reflect', {
has: function has(target, propertyKey){
return propertyKey in target;
}
});
/***/ },
/* 152 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.10 Reflect.isExtensible(target)
var $def = __webpack_require__(12)
, anObject = __webpack_require__(26)
, $isExtensible = Object.isExtensible;
$def($def.S, 'Reflect', {
isExtensible: function isExtensible(target){
anObject(target);
return $isExtensible ? $isExtensible(target) : true;
}
});
/***/ },
/* 153 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.11 Reflect.ownKeys(target)
var $def = __webpack_require__(12);
$def($def.S, 'Reflect', {ownKeys: __webpack_require__(154)});
/***/ },
/* 154 */
/***/ function(module, exports, __webpack_require__) {
// all object keys, includes non-enumerable and symbols
var $ = __webpack_require__(2)
, anObject = __webpack_require__(26);
module.exports = function ownKeys(it){
var keys = $.getNames(anObject(it))
, getSymbols = $.getSymbols;
return getSymbols ? keys.concat(getSymbols(it)) : keys;
};
/***/ },
/* 155 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.12 Reflect.preventExtensions(target)
var $def = __webpack_require__(12)
, anObject = __webpack_require__(26)
, $preventExtensions = Object.preventExtensions;
$def($def.S, 'Reflect', {
preventExtensions: function preventExtensions(target){
anObject(target);
try {
if($preventExtensions)$preventExtensions(target);
return true;
} catch(e){
return false;
}
}
});
/***/ },
/* 156 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
var $ = __webpack_require__(2)
, has = __webpack_require__(10)
, $def = __webpack_require__(12)
, createDesc = __webpack_require__(5)
, anObject = __webpack_require__(26)
, isObject = __webpack_require__(9);
function set(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = $.getDesc(anObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = $.getProto(target))){
return set(proto, propertyKey, V, receiver);
}
ownDesc = createDesc(0);
}
if(has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = $.getDesc(receiver, propertyKey) || createDesc(0);
existingDescriptor.value = V;
$.setDesc(receiver, propertyKey, existingDescriptor);
return true;
}
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}
$def($def.S, 'Reflect', {set: set});
/***/ },
/* 157 */
/***/ function(module, exports, __webpack_require__) {
// 26.1.14 Reflect.setPrototypeOf(target, proto)
var $def = __webpack_require__(12)
, setProto = __webpack_require__(43);
if(setProto)$def($def.S, 'Reflect', {
setPrototypeOf: function setPrototypeOf(target, proto){
setProto.check(target, proto);
try {
setProto.set(target, proto);
return true;
} catch(e){
return false;
}
}
});
/***/ },
/* 158 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $includes = __webpack_require__(29)(true);
$def($def.P, 'Array', {
// https://github.com/domenic/Array.prototype.includes
includes: function includes(el /*, fromIndex = 0 */){
return $includes(this, el, arguments[1]);
}
});
__webpack_require__(114)('includes');
/***/ },
/* 159 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/mathiasbynens/String.prototype.at
'use strict';
var $def = __webpack_require__(12)
, $at = __webpack_require__(95)(true);
$def($def.P, 'String', {
at: function at(pos){
return $at(this, pos);
}
});
/***/ },
/* 160 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $pad = __webpack_require__(161);
$def($def.P, 'String', {
padLeft: function padLeft(maxLength /*, fillString = ' ' */){
return $pad(this, maxLength, arguments[1], true);
}
});
/***/ },
/* 161 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/ljharb/proposal-string-pad-left-right
var toLength = __webpack_require__(24)
, repeat = __webpack_require__(100)
, defined = __webpack_require__(23);
module.exports = function(that, maxLength, fillString, left){
var S = String(defined(that))
, stringLength = S.length
, fillStr = fillString === undefined ? ' ' : String(fillString)
, intMaxLength = toLength(maxLength);
if(intMaxLength <= stringLength)return S;
if(fillStr == '')fillStr = ' ';
var fillLen = intMaxLength - stringLength
, stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
if(stringFiller.length > fillLen)stringFiller = left
? stringFiller.slice(stringFiller.length - fillLen)
: stringFiller.slice(0, fillLen);
return left ? stringFiller + S : S + stringFiller;
};
/***/ },
/* 162 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $def = __webpack_require__(12)
, $pad = __webpack_require__(161);
$def($def.P, 'String', {
padRight: function padRight(maxLength /*, fillString = ' ' */){
return $pad(this, maxLength, arguments[1], false);
}
});
/***/ },
/* 163 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
__webpack_require__(93)('trimLeft', function($trim){
return function trimLeft(){
return $trim(this, 1);
};
});
/***/ },
/* 164 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
__webpack_require__(93)('trimRight', function($trim){
return function trimRight(){
return $trim(this, 2);
};
});
/***/ },
/* 165 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/benjamingr/RexExp.escape
var $def = __webpack_require__(12)
, $re = __webpack_require__(166)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
$def($def.S, 'RegExp', {escape: function escape(it){ return $re(it); }});
/***/ },
/* 166 */
/***/ function(module, exports) {
module.exports = function(regExp, replace){
var replacer = replace === Object(replace) ? function(part){
return replace[part];
} : replace;
return function(it){
return String(it).replace(regExp, replacer);
};
};
/***/ },
/* 167 */
/***/ function(module, exports, __webpack_require__) {
// https://gist.github.com/WebReflection/9353781
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, ownKeys = __webpack_require__(154)
, toIObject = __webpack_require__(27)
, createDesc = __webpack_require__(5);
$def($def.S, 'Object', {
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
var O = toIObject(object)
, setDesc = $.setDesc
, getDesc = $.getDesc
, keys = ownKeys(O)
, result = {}
, i = 0
, key, D;
while(keys.length > i){
D = getDesc(O, key = keys[i++]);
if(key in result)setDesc(result, key, createDesc(0, D));
else result[key] = D;
} return result;
}
});
/***/ },
/* 168 */
/***/ function(module, exports, __webpack_require__) {
// http://goo.gl/XkBrjD
var $def = __webpack_require__(12)
, $values = __webpack_require__(169)(false);
$def($def.S, 'Object', {
values: function values(it){
return $values(it);
}
});
/***/ },
/* 169 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(2)
, toIObject = __webpack_require__(27);
module.exports = function(isEntries){
return function(it){
var O = toIObject(it)
, keys = $.getKeys(O)
, length = keys.length
, i = 0
, result = Array(length)
, key;
if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]];
else while(length > i)result[i] = O[keys[i++]];
return result;
};
};
/***/ },
/* 170 */
/***/ function(module, exports, __webpack_require__) {
// http://goo.gl/XkBrjD
var $def = __webpack_require__(12)
, $entries = __webpack_require__(169)(true);
$def($def.S, 'Object', {
entries: function entries(it){
return $entries(it);
}
});
/***/ },
/* 171 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $def = __webpack_require__(12);
$def($def.P, 'Map', {toJSON: __webpack_require__(172)('Map')});
/***/ },
/* 172 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var forOf = __webpack_require__(132)
, classof = __webpack_require__(45);
module.exports = function(NAME){
return function toJSON(){
if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
var arr = [];
forOf(this, false, arr.push, arr);
return arr;
};
};
/***/ },
/* 173 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $def = __webpack_require__(12);
$def($def.P, 'Set', {toJSON: __webpack_require__(172)('Set')});
/***/ },
/* 174 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(12)
, $task = __webpack_require__(134);
$def($def.G + $def.B, {
setImmediate: $task.set,
clearImmediate: $task.clear
});
/***/ },
/* 175 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(113);
var global = __webpack_require__(7)
, hide = __webpack_require__(14)
, Iterators = __webpack_require__(104)
, ITERATOR = __webpack_require__(33)('iterator')
, NL = global.NodeList
, HTC = global.HTMLCollection
, NLProto = NL && NL.prototype
, HTCProto = HTC && HTC.prototype
, ArrayValues = Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
if(NL && !(ITERATOR in NLProto))hide(NLProto, ITERATOR, ArrayValues);
if(HTC && !(ITERATOR in HTCProto))hide(HTCProto, ITERATOR, ArrayValues);
/***/ },
/* 176 */
/***/ function(module, exports, __webpack_require__) {
// ie9- setTimeout & setInterval additional parameters fix
var global = __webpack_require__(7)
, $def = __webpack_require__(12)
, invoke = __webpack_require__(17)
, partial = __webpack_require__(177)
, navigator = global.navigator
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
var wrap = function(set){
return MSIE ? function(fn, time /*, ...args */){
return set(invoke(
partial,
[].slice.call(arguments, 2),
typeof fn == 'function' ? fn : Function(fn)
), time);
} : set;
};
$def($def.G + $def.B + $def.F * MSIE, {
setTimeout: wrap(global.setTimeout),
setInterval: wrap(global.setInterval)
});
/***/ },
/* 177 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var path = __webpack_require__(178)
, invoke = __webpack_require__(17)
, aFunction = __webpack_require__(20);
module.exports = function(/* ...pargs */){
var fn = aFunction(this)
, length = arguments.length
, pargs = Array(length)
, i = 0
, _ = path._
, holder = false;
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
return function(/* ...args */){
var that = this
, _length = arguments.length
, j = 0, k = 0, args;
if(!holder && !_length)return invoke(fn, pargs, that);
args = pargs.slice();
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
while(_length > k)args.push(arguments[k++]);
return invoke(fn, args, that);
};
};
/***/ },
/* 178 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7);
/***/ },
/* 179 */
/***/ function(module, exports, __webpack_require__) {
// JavaScript 1.6 / Strawman array statics shim
var $ = __webpack_require__(2)
, $def = __webpack_require__(12)
, $Array = __webpack_require__(13).Array || Array
, statics = {};
var setStatics = function(keys, length){
$.each.call(keys.split(','), function(key){
if(length == undefined && key in $Array)statics[key] = $Array[key];
else if(key in [])statics[key] = __webpack_require__(19)(Function.call, [][key], length);
});
};
setStatics('pop,reverse,shift,keys,values,entries', 1);
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
'reduce,reduceRight,copyWithin,fill');
$def($def.S, 'Array', statics);
/***/ }
/******/ ]);
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = __e;
// RequireJS export
else if(typeof define == 'function' && define.amd)define(function(){return __e});
// Export to global object
else __g.core = __e;
}(1, 1); |
src/Shared/Key.js | reactotron/reactotron | import React from 'react'
import PropTypes from 'prop-types'
import Colors from '../Theme/Colors'
const Styles = {
container: {
color: Colors.background,
borderRadius: 4,
backgroundColor: Colors.foreground,
padding: '4px 12px',
fontWeight: 'bold',
borderBottom: `2px solid ${Colors.highlight}`,
marginLeft: 2,
marginRight: 2
}
}
const Key = props => {
const { text } = props
return <span style={Styles.container}>{text}</span>
}
Key.propTypes = {
text: PropTypes.string.isRequired
}
export default Key
|
node_modules/react-icons/ti/thermometer.js | bairrada97/festival |
import React from 'react'
import Icon from 'react-icon-base'
const TiThermometer = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m21.7 25.1v-9.3c0-0.4-0.4-0.8-0.9-0.8s-0.8 0.4-0.8 0.8v9.3c-1.4 0.4-2.5 1.7-2.5 3.2 0 1.9 1.5 3.4 3.3 3.4s3.4-1.5 3.4-3.4c0-1.5-1.1-2.8-2.5-3.2z m5-2.7v-13.2c0-3.3-2.6-5.9-5.9-5.9s-5.8 2.7-5.8 5.9v13.2c-1.5 1.5-2.5 3.6-2.5 5.9 0 4.6 3.7 8.4 8.3 8.4s8.4-3.8 8.4-8.4c0-2.3-1-4.4-2.5-5.9z m-5.9 10.9c-2.7 0-5-2.2-5-5 0-1.8 1-3.4 2.5-4.3v-14.8c0-1.4 1.2-2.5 2.5-2.5s2.5 1.1 2.5 2.5v14.8c1.5 0.9 2.5 2.5 2.5 4.3 0 2.8-2.2 5-5 5z"/></g>
</Icon>
)
export default TiThermometer
|
node_modules/reflexbox/docs/components/TweetButton.js | HasanSa/hackathon |
import React from 'react'
import { withReflex } from '../../src'
const script = `
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");
`
const TweetButton = ({ text, url, via, ...props }) => (
<div {...props}>
<div style={{ height: 20 }}>
<a href='https://twitter.com/share'
className='twitter-share-button'
data-text={text}
data-url={url}
data-via={via}
children='Tweet' />
<script dangerouslySetInnerHTML={{ __html: script }} />
</div>
</div>
)
TweetButton.defaultProps = {
text: '',
url: 'http://jxnblk.com/reflexbox',
via: 'jxnblk'
}
export default withReflex()(TweetButton)
|
ajax/libs/flocks.js/1.4.0/flocks.min.js | magoni/cdnjs | if("undefined"===typeof React)var React=require("react");
(function(){function h(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a){return"undefined"===typeof a}function v(a){return"object"!==typeof a||"[object Array]"===Object.prototype.toString.call(a)?!1:!0}function b(a,c){if("string"===typeof a)if(~"warn debug error log info exception assert".split(" ").indexOf(a,0))console[a]("Flocks2 ["+a+"] "+c.toString());else console.log("Flocks2 [Unknown level] "+c.toString());else l(d.flocks2Config)?console.log("Flocks2 pre-config ["+
a.toString()+"] "+c.toString()):d.flocks2Config.log_level>=a&&console.log("Flocks2 ["+a.toString()+"] "+c.toString())}function m(){b(3," - Flocks2 attempting update");if(!w)return b(1," x Flocks2 skipped update: root is not initialized"),null;if(n)return b(1," x Flocks2 skipped update: lock count updateBlocks is non-zero"),null;if(!x(d))return b(0," ! Flocks2 rolling back update: handler rejected propset"),d=e,null;e=d;b(3," - Flocks2 update passed");"detatched"===e.flocks2Config.target?b(3," - Flocks2 skipping render because explicitly detatched"):
(b(3," - Flocks2 rendering"),React.render(React.createFactory(q)({flocks2context:d}),e.flocks2Config.target));b(3," - Flocks2 update complete; finalizing");y();return!0}function z(a,c){if("string"!==typeof a)throw c||"Argument must be a string";}function A(a,c){if(!h(a))throw c||"Argument must be an array";}function B(a,c){if(!v(a))throw c||"Argument must be a non-array object";}function C(a,c,b){var d;if(!h(a))throw"Path must be an array!";if(0===a.length)return c;if(1===a.length)return d=c[a[0]],
c[a[0]]=b,d;if(-1!==["string","number"].indexOf(typeof a[0]))return d=a.splice(1,Number.MAX_VALUE),C(d,c[a[0]],b)}function D(a,c){A(a,"Flocks2 setByPathh/2 must take an array for its key");b(1,' - Flocks2 setByPath "'+a.join("|")+'"');C(a,d,c);m()}function r(a,c){b(3," - Flocks2 multi-set");if("string"===typeof a)z(a,"Flocks2 set/2 must take a string for its key"),d[a]=c,b(1,' - Flocks2 setByKey "'+a+'"'),m();else{if(h(a))return D(a,c);throw"Flocks2 set/1,2 key must be a string or an array";}}
function E(a){b(3," - Flocks2 multi-get");if("string"===typeof a)return e[a];if(h(a))return t(a);throw"Flocks2 get/1 key must be a string or an array";}function J(a){return e[a]}function F(a,c){var b;if(!h(a))throw"path must be an array!";if(0===a.length)return c;if(1===a.length)return c[a[0]];if(-1!==["string","number"].indexOf(typeof a[0]))return b=a.splice(1,Number.MAX_VALUE),F(b,c[a[0]])}function t(a){return F(a,e)}function G(a){console.log("ERROR: stub called!");B(a,"Flocks2 update/1 must take a plain object")}
function K(){++n}function H(){if(0>=n)throw"unlock()ed with no lock!";--n;m()}function u(a){var c=a.constructor(),b;if(null===a||"object"!==typeof a)return a;for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);return c}function I(a){if(l(a))return[p];if(h(a)){if(~a.indexOf(p,0))return a;a=u(a);a.push(p);return a}throw"Original mixin list must be an array or undefined!";}var p,k,w=!1,n=0,q,x=function(a){return!0},y=function(){return!0},e={},d={};k={flocks2context:React.PropTypes.object};p={contextTypes:k,
childContextTypes:k,componentWillMount:function(){b(1," - Flocks2 component will mount: "+this.constructor.displayName);b(3,l(this.props.flocks2context)?" - No F2 Context Prop":" - F2 Context Prop found");b(3,l(this.context.flocks2context)?" - No F2 Context":" - F2 Context found");this.props.flocks2context&&(this.context.flocks2context=this.props.flocks2context);this.fupdate=function(a){return G(a)};this.fget=function(a){return E(a)};this.fgetkey=function(a){return e[a]};this.fgetpath=function(a){return t(a)};
this.fset=function(a,b){return r(a,b)};this.fsetpath=function(a,b){return r(a,b)};this.flock=function(){++n};this.funlock=function(){return H()};this.fctx=this.context.flocks2context},getChildContext:function(){return this.context}};k={version:"1.4.0",createClass:function(a){a.mixins=I(a.mixins);return React.createClass(a)},mount:function(a,c){var g=a||{},e=c||{},f=function(){console.log("ERROR: stub called!");m()},f={override:f,clear:f,get:E,get_key:J,get_path:t,set:r,set_path:D,update:G,lock:K,
unlock:H};g.log_level=g.log_level||-1;q=g.control;e.flocks2Config=g;d=e;b(1,"Flocks2 root creation begins");if(!q)throw"Flocks2 fatal error: must provide a control in create/2 FlocksConfig";g.handler&&(x=g.handler,b(3," - Flocks2 handler assigned"));g.finalizer&&(y=g.finalizer,b(3," - Flocks2 finalizer assigned"));g.preventAutoContext?b(2," - Flocks2 skipping auto-context"):(b(2," - Flocks2 engaging auto-context"),this.fctx=u(d));b(3,"Flocks2 creation finished; initializing");w=!0;m();b(3,"Flocks2 expose updater");
this.fupd=f;this.fset=f.set;this.fgetkey=f.get_key;this.fgetpath=f.get_path;this.flock=f.lock;this.funlock=f.unlock;this.fupdate=f.update;b(3,"Flocks2 initialization finished");return f},clone:u,isArray:h,isUndefined:l,isNonArrayObject:v,enforceString:z,enforceArray:A,enforceNonArrayObject:B,atLeastFlocks:I,plumbing:p};"undefined"!==typeof module?module.exports=k:window.flocks=k})();
|
ajax/libs/babel-core/5.8.8/browser-polyfill.min.js | rlugojr/cdnjs | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var process=module.exports={};var queue=[];var draining=false;function drainQueue(){if(draining){return}draining=true;var currentQueue;var len=queue.length;while(len){currentQueue=queue;queue=[];var i=-1;while(++i<len){currentQueue[i]()}len=queue.length}draining=false}process.nextTick=function(fun){queue.push(fun);if(!draining){setTimeout(drainQueue,0)}};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";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.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}},{}],2:[function(require,module,exports){(function(global){"use strict";require("core-js/shim");require("regenerator/runtime");if(global._babelPolyfill){throw new Error("only one instance of babel/polyfill is allowed")}global._babelPolyfill=true}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"core-js/shim":91,"regenerator/runtime":92}],3:[function(require,module,exports){var $=require("./$");module.exports=function(IS_INCLUDES){return function($this,el,fromIndex){var O=$.toObject($this),length=$.toLength(O.length),index=$.toIndex(fromIndex,length),value;if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true}else for(;length>index;index++)if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index}return!IS_INCLUDES&&-1}}},{"./$":24}],4:[function(require,module,exports){var $=require("./$"),ctx=require("./$.ctx");module.exports=function(TYPE){var IS_MAP=TYPE==1,IS_FILTER=TYPE==2,IS_SOME=TYPE==3,IS_EVERY=TYPE==4,IS_FIND_INDEX=TYPE==6,NO_HOLES=TYPE==5||IS_FIND_INDEX;return function($this,callbackfn,that){var O=Object($.assertDefined($this)),self=$.ES5Object(O),f=ctx(callbackfn,that,3),length=$.toLength(self.length),index=0,result=IS_MAP?Array(length):IS_FILTER?[]:undefined,val,res;for(;length>index;index++)if(NO_HOLES||index in self){val=self[index];res=f(val,index,O);if(TYPE){if(IS_MAP)result[index]=res;else if(res)switch(TYPE){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(IS_EVERY)return false}}return IS_FIND_INDEX?-1:IS_SOME||IS_EVERY?IS_EVERY:result}}},{"./$":24,"./$.ctx":12}],5:[function(require,module,exports){var $=require("./$");function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}assert.def=$.assertDefined;assert.fn=function(it){if(!$.isFunction(it))throw TypeError(it+" is not a function!");return it};assert.obj=function(it){if(!$.isObject(it))throw TypeError(it+" is not an object!");return it};assert.inst=function(it,Constructor,name){if(!(it instanceof Constructor))throw TypeError(name+": use the 'new' operator!");return it};module.exports=assert},{"./$":24}],6:[function(require,module,exports){var $=require("./$"),enumKeys=require("./$.enum-keys");module.exports=Object.assign||function assign(target,source){var T=Object($.assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=$.ES5Object(arguments[i++]),keys=enumKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T}},{"./$":24,"./$.enum-keys":15}],7:[function(require,module,exports){var $=require("./$"),TAG=require("./$.wks")("toStringTag"),toString={}.toString;function cof(it){return toString.call(it).slice(8,-1)}cof.classof=function(it){var O,T;return it==undefined?it===undefined?"Undefined":"Null":typeof(T=(O=Object(it))[TAG])=="string"?T:cof(O)};cof.set=function(it,tag,stat){if(it&&!$.has(it=stat?it:it.prototype,TAG))$.hide(it,TAG,tag)};module.exports=cof},{"./$":24,"./$.wks":42}],8:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx"),safe=require("./$.uid").safe,assert=require("./$.assert"),forOf=require("./$.for-of"),step=require("./$.iter").step,$has=$.has,set=$.set,isObject=$.isObject,hide=$.hide,isExtensible=Object.isExtensible||isObject,ID=safe("id"),O1=safe("O1"),LAST=safe("last"),FIRST=safe("first"),ITER=safe("iter"),SIZE=$.DESC?safe("size"):"size",id=0;function fastKey(it,create){if(!isObject(it))return typeof it=="symbol"?it:(typeof it=="string"?"S":"P")+it;if(!$has(it,ID)){if(!isExtensible(it))return"F";if(!create)return"E";hide(it,ID,++id)}return"O"+it[ID]}function getEntry(that,key){var index=fastKey(key),entry;if(index!=="F")return that[O1][index];for(entry=that[FIRST];entry;entry=entry.n){if(entry.k==key)return entry}}module.exports={getConstructor:function(wrapper,NAME,IS_MAP,ADDER){var C=wrapper(function(that,iterable){assert.inst(that,C,NAME);set(that,O1,$.create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that)});require("./$.mix")(C.prototype,{clear:function clear(){for(var that=this,data=that[O1],entry=that[FIRST];entry;entry=entry.n){entry.r=true;if(entry.p)entry.p=entry.p.n=undefined;delete data[entry.i]}that[FIRST]=that[LAST]=undefined;that[SIZE]=0},"delete":function(key){var that=this,entry=getEntry(that,key);if(entry){var next=entry.n,prev=entry.p;delete that[O1][entry.i];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that[FIRST]==entry)that[FIRST]=next;if(that[LAST]==entry)that[LAST]=prev;that[SIZE]--}return!!entry},forEach:function forEach(callbackfn){var f=ctx(callbackfn,arguments[1],3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function has(key){return!!getEntry(this,key)}});if($.DESC)$.setDesc(C.prototype,"size",{get:function(){return assert.def(this[SIZE])}});return C},def:function(that,key,value){var entry=getEntry(that,key),prev,index;if(entry){entry.v=value}else{that[LAST]=entry={i:index=fastKey(key,true),k:key,v:value,p:prev=that[LAST],n:undefined,r:false};if(!that[FIRST])that[FIRST]=entry;if(prev)prev.n=entry;that[SIZE]++;if(index!=="F")that[O1][index]=entry}return that},getEntry:getEntry,setIter:function(C,NAME,IS_MAP){require("./$.iter-define")(C,NAME,function(iterated,kind){set(this,ITER,{o:iterated,k:kind})},function(){var iter=this[ITER],kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!iter.o||!(iter.l=entry=entry?entry.n:iter.o[FIRST])){iter.o=undefined;return step(1)}if(kind=="keys")return step(0,entry.k);if(kind=="values")return step(0,entry.v);return step(0,[entry.k,entry.v])},IS_MAP?"entries":"values",!IS_MAP,true)}}},{"./$":24,"./$.assert":5,"./$.ctx":12,"./$.for-of":16,"./$.iter":23,"./$.iter-define":21,"./$.mix":26,"./$.uid":40}],9:[function(require,module,exports){var $def=require("./$.def"),forOf=require("./$.for-of");module.exports=function(NAME){$def($def.P,NAME,{toJSON:function toJSON(){var arr=[];forOf(this,false,arr.push,arr);return arr}})}},{"./$.def":13,"./$.for-of":16}],10:[function(require,module,exports){"use strict";var $=require("./$"),safe=require("./$.uid").safe,assert=require("./$.assert"),forOf=require("./$.for-of"),$has=$.has,isObject=$.isObject,hide=$.hide,isExtensible=Object.isExtensible||isObject,id=0,ID=safe("id"),WEAK=safe("weak"),LEAK=safe("leak"),method=require("./$.array-methods"),find=method(5),findIndex=method(6);function findFrozen(store,key){return find(store.array,function(it){return it[0]===key})}function leakStore(that){return that[LEAK]||hide(that,LEAK,{array:[],get:function(key){var entry=findFrozen(this,key);if(entry)return entry[1]},has:function(key){return!!findFrozen(this,key)},set:function(key,value){var entry=findFrozen(this,key);if(entry)entry[1]=value;else this.array.push([key,value])},"delete":function(key){var index=findIndex(this.array,function(it){return it[0]===key});if(~index)this.array.splice(index,1);return!!~index}})[LEAK]}module.exports={getConstructor:function(wrapper,NAME,IS_MAP,ADDER){var C=wrapper(function(that,iterable){$.set(assert.inst(that,C,NAME),ID,id++);if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that)});require("./$.mix")(C.prototype,{"delete":function(key){if(!isObject(key))return false;if(!isExtensible(key))return leakStore(this)["delete"](key);return $has(key,WEAK)&&$has(key[WEAK],this[ID])&&delete key[WEAK][this[ID]]},has:function has(key){if(!isObject(key))return false;if(!isExtensible(key))return leakStore(this).has(key);return $has(key,WEAK)&&$has(key[WEAK],this[ID])}});return C},def:function(that,key,value){if(!isExtensible(assert.obj(key))){leakStore(that).set(key,value)}else{$has(key,WEAK)||hide(key,WEAK,{});key[WEAK][that[ID]]=value}return that},leakStore:leakStore,WEAK:WEAK,ID:ID}},{"./$":24,"./$.array-methods":4,"./$.assert":5,"./$.for-of":16,"./$.mix":26,"./$.uid":40}],11:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def"),BUGGY=require("./$.iter").BUGGY,forOf=require("./$.for-of"),species=require("./$.species"),assertInstance=require("./$.assert").inst;module.exports=function(NAME,wrapper,methods,common,IS_MAP,IS_WEAK){var Base=$.g[NAME],C=Base,ADDER=IS_MAP?"set":"add",proto=C&&C.prototype,O={};function fixMethod(KEY){var fn=proto[KEY];require("./$.redef")(proto,KEY,KEY=="delete"?function(a){return fn.call(this,a===0?0:a)}:KEY=="has"?function has(a){return fn.call(this,a===0?0:a)}:KEY=="get"?function get(a){return fn.call(this,a===0?0:a)}:KEY=="add"?function add(a){fn.call(this,a===0?0:a);return this}:function set(a,b){fn.call(this,a===0?0:a,b);return this})}if(!$.isFunction(C)||!(IS_WEAK||!BUGGY&&proto.forEach&&proto.entries)){C=common.getConstructor(wrapper,NAME,IS_MAP,ADDER);require("./$.mix")(C.prototype,methods)}else{var inst=new C,chain=inst[ADDER](IS_WEAK?{}:-0,1),buggyZero;if(!require("./$.iter-detect")(function(iter){new C(iter)})){C=wrapper(function(target,iterable){assertInstance(target,C,NAME);var that=new Base;if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that);return that});C.prototype=proto;proto.constructor=C}IS_WEAK||inst.forEach(function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixMethod("delete");fixMethod("has");IS_MAP&&fixMethod("get")}if(buggyZero||chain!==inst)fixMethod(ADDER)}require("./$.cof").set(C,NAME);O[NAME]=C;$def($def.G+$def.W+$def.F*(C!=Base),O);species(C);species($.core[NAME]);if(!IS_WEAK)common.setIter(C,NAME,IS_MAP);return C}},{"./$":24,"./$.assert":5,"./$.cof":7,"./$.def":13,"./$.for-of":16,"./$.iter":23,"./$.iter-detect":22,"./$.mix":26,"./$.redef":29,"./$.species":34}],12:[function(require,module,exports){var assertFunction=require("./$.assert").fn;module.exports=function(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},{"./$.assert":5}],13:[function(require,module,exports){var $=require("./$"),global=$.g,core=$.core,isFunction=$.isFunction,$redef=require("./$.redef");function ctx(fn,that){return function(){return fn.apply(that,arguments)}}global.core=core;$def.F=1;$def.G=2;$def.S=4;$def.P=8;$def.B=16;$def.W=32;function $def(type,name,source){var key,own,out,exp,isGlobal=type&$def.G,isProto=type&$def.P,target=isGlobal?global:type&$def.S?global[name]:(global[name]||{}).prototype,exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&$def.F)&&target&&key in target;out=(own?target:source)[key];if(type&$def.B&&own)exp=ctx(out,global);else exp=isProto&&isFunction(out)?ctx(Function.call,out):out;if(target&&!own)$redef(target,key,out);if(exports[key]!=out)$.hide(exports,key,exp);if(isProto)(exports.prototype||(exports.prototype={}))[key]=out}}module.exports=$def},{"./$":24,"./$.redef":29}],14:[function(require,module,exports){var $=require("./$"),document=$.g.document,isObject=$.isObject,is=isObject(document)&&isObject(document.createElement);module.exports=function(it){return is?document.createElement(it):{}}},{"./$":24}],15:[function(require,module,exports){var $=require("./$");module.exports=function(it){var keys=$.getKeys(it),getDesc=$.getDesc,getSymbols=$.getSymbols;if(getSymbols)$.each.call(getSymbols(it),function(key){if(getDesc(it,key).enumerable)keys.push(key)});return keys}},{"./$":24}],16:[function(require,module,exports){var ctx=require("./$.ctx"),get=require("./$.iter").get,call=require("./$.iter-call");module.exports=function(iterable,entries,fn,that){var iterator=get(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done){if(call(iterator,f,step.value,entries)===false){return call.close(iterator)}}}},{"./$.ctx":12,"./$.iter":23,"./$.iter-call":20}],17:[function(require,module,exports){module.exports=function($){$.FW=true;$.path=$.g;return $}},{}],18:[function(require,module,exports){var $=require("./$"),toString={}.toString,getNames=$.getNames;var windowNames=typeof window=="object"&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];function getWindowNames(it){try{return getNames(it)}catch(e){return windowNames.slice()}}module.exports.get=function getOwnPropertyNames(it){if(windowNames&&toString.call(it)=="[object Window]")return getWindowNames(it);return getNames($.toObject(it))}},{"./$":24}],19:[function(require,module,exports){module.exports=function(fn,args,that){var un=that===undefined;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);case 5:return un?fn(args[0],args[1],args[2],args[3],args[4]):fn.call(that,args[0],args[1],args[2],args[3],args[4])}return fn.apply(that,args)}},{}],20:[function(require,module,exports){var assertObject=require("./$.assert").obj;function close(iterator){var ret=iterator["return"];if(ret!==undefined)assertObject(ret.call(iterator))}function call(iterator,fn,value,entries){try{return entries?fn(assertObject(value)[0],value[1]):fn(value)}catch(e){close(iterator);throw e}}call.close=close;module.exports=call},{"./$.assert":5}],21:[function(require,module,exports){var $def=require("./$.def"),$redef=require("./$.redef"),$=require("./$"),cof=require("./$.cof"),$iter=require("./$.iter"),SYMBOL_ITERATOR=require("./$.wks")("iterator"),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",Iterators=$iter.Iterators;module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCE){$iter.create(Constructor,NAME,next);function createMethod(kind){function $$(that){return new Constructor(that,kind)}switch(kind){case KEYS:return function keys(){return $$(this)};case VALUES:return function values(){return $$(this)}}return function entries(){return $$(this)}}var TAG=NAME+" Iterator",proto=Base.prototype,_native=proto[SYMBOL_ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],_default=_native||createMethod(DEFAULT),methods,key;if(_native){var IteratorPrototype=$.getProto(_default.call(new Base));cof.set(IteratorPrototype,TAG,true);if($.FW&&$.has(proto,FF_ITERATOR))$iter.set(IteratorPrototype,$.that)}if($.FW||FORCE)$iter.set(proto,_default);Iterators[NAME]=_default;Iterators[TAG]=$.that;if(DEFAULT){methods={keys:IS_SET?_default:createMethod(KEYS),values:DEFAULT==VALUES?_default:createMethod(VALUES),entries:DEFAULT!=VALUES?_default:createMethod("entries")};if(FORCE)for(key in methods){if(!(key in proto))$redef(proto,key,methods[key])}else $def($def.P+$def.F*$iter.BUGGY,NAME,methods)}}},{"./$":24,"./$.cof":7,"./$.def":13,"./$.iter":23,"./$.redef":29,"./$.wks":42}],22:[function(require,module,exports){var SYMBOL_ITERATOR=require("./$.wks")("iterator"),SAFE_CLOSING=false;try{var riter=[7][SYMBOL_ITERATOR]();riter["return"]=function(){SAFE_CLOSING=true};Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec){if(!SAFE_CLOSING)return false;var safe=false;try{var arr=[7],iter=arr[SYMBOL_ITERATOR]();iter.next=function(){safe=true};arr[SYMBOL_ITERATOR]=function(){return iter};exec(arr)}catch(e){}return safe}},{"./$.wks":42}],23:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),classof=cof.classof,assert=require("./$.assert"),assertObject=assert.obj,SYMBOL_ITERATOR=require("./$.wks")("iterator"),FF_ITERATOR="@@iterator",Iterators=require("./$.shared")("iterators"),IteratorPrototype={};setIterator(IteratorPrototype,$.that);function setIterator(O,value){$.hide(O,SYMBOL_ITERATOR,value);if(FF_ITERATOR in[])$.hide(O,FF_ITERATOR,value)}module.exports={BUGGY:"keys"in[]&&!("next"in[].keys()),Iterators:Iterators,step:function(done,value){return{value:value,done:!!done}},is:function(it){var O=Object(it),Symbol=$.g.Symbol;return(Symbol&&Symbol.iterator||FF_ITERATOR)in O||SYMBOL_ITERATOR in O||$.has(Iterators,classof(O))},get:function(it){var Symbol=$.g.Symbol,getIter;if(it!=undefined){getIter=it[Symbol&&Symbol.iterator||FF_ITERATOR]||it[SYMBOL_ITERATOR]||Iterators[classof(it)]}assert($.isFunction(getIter),it," is not iterable!");return assertObject(getIter.call(it))},set:setIterator,create:function(Constructor,NAME,next,proto){Constructor.prototype=$.create(proto||IteratorPrototype,{next:$.desc(1,next)});cof.set(Constructor,NAME+" Iterator")}}},{"./$":24,"./$.assert":5,"./$.cof":7,"./$.shared":33,"./$.wks":42}],24:[function(require,module,exports){"use strict";var global=typeof self!="undefined"?self:Function("return this")(),core={},defineProperty=Object.defineProperty,hasOwnProperty={}.hasOwnProperty,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min;var DESC=!!function(){try{return defineProperty({},"a",{get:function(){return 2}}).a==2}catch(e){}}();var hide=createDefiner(1);function toInteger(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}function desc(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}function simpleSet(object,key,value){object[key]=value;return object}function createDefiner(bitmap){return DESC?function(object,key,value){return $.setDesc(object,key,desc(bitmap,value))}:simpleSet}function isObject(it){return it!==null&&(typeof it=="object"||typeof it=="function")}function isFunction(it){return typeof it=="function"}function assertDefined(it){if(it==undefined)throw TypeError("Can't call method on "+it);return it}var $=module.exports=require("./$.fw")({g:global,core:core,html:global.document&&document.documentElement,isObject:isObject,isFunction:isFunction,that:function(){return this},toInteger:toInteger,toLength:function(it){return it>0?min(toInteger(it),9007199254740991):0},toIndex:function(index,length){index=toInteger(index);return index<0?max(index+length,0):min(index,length)},has:function(it,key){return hasOwnProperty.call(it,key)},create:Object.create,getProto:Object.getPrototypeOf,DESC:DESC,desc:desc,getDesc:Object.getOwnPropertyDescriptor,setDesc:defineProperty,setDescs:Object.defineProperties,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:assertDefined,ES5Object:Object,toObject:function(it){return $.ES5Object(assertDefined(it))},hide:hide,def:createDefiner(0),set:global.Symbol?simpleSet:hide,each:[].forEach});if(typeof __e!="undefined")__e=core;if(typeof __g!="undefined")__g=global},{"./$.fw":17}],25:[function(require,module,exports){var $=require("./$");module.exports=function(object,el){var O=$.toObject(object),keys=$.getKeys(O),length=keys.length,index=0,key;while(length>index)if(O[key=keys[index++]]===el)return key}},{"./$":24}],26:[function(require,module,exports){var $redef=require("./$.redef");module.exports=function(target,src){for(var key in src)$redef(target,key,src[key]);return target}},{"./$.redef":29}],27:[function(require,module,exports){var $=require("./$"),assertObject=require("./$.assert").obj;module.exports=function ownKeys(it){assertObject(it);var keys=$.getNames(it),getSymbols=$.getSymbols;return getSymbols?keys.concat(getSymbols(it)):keys}},{"./$":24,"./$.assert":5}],28:[function(require,module,exports){"use strict";var $=require("./$"),invoke=require("./$.invoke"),assertFunction=require("./$.assert").fn;module.exports=function(){var fn=assertFunction(this),length=arguments.length,pargs=Array(length),i=0,_=$.path._,holder=false;while(length>i)if((pargs[i]=arguments[i++])===_)holder=true;return function(){var that=this,_length=arguments.length,j=0,k=0,args;if(!holder&&!_length)return invoke(fn,pargs,that);args=pargs.slice();if(holder)for(;length>j;j++)if(args[j]===_)args[j]=arguments[k++];while(_length>k)args.push(arguments[k++]);return invoke(fn,args,that)}}},{"./$":24,"./$.assert":5,"./$.invoke":19}],29:[function(require,module,exports){var $=require("./$"),tpl=String({}.hasOwnProperty),SRC=require("./$.uid").safe("src"),_toString=Function.toString;function $redef(O,key,val,safe){if($.isFunction(val)){var base=O[key];$.hide(val,SRC,base?String(base):tpl.replace(/hasOwnProperty/,String(key)));if(!("name"in val))val.name=key}if(O===$.g){O[key]=val}else{if(!safe)delete O[key];$.hide(O,key,val)}}$redef(Function.prototype,"toString",function toString(){return $.has(this,SRC)?this[SRC]:_toString.call(this)});$.core.inspectSource=function(it){return _toString.call(it)};module.exports=$redef},{"./$":24,"./$.uid":40}],30:[function(require,module,exports){"use strict";module.exports=function(regExp,replace,isStatic){var replacer=replace===Object(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}},{}],31:[function(require,module,exports){module.exports=Object.is||function is(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}},{}],32:[function(require,module,exports){var $=require("./$"),assert=require("./$.assert");function check(O,proto){assert.obj(O);assert(proto===null||$.isObject(proto),proto,": can't set as prototype!")}module.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(buggy,set){try{set=require("./$.ctx")(Function.call,$.getDesc(Object.prototype,"__proto__").set,2);set({},[])}catch(e){buggy=true}return function setPrototypeOf(O,proto){check(O,proto);if(buggy)O.__proto__=proto;else set(O,proto);return O}}():undefined),check:check}},{"./$":24,"./$.assert":5,"./$.ctx":12}],33:[function(require,module,exports){var $=require("./$"),SHARED="__core-js_shared__",store=$.g[SHARED]||($.g[SHARED]={});module.exports=function(key){return store[key]||(store[key]={})}},{"./$":24}],34:[function(require,module,exports){var $=require("./$"),SPECIES=require("./$.wks")("species");module.exports=function(C){if($.DESC&&!(SPECIES in C))$.setDesc(C,SPECIES,{configurable:true,get:$.that})}},{"./$":24,"./$.wks":42}],35:[function(require,module,exports){var $=require("./$");module.exports=function(TO_STRING){return function(that,pos){var s=String($.assertDefined(that)),i=$.toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return TO_STRING?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}},{"./$":24}],36:[function(require,module,exports){var $=require("./$"),repeat=require("./$.string-repeat");module.exports=function(that,minLength,fillChar,left){var S=String($.assertDefined(that));if(minLength===undefined)return S;var intMinLength=$.toInteger(minLength);var fillLen=intMinLength-S.length;if(fillLen<0||fillLen===Infinity){throw new RangeError("Cannot satisfy string length "+minLength+" for string: "+S)}var sFillStr=fillChar===undefined?" ":String(fillChar);var sFillVal=repeat.call(sFillStr,Math.ceil(fillLen/sFillStr.length));if(sFillVal.length>fillLen)sFillVal=left?sFillVal.slice(sFillVal.length-fillLen):sFillVal.slice(0,fillLen);return left?sFillVal.concat(S):S.concat(sFillVal)}},{"./$":24,"./$.string-repeat":37}],37:[function(require,module,exports){"use strict";var $=require("./$");module.exports=function repeat(count){var str=String($.assertDefined(this)),res="",n=$.toInteger(count);if(n<0||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res}},{"./$":24}],38:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx"),cof=require("./$.cof"),invoke=require("./$.invoke"),cel=require("./$.dom-create"),global=$.g,isFunction=$.isFunction,html=$.html,process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",defer,channel,port;function run(){var id=+this;if($.has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run.call(event.data)}if(!isFunction(setTask)||!isFunction(clearTask)){setTask=function(fn){var args=[],i=1;while(arguments.length>i)args.push(arguments[i++]);queue[++counter]=function(){invoke(isFunction(fn)?fn:Function(fn),args)};defer(counter);return counter};clearTask=function(id){delete queue[id]};if(cof(process)=="process"){defer=function(id){process.nextTick(ctx(run,id,1))}}else if(global.addEventListener&&isFunction(global.postMessage)&&!global.importScripts){defer=function(id){global.postMessage(id,"*")};global.addEventListener("message",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(ONREADYSTATECHANGE in cel("script")){defer=function(id){html.appendChild(cel("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run.call(id)}}}else{defer=function(id){setTimeout(ctx(run,id,1),0)}}}module.exports={set:setTask,clear:clearTask}},{"./$":24,"./$.cof":7,"./$.ctx":12,"./$.dom-create":14,"./$.invoke":19}],39:[function(require,module,exports){module.exports=function(exec){try{exec();return false}catch(e){return true}}},{}],40:[function(require,module,exports){var sid=0;function uid(key){return"Symbol(".concat(key===undefined?"":key,")_",(++sid+Math.random()).toString(36))}uid.safe=require("./$").g.Symbol||uid;module.exports=uid},{"./$":24}],41:[function(require,module,exports){var UNSCOPABLES=require("./$.wks")("unscopables");if(!(UNSCOPABLES in[]))require("./$").hide(Array.prototype,UNSCOPABLES,{});module.exports=function(key){[][UNSCOPABLES][key]=true}},{"./$":24,"./$.wks":42}],42:[function(require,module,exports){var global=require("./$").g,store=require("./$.shared")("wks");module.exports=function(name){return store[name]||(store[name]=global.Symbol&&global.Symbol[name]||require("./$.uid").safe("Symbol."+name))}},{"./$":24,"./$.shared":33,"./$.uid":40}],43:[function(require,module,exports){var $=require("./$"),cel=require("./$.dom-create"),cof=require("./$.cof"),$def=require("./$.def"),invoke=require("./$.invoke"),arrayMethod=require("./$.array-methods"),IE_PROTO=require("./$.uid").safe("__proto__"),assert=require("./$.assert"),assertObject=assert.obj,ObjectProto=Object.prototype,html=$.html,A=[],_slice=A.slice,_join=A.join,classof=cof.classof,has=$.has,defineProperty=$.setDesc,getOwnDescriptor=$.getDesc,defineProperties=$.setDescs,isFunction=$.isFunction,isObject=$.isObject,toObject=$.toObject,toLength=$.toLength,toIndex=$.toIndex,IE8_DOM_DEFINE=false,$indexOf=require("./$.array-includes")(false),$forEach=arrayMethod(0),$map=arrayMethod(1),$filter=arrayMethod(2),$some=arrayMethod(3),$every=arrayMethod(4);if(!$.DESC){try{IE8_DOM_DEFINE=defineProperty(cel("div"),"x",{get:function(){return 8}}).x==8}catch(e){}$.setDesc=function(O,P,Attributes){if(IE8_DOM_DEFINE)try{return defineProperty(O,P,Attributes)}catch(e){}if("get"in Attributes||"set"in Attributes)throw TypeError("Accessors not supported!");if("value"in Attributes)assertObject(O)[P]=Attributes.value;return O};$.getDesc=function(O,P){if(IE8_DOM_DEFINE)try{return getOwnDescriptor(O,P)}catch(e){}if(has(O,P))return $.desc(!ObjectProto.propertyIsEnumerable.call(O,P),O[P])};$.setDescs=defineProperties=function(O,Properties){assertObject(O);var keys=$.getKeys(Properties),length=keys.length,i=0,P;while(length>i)$.setDesc(O,P=keys[i++],Properties[P]);return O}}$def($def.S+$def.F*!$.DESC,"Object",{getOwnPropertyDescriptor:$.getDesc,defineProperty:$.setDesc,defineProperties:defineProperties});var keys1=("constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,"+"toLocaleString,toString,valueOf").split(","),keys2=keys1.concat("length","prototype"),keysLen1=keys1.length;var createDict=function(){var iframe=cel("iframe"),i=keysLen1,gt=">",iframeDocument;iframe.style.display="none";html.appendChild(iframe);iframe.src="javascript:";iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write("<script>document.F=Object</script"+gt);iframeDocument.close();createDict=iframeDocument.F;while(i--)delete createDict.prototype[keys1[i]];return createDict()};function createGetKeys(names,length){return function(object){var O=toObject(object),i=0,result=[],key;for(key in O)if(key!=IE_PROTO)has(O,key)&&result.push(key);while(length>i)if(has(O,key=names[i++])){~$indexOf(result,key)||result.push(key)}return result}}function Empty(){}$def($def.S,"Object",{getPrototypeOf:$.getProto=$.getProto||function(O){O=Object(assert.def(O));if(has(O,IE_PROTO))return O[IE_PROTO];if(isFunction(O.constructor)&&O instanceof O.constructor){return O.constructor.prototype}return O instanceof Object?ObjectProto:null},getOwnPropertyNames:$.getNames=$.getNames||createGetKeys(keys2,keys2.length,true),create:$.create=$.create||function(O,Properties){var result;if(O!==null){Empty.prototype=assertObject(O);result=new Empty;Empty.prototype=null;result[IE_PROTO]=O}else result=createDict();return Properties===undefined?result:defineProperties(result,Properties)},keys:$.getKeys=$.getKeys||createGetKeys(keys1,keysLen1,false),seal:function seal(it){return it},freeze:function freeze(it){return it},preventExtensions:function preventExtensions(it){return it},isSealed:function isSealed(it){return!isObject(it)},isFrozen:function isFrozen(it){return!isObject(it)},isExtensible:function isExtensible(it){return isObject(it)}});$def($def.P,"Function",{bind:function(that){var fn=assert.fn(this),partArgs=_slice.call(arguments,1);function bound(){var args=partArgs.concat(_slice.call(arguments)),constr=this instanceof bound,ctx=constr?$.create(fn.prototype):that,result=invoke(fn,args,ctx);return constr?ctx:result}if(fn.prototype)bound.prototype=fn.prototype;return bound}});if(!(0 in Object("z")&&"z"[0]=="z")){$.ES5Object=function(it){return cof(it)=="String"?it.split(""):Object(it)}}var buggySlice=true;try{if(html)_slice.call(html);buggySlice=false}catch(e){}$def($def.P+$def.F*buggySlice,"Array",{slice:function slice(begin,end){var len=toLength(this.length),klass=cof(this);end=end===undefined?len:end;if(klass=="Array")return _slice.call(this,begin,end);var start=toIndex(begin,len),upTo=toIndex(end,len),size=toLength(upTo-start),cloned=Array(size),i=0;for(;i<size;i++)cloned[i]=klass=="String"?this.charAt(start+i):this[start+i];return cloned}});$def($def.P+$def.F*($.ES5Object!=Object),"Array",{join:function join(){return _join.apply($.ES5Object(this),arguments)}});$def($def.S,"Array",{isArray:function(arg){return cof(arg)=="Array"}});function createArrayReduce(isRight){return function(callbackfn,memo){assert.fn(callbackfn);var O=toObject(this),length=toLength(O.length),index=isRight?length-1:0,i=isRight?-1:1;
if(arguments.length<2)for(;;){if(index in O){memo=O[index];index+=i;break}index+=i;assert(isRight?index>=0:length>index,"Reduce of empty array with no initial value")}for(;isRight?index>=0:length>index;index+=i)if(index in O){memo=callbackfn(memo,O[index],index,this)}return memo}}$def($def.P,"Array",{forEach:$.each=$.each||function forEach(callbackfn){return $forEach(this,callbackfn,arguments[1])},map:function map(callbackfn){return $map(this,callbackfn,arguments[1])},filter:function filter(callbackfn){return $filter(this,callbackfn,arguments[1])},some:function some(callbackfn){return $some(this,callbackfn,arguments[1])},every:function every(callbackfn){return $every(this,callbackfn,arguments[1])},reduce:createArrayReduce(false),reduceRight:createArrayReduce(true),indexOf:function indexOf(el){return $indexOf(this,el,arguments[1])},lastIndexOf:function(el,fromIndex){var O=toObject(this),length=toLength(O.length),index=length-1;if(arguments.length>1)index=Math.min(index,$.toInteger(fromIndex));if(index<0)index=toLength(length+index);for(;index>=0;index--)if(index in O)if(O[index]===el)return index;return-1}});$def($def.P,"String",{trim:require("./$.replacer")(/^\s*([\s\S]*\S)?\s*$/,"$1")});$def($def.S,"Date",{now:function(){return+new Date}});function lz(num){return num>9?num:"0"+num}var date=new Date(-5e13-1),brokenDate=!(date.toISOString&&date.toISOString()=="0385-07-25T07:06:39.999Z"&&require("./$.throws")(function(){new Date(NaN).toISOString()}));$def($def.P+$def.F*brokenDate,"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var d=this,y=d.getUTCFullYear(),m=d.getUTCMilliseconds(),s=y<0?"-":y>9999?"+":"";return s+("00000"+Math.abs(y)).slice(s?-6:-4)+"-"+lz(d.getUTCMonth()+1)+"-"+lz(d.getUTCDate())+"T"+lz(d.getUTCHours())+":"+lz(d.getUTCMinutes())+":"+lz(d.getUTCSeconds())+"."+(m>99?m:"0"+lz(m))+"Z"}});if(classof(function(){return arguments}())=="Object")cof.classof=function(it){var tag=classof(it);return tag=="Object"&&isFunction(it.callee)?"Arguments":tag}},{"./$":24,"./$.array-includes":3,"./$.array-methods":4,"./$.assert":5,"./$.cof":7,"./$.def":13,"./$.dom-create":14,"./$.invoke":19,"./$.replacer":30,"./$.throws":39,"./$.uid":40}],44:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def"),toIndex=$.toIndex;$def($def.P,"Array",{copyWithin:function copyWithin(target,start){var O=Object($.assertDefined(this)),len=$.toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),end=arguments[2],fin=end===undefined?len:toIndex(end,len),count=Math.min(fin-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from=from+count-1;to=to+count-1}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc}return O}});require("./$.unscope")("copyWithin")},{"./$":24,"./$.def":13,"./$.unscope":41}],45:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def"),toIndex=$.toIndex;$def($def.P,"Array",{fill:function fill(value){var O=Object($.assertDefined(this)),length=$.toLength(O.length),index=toIndex(arguments[1],length),end=arguments[2],endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O}});require("./$.unscope")("fill")},{"./$":24,"./$.def":13,"./$.unscope":41}],46:[function(require,module,exports){"use strict";var KEY="findIndex",$def=require("./$.def"),forced=true,$find=require("./$.array-methods")(6);if(KEY in[])Array(1)[KEY](function(){forced=false});$def($def.P+$def.F*forced,"Array",{findIndex:function findIndex(callbackfn){return $find(this,callbackfn,arguments[1])}});require("./$.unscope")(KEY)},{"./$.array-methods":4,"./$.def":13,"./$.unscope":41}],47:[function(require,module,exports){"use strict";var KEY="find",$def=require("./$.def"),forced=true,$find=require("./$.array-methods")(5);if(KEY in[])Array(1)[KEY](function(){forced=false});$def($def.P+$def.F*forced,"Array",{find:function find(callbackfn){return $find(this,callbackfn,arguments[1])}});require("./$.unscope")(KEY)},{"./$.array-methods":4,"./$.def":13,"./$.unscope":41}],48:[function(require,module,exports){var $=require("./$"),ctx=require("./$.ctx"),$def=require("./$.def"),$iter=require("./$.iter"),call=require("./$.iter-call");$def($def.S+$def.F*!require("./$.iter-detect")(function(iter){Array.from(iter)}),"Array",{from:function from(arrayLike){var O=Object($.assertDefined(arrayLike)),mapfn=arguments[1],mapping=mapfn!==undefined,f=mapping?ctx(mapfn,arguments[2],2):undefined,index=0,length,result,step,iterator;if($iter.is(O)){iterator=$iter.get(O);result=new(typeof this=="function"?this:Array);for(;!(step=iterator.next()).done;index++){result[index]=mapping?call(iterator,f,[step.value,index],true):step.value}}else{result=new(typeof this=="function"?this:Array)(length=$.toLength(O.length));for(;length>index;index++){result[index]=mapping?f(O[index],index):O[index]}}result.length=index;return result}})},{"./$":24,"./$.ctx":12,"./$.def":13,"./$.iter":23,"./$.iter-call":20,"./$.iter-detect":22}],49:[function(require,module,exports){var $=require("./$"),setUnscope=require("./$.unscope"),ITER=require("./$.uid").safe("iter"),$iter=require("./$.iter"),step=$iter.step,Iterators=$iter.Iterators;require("./$.iter-define")(Array,"Array",function(iterated,kind){$.set(this,ITER,{o:$.toObject(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length){iter.o=undefined;return step(1)}if(kind=="keys")return step(0,index);if(kind=="values")return step(0,O[index]);return step(0,[index,O[index]])},"values");Iterators.Arguments=Iterators.Array;setUnscope("keys");setUnscope("values");setUnscope("entries")},{"./$":24,"./$.iter":23,"./$.iter-define":21,"./$.uid":40,"./$.unscope":41}],50:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Array",{of:function of(){var index=0,length=arguments.length,result=new(typeof this=="function"?this:Array)(length);while(length>index)result[index]=arguments[index++];result.length=length;return result}})},{"./$.def":13}],51:[function(require,module,exports){require("./$.species")(Array)},{"./$.species":34}],52:[function(require,module,exports){var $=require("./$"),HAS_INSTANCE=require("./$.wks")("hasInstance"),FunctionProto=Function.prototype;if(!(HAS_INSTANCE in FunctionProto))$.setDesc(FunctionProto,HAS_INSTANCE,{value:function(O){if(!$.isFunction(this)||!$.isObject(O))return false;if(!$.isObject(this.prototype))return O instanceof this;while(O=$.getProto(O))if(this.prototype===O)return true;return false}})},{"./$":24,"./$.wks":42}],53:[function(require,module,exports){"use strict";var $=require("./$"),NAME="name",setDesc=$.setDesc,FunctionProto=Function.prototype;NAME in FunctionProto||$.FW&&$.DESC&&setDesc(FunctionProto,NAME,{configurable:true,get:function(){var match=String(this).match(/^\s*function ([^ (]*)/),name=match?match[1]:"";$.has(this,NAME)||setDesc(this,NAME,$.desc(5,name));return name},set:function(value){$.has(this,NAME)||setDesc(this,NAME,$.desc(0,value))}})},{"./$":24}],54:[function(require,module,exports){"use strict";var strong=require("./$.collection-strong");require("./$.collection")("Map",function(get){return function Map(){return get(this,arguments[0])}},{get:function get(key){var entry=strong.getEntry(this,key);return entry&&entry.v},set:function set(key,value){return strong.def(this,key===0?0:key,value)}},strong,true)},{"./$.collection":11,"./$.collection-strong":8}],55:[function(require,module,exports){var Infinity=1/0,$def=require("./$.def"),E=Math.E,pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,ceil=Math.ceil,floor=Math.floor,EPSILON=pow(2,-52),EPSILON32=pow(2,-23),MAX32=pow(2,127)*(2-EPSILON32),MIN32=pow(2,-126);function roundTiesToEven(n){return n+1/EPSILON-1/EPSILON}function sign(x){return(x=+x)==0||x!=x?x:x<0?-1:1}function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}function expm1(x){return(x=+x)==0?x:x>-1e-6&&x<1e-6?x+x*x/2:exp(x)-1}$def($def.S,"Math",{acosh:function acosh(x){return(x=+x)<1?NaN:isFinite(x)?log(x/E+sqrt(x+1)*sqrt(x-1)/E)+1:x},asinh:asinh,atanh:function atanh(x){return(x=+x)==0?x:log((1+x)/(1-x))/2},cbrt:function cbrt(x){return sign(x=+x)*pow(abs(x),1/3)},clz32:function clz32(x){return(x>>>=0)?31-floor(log(x+.5)*Math.LOG2E):32},cosh:function cosh(x){return(exp(x=+x)+exp(-x))/2},expm1:expm1,fround:function fround(x){var $abs=abs(x),$sign=sign(x),a,result;if($abs<MIN32)return $sign*roundTiesToEven($abs/MIN32/EPSILON32)*MIN32*EPSILON32;a=(1+EPSILON32/EPSILON)*$abs;result=a-(a-$abs);if(result>MAX32||result!=result)return $sign*Infinity;return $sign*result},hypot:function hypot(value1,value2){var sum=0,i=0,len=arguments.length,larg=0,arg,div;while(i<len){arg=abs(arguments[i++]);if(larg<arg){div=larg/arg;sum=sum*div*div+1;larg=arg}else if(arg>0){div=arg/larg;sum+=div*div}else sum+=arg}return larg===Infinity?Infinity:larg*sqrt(sum)},imul:function imul(x,y){var UInt16=65535,xn=+x,yn=+y,xl=UInt16&xn,yl=UInt16&yn;return 0|xl*yl+((UInt16&xn>>>16)*yl+xl*(UInt16&yn>>>16)<<16>>>0)},log1p:function log1p(x){return(x=+x)>-1e-8&&x<1e-8?x-x*x/2:log(1+x)},log10:function log10(x){return log(x)/Math.LN10},log2:function log2(x){return log(x)/Math.LN2},sign:sign,sinh:function sinh(x){return abs(x=+x)<1?(expm1(x)-expm1(-x))/2:(exp(x-1)-exp(-x-1))*(E/2)},tanh:function tanh(x){var a=expm1(x=+x),b=expm1(-x);return a==Infinity?1:b==Infinity?-1:(a-b)/(exp(x)+exp(-x))},trunc:function trunc(it){return(it>0?floor:ceil)(it)}})},{"./$.def":13}],56:[function(require,module,exports){"use strict";var $=require("./$"),isObject=$.isObject,isFunction=$.isFunction,NUMBER="Number",$Number=$.g[NUMBER],Base=$Number,proto=$Number.prototype;function toPrimitive(it){var fn,val;if(isFunction(fn=it.valueOf)&&!isObject(val=fn.call(it)))return val;if(isFunction(fn=it.toString)&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to number")}function toNumber(it){if(isObject(it))it=toPrimitive(it);if(typeof it=="string"&&it.length>2&&it.charCodeAt(0)==48){var binary=false;switch(it.charCodeAt(1)){case 66:case 98:binary=true;case 79:case 111:return parseInt(it.slice(2),binary?2:8)}}return+it}if($.FW&&!($Number("0o1")&&$Number("0b1"))){$Number=function Number(it){return this instanceof $Number?new Base(toNumber(it)):toNumber(it)};$.each.call($.DESC?$.getNames(Base):("MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,"+"EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,"+"MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger").split(","),function(key){if($.has(Base,key)&&!$.has($Number,key)){$.setDesc($Number,key,$.getDesc(Base,key))}});$Number.prototype=proto;proto.constructor=$Number;require("./$.redef")($.g,NUMBER,$Number)}},{"./$":24,"./$.redef":29}],57:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),abs=Math.abs,floor=Math.floor,_isFinite=$.g.isFinite,MAX_SAFE_INTEGER=9007199254740991;function isInteger(it){return!$.isObject(it)&&_isFinite(it)&&floor(it)===it}$def($def.S,"Number",{EPSILON:Math.pow(2,-52),isFinite:function isFinite(it){return typeof it=="number"&&_isFinite(it)},isInteger:isInteger,isNaN:function isNaN(number){return number!=number},isSafeInteger:function isSafeInteger(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt})},{"./$":24,"./$.def":13}],58:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Object",{assign:require("./$.assign")})},{"./$.assign":6,"./$.def":13}],59:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Object",{is:require("./$.same")})},{"./$.def":13,"./$.same":31}],60:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Object",{setPrototypeOf:require("./$.set-proto").set})},{"./$.def":13,"./$.set-proto":32}],61:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),isObject=$.isObject,toObject=$.toObject;$.each.call(("freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,"+"getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames").split(","),function(KEY,ID){var fn=($.core.Object||{})[KEY]||Object[KEY],forced=0,method={};method[KEY]=ID==0?function freeze(it){return isObject(it)?fn(it):it}:ID==1?function seal(it){return isObject(it)?fn(it):it}:ID==2?function preventExtensions(it){return isObject(it)?fn(it):it}:ID==3?function isFrozen(it){return isObject(it)?fn(it):true}:ID==4?function isSealed(it){return isObject(it)?fn(it):true}:ID==5?function isExtensible(it){return isObject(it)?fn(it):false}:ID==6?function getOwnPropertyDescriptor(it,key){return fn(toObject(it),key)}:ID==7?function getPrototypeOf(it){return fn(Object($.assertDefined(it)))}:ID==8?function keys(it){return fn(toObject(it))}:require("./$.get-names").get;try{fn("z")}catch(e){forced=1}$def($def.S+$def.F*forced,"Object",method)})},{"./$":24,"./$.def":13,"./$.get-names":18}],62:[function(require,module,exports){"use strict";var cof=require("./$.cof"),tmp={};tmp[require("./$.wks")("toStringTag")]="z";if(require("./$").FW&&cof(tmp)!="z"){require("./$.redef")(Object.prototype,"toString",function toString(){return"[object "+cof.classof(this)+"]"},true)}},{"./$":24,"./$.cof":7,"./$.redef":29,"./$.wks":42}],63:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx"),cof=require("./$.cof"),$def=require("./$.def"),assert=require("./$.assert"),forOf=require("./$.for-of"),setProto=require("./$.set-proto").set,same=require("./$.same"),species=require("./$.species"),SPECIES=require("./$.wks")("species"),RECORD=require("./$.uid").safe("record"),PROMISE="Promise",global=$.g,process=global.process,isNode=cof(process)=="process",asap=process&&process.nextTick||require("./$.task").set,P=global[PROMISE],isFunction=$.isFunction,isObject=$.isObject,assertFunction=assert.fn,assertObject=assert.obj,Wrapper;function testResolve(sub){var test=new P(function(){});if(sub)test.constructor=Object;return P.resolve(test)===test}var useNative=function(){var works=false;function P2(x){var self=new P(x);setProto(self,P2.prototype);return self}try{works=isFunction(P)&&isFunction(P.resolve)&&testResolve();setProto(P2,P);P2.prototype=$.create(P.prototype,{constructor:{value:P2}});if(!(P2.resolve(5).then(function(){})instanceof P2)){works=false}if(works&&$.DESC){var thenableThenGotten=false;P.resolve($.setDesc({},"then",{get:function(){thenableThenGotten=true}}));works=thenableThenGotten}}catch(e){works=false}return works}();function isPromise(it){return isObject(it)&&(useNative?cof.classof(it)=="Promise":RECORD in it)}function sameConstructor(a,b){if(!$.FW&&a===P&&b===Wrapper)return true;return same(a,b)}function getConstructor(C){var S=assertObject(C)[SPECIES];return S!=undefined?S:C}function isThenable(it){var then;if(isObject(it))then=it.then;return isFunction(then)?then:false}function notify(record){var chain=record.c;if(chain.length)asap.call(global,function(){var value=record.v,ok=record.s==1,i=0;function run(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){if(!ok)record.h=true;ret=cb===true?value:cb(value);if(ret===react.P){react.rej(TypeError("Promise-chain cycle"))}else if(then=isThenable(ret)){then.call(ret,react.res,react.rej)}else react.res(ret)}else react.rej(value)}catch(err){react.rej(err)}}while(chain.length>i)run(chain[i++]);chain.length=0})}function isUnhandled(promise){var record=promise[RECORD],chain=record.a||record.c,i=0,react;if(record.h)return false;while(chain.length>i){react=chain[i++];if(react.fail||!isUnhandled(react.P))return false}return true}function $reject(value){var record=this,promise;if(record.d)return;record.d=true;record=record.r||record;record.v=value;record.s=2;record.a=record.c.slice();setTimeout(function(){asap.call(global,function(){if(isUnhandled(promise=record.p)){if(isNode){process.emit("unhandledRejection",value,promise)}else if(global.console&&console.error){console.error("Unhandled promise rejection",value)}}record.a=undefined})},1);notify(record)}function $resolve(value){var record=this,then;if(record.d)return;record.d=true;record=record.r||record;try{if(then=isThenable(value)){asap.call(global,function(){var wrapper={r:record,d:false};try{then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1))}catch(e){$reject.call(wrapper,e)}})}else{record.v=value;record.s=1;notify(record)}}catch(e){$reject.call({r:record,d:false},e)}}if(!useNative){P=function Promise(executor){assertFunction(executor);var record={p:assert.inst(this,P,PROMISE),c:[],a:undefined,s:0,d:false,v:undefined,h:false};$.hide(this,RECORD,record);try{executor(ctx($resolve,record,1),ctx($reject,record,1))}catch(err){$reject.call(record,err)}};require("./$.mix")(P.prototype,{then:function then(onFulfilled,onRejected){var S=assertObject(assertObject(this).constructor)[SPECIES];var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false};var promise=react.P=new(S!=undefined?S:P)(function(res,rej){react.res=assertFunction(res);react.rej=assertFunction(rej)});var record=this[RECORD];record.c.push(react);if(record.a)record.a.push(react);if(record.s)notify(record);return promise},"catch":function(onRejected){return this.then(undefined,onRejected)}})}$def($def.G+$def.W+$def.F*!useNative,{Promise:P});cof.set(P,PROMISE);species(P);species(Wrapper=$.core[PROMISE]);$def($def.S+$def.F*!useNative,PROMISE,{reject:function reject(r){return new(getConstructor(this))(function(res,rej){rej(r)})}});$def($def.S+$def.F*(!useNative||testResolve(true)),PROMISE,{resolve:function resolve(x){return isPromise(x)&&sameConstructor(x.constructor,this)?x:new this(function(res){res(x)})}});$def($def.S+$def.F*!(useNative&&require("./$.iter-detect")(function(iter){P.all(iter)["catch"](function(){})})),PROMISE,{all:function all(iterable){var C=getConstructor(this),values=[];return new C(function(res,rej){forOf(iterable,false,values.push,values);var remaining=values.length,results=Array(remaining);if(remaining)$.each.call(values,function(promise,index){C.resolve(promise).then(function(value){results[index]=value;--remaining||res(results)},rej)});else res(results)})},race:function race(iterable){var C=getConstructor(this);return new C(function(res,rej){forOf(iterable,false,function(promise){C.resolve(promise).then(res,rej)})})}})},{"./$":24,"./$.assert":5,"./$.cof":7,"./$.ctx":12,"./$.def":13,"./$.for-of":16,"./$.iter-detect":22,"./$.mix":26,"./$.same":31,"./$.set-proto":32,"./$.species":34,"./$.task":38,"./$.uid":40,"./$.wks":42}],64:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),setProto=require("./$.set-proto"),$iter=require("./$.iter"),ITERATOR=require("./$.wks")("iterator"),ITER=require("./$.uid").safe("iter"),step=$iter.step,assert=require("./$.assert"),isObject=$.isObject,getProto=$.getProto,$Reflect=$.g.Reflect,_apply=Function.apply,assertObject=assert.obj,_isExtensible=Object.isExtensible||isObject,_preventExtensions=Object.preventExtensions,buggyEnumerate=!($Reflect&&$Reflect.enumerate&&ITERATOR in $Reflect.enumerate({}));function Enumerate(iterated){$.set(this,ITER,{o:iterated,k:undefined,i:0})}$iter.create(Enumerate,"Object",function(){var iter=this[ITER],keys=iter.k,key;if(keys==undefined){iter.k=keys=[];for(key in iter.o)keys.push(key)}do{if(iter.i>=keys.length)return step(1)}while(!((key=keys[iter.i++])in iter.o));return step(0,key)});var reflect={apply:function apply(target,thisArgument,argumentsList){return _apply.call(target,thisArgument,argumentsList)},construct:function construct(target,argumentsList){var proto=assert.fn(arguments.length<3?target:arguments[2]).prototype,instance=$.create(isObject(proto)?proto:Object.prototype),result=_apply.call(target,instance,argumentsList);return isObject(result)?result:instance},defineProperty:function defineProperty(target,propertyKey,attributes){assertObject(target);try{$.setDesc(target,propertyKey,attributes);return true}catch(e){return false}},deleteProperty:function deleteProperty(target,propertyKey){var desc=$.getDesc(assertObject(target),propertyKey);return desc&&!desc.configurable?false:delete target[propertyKey]},get:function get(target,propertyKey){var receiver=arguments.length<3?target:arguments[2],desc=$.getDesc(assertObject(target),propertyKey),proto;if(desc)return $.has(desc,"value")?desc.value:desc.get===undefined?undefined:desc.get.call(receiver);return isObject(proto=getProto(target))?get(proto,propertyKey,receiver):undefined},getOwnPropertyDescriptor:function getOwnPropertyDescriptor(target,propertyKey){return $.getDesc(assertObject(target),propertyKey)},getPrototypeOf:function getPrototypeOf(target){return getProto(assertObject(target))},has:function has(target,propertyKey){return propertyKey in target},isExtensible:function isExtensible(target){return _isExtensible(assertObject(target))},ownKeys:require("./$.own-keys"),preventExtensions:function preventExtensions(target){assertObject(target);try{if(_preventExtensions)_preventExtensions(target);return true}catch(e){return false}},set:function set(target,propertyKey,V){var receiver=arguments.length<4?target:arguments[3],ownDesc=$.getDesc(assertObject(target),propertyKey),existingDescriptor,proto;if(!ownDesc){if(isObject(proto=getProto(target))){return set(proto,propertyKey,V,receiver)}ownDesc=$.desc(0)}if($.has(ownDesc,"value")){if(ownDesc.writable===false||!isObject(receiver))return false;existingDescriptor=$.getDesc(receiver,propertyKey)||$.desc(0);existingDescriptor.value=V;$.setDesc(receiver,propertyKey,existingDescriptor);return true}return ownDesc.set===undefined?false:(ownDesc.set.call(receiver,V),true)}};if(setProto)reflect.setPrototypeOf=function setPrototypeOf(target,proto){setProto.check(target,proto);try{setProto.set(target,proto);return true}catch(e){return false}};$def($def.G,{Reflect:{}});$def($def.S+$def.F*buggyEnumerate,"Reflect",{enumerate:function enumerate(target){return new Enumerate(assertObject(target))}});$def($def.S,"Reflect",reflect)},{"./$":24,"./$.assert":5,"./$.def":13,"./$.iter":23,"./$.own-keys":27,"./$.set-proto":32,"./$.uid":40,"./$.wks":42}],65:[function(require,module,exports){var $=require("./$"),cof=require("./$.cof"),$RegExp=$.g.RegExp,Base=$RegExp,proto=$RegExp.prototype,re=/a/g,CORRECT_NEW=new $RegExp(re)!==re,ALLOWS_RE_WITH_FLAGS=function(){try{return $RegExp(re,"i")=="/a/i"}catch(e){}}();if($.FW&&$.DESC){if(!CORRECT_NEW||!ALLOWS_RE_WITH_FLAGS){$RegExp=function RegExp(pattern,flags){var patternIsRegExp=cof(pattern)=="RegExp",flagsIsUndefined=flags===undefined;if(!(this instanceof $RegExp)&&patternIsRegExp&&flagsIsUndefined)return pattern;return CORRECT_NEW?new Base(patternIsRegExp&&!flagsIsUndefined?pattern.source:pattern,flags):new Base(patternIsRegExp?pattern.source:pattern,patternIsRegExp&&flagsIsUndefined?pattern.flags:flags)};$.each.call($.getNames(Base),function(key){key in $RegExp||$.setDesc($RegExp,key,{configurable:true,get:function(){return Base[key]},set:function(it){Base[key]=it}})});proto.constructor=$RegExp;$RegExp.prototype=proto;require("./$.redef")($.g,"RegExp",$RegExp)}if(/./g.flags!="g")$.setDesc(proto,"flags",{configurable:true,get:require("./$.replacer")(/^.*\/(\w*)$/,"$1")})}require("./$.species")($RegExp)},{"./$":24,"./$.cof":7,"./$.redef":29,"./$.replacer":30,"./$.species":34}],66:[function(require,module,exports){"use strict";var strong=require("./$.collection-strong");require("./$.collection")("Set",function(get){return function Set(){return get(this,arguments[0])}},{add:function add(value){return strong.def(this,value=value===0?0:value,value)}},strong)},{"./$.collection":11,"./$.collection-strong":8}],67:[function(require,module,exports){"use strict";var $def=require("./$.def"),$at=require("./$.string-at")(false);$def($def.P,"String",{codePointAt:function codePointAt(pos){return $at(this,pos)}})},{"./$.def":13,"./$.string-at":35}],68:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def"),toLength=$.toLength;$def($def.P+$def.F*!require("./$.throws")(function(){"q".endsWith(/./)}),"String",{endsWith:function endsWith(searchString){if(cof(searchString)=="RegExp")throw TypeError();var that=String($.assertDefined(this)),endPosition=arguments[1],len=toLength(that.length),end=endPosition===undefined?len:Math.min(toLength(endPosition),len);searchString+="";return that.slice(end-searchString.length,end)===searchString}})},{"./$":24,"./$.cof":7,"./$.def":13,"./$.throws":39}],69:[function(require,module,exports){var $def=require("./$.def"),toIndex=require("./$").toIndex,fromCharCode=String.fromCharCode,$fromCodePoint=String.fromCodePoint;$def($def.S+$def.F*(!!$fromCodePoint&&$fromCodePoint.length!=1),"String",{fromCodePoint:function fromCodePoint(x){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+" is not a valid code point");res.push(code<65536?fromCharCode(code):fromCharCode(((code-=65536)>>10)+55296,code%1024+56320))}return res.join("")}})},{"./$":24,"./$.def":13}],70:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def");$def($def.P,"String",{includes:function includes(searchString){if(cof(searchString)=="RegExp")throw TypeError();return!!~String($.assertDefined(this)).indexOf(searchString,arguments[1])}})},{"./$":24,"./$.cof":7,"./$.def":13}],71:[function(require,module,exports){var set=require("./$").set,$at=require("./$.string-at")(true),ITER=require("./$.uid").safe("iter"),$iter=require("./$.iter"),step=$iter.step;require("./$.iter-define")(String,"String",function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return step(1);point=$at(O,index);iter.i+=point.length;return step(0,point)})},{"./$":24,"./$.iter":23,"./$.iter-define":21,"./$.string-at":35,"./$.uid":40}],72:[function(require,module,exports){var $=require("./$"),$def=require("./$.def");$def($def.S,"String",{raw:function raw(callSite){var tpl=$.toObject(callSite.raw),len=$.toLength(tpl.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(tpl[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join("")}})},{"./$":24,"./$.def":13}],73:[function(require,module,exports){var $def=require("./$.def");$def($def.P,"String",{repeat:require("./$.string-repeat")})},{"./$.def":13,"./$.string-repeat":37}],74:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def");$def($def.P+$def.F*!require("./$.throws")(function(){"q".startsWith(/./)}),"String",{startsWith:function startsWith(searchString){if(cof(searchString)=="RegExp")throw TypeError();var that=String($.assertDefined(this)),index=$.toLength(Math.min(arguments[1],that.length));searchString+="";return that.slice(index,index+searchString.length)===searchString}})},{"./$":24,"./$.cof":7,"./$.def":13,"./$.throws":39}],75:[function(require,module,exports){"use strict";var $=require("./$"),setTag=require("./$.cof").set,uid=require("./$.uid"),shared=require("./$.shared"),$def=require("./$.def"),$redef=require("./$.redef"),keyOf=require("./$.keyof"),enumKeys=require("./$.enum-keys"),assertObject=require("./$.assert").obj,ObjectProto=Object.prototype,DESC=$.DESC,has=$.has,$create=$.create,getDesc=$.getDesc,setDesc=$.setDesc,desc=$.desc,$names=require("./$.get-names"),getNames=$names.get,toObject=$.toObject,$Symbol=$.g.Symbol,setter=false,TAG=uid("tag"),HIDDEN=uid("hidden"),_propertyIsEnumerable={}.propertyIsEnumerable,SymbolRegistry=shared("symbol-registry"),AllSymbols=shared("symbols"),useNative=$.isFunction($Symbol);var setSymbolDesc=DESC?function(){try{return $create(setDesc({},HIDDEN,{get:function(){return setDesc(this,HIDDEN,{value:false})[HIDDEN]}}))[HIDDEN]||setDesc}catch(e){return function(it,key,D){var protoDesc=getDesc(ObjectProto,key);if(protoDesc)delete ObjectProto[key];setDesc(it,key,D);if(protoDesc&&it!==ObjectProto)setDesc(ObjectProto,key,protoDesc)}}}():setDesc;function wrap(tag){var sym=AllSymbols[tag]=$.set($create($Symbol.prototype),TAG,tag);DESC&&setter&&setSymbolDesc(ObjectProto,tag,{configurable:true,set:function(value){if(has(this,HIDDEN)&&has(this[HIDDEN],tag))this[HIDDEN][tag]=false;setSymbolDesc(this,tag,desc(1,value))}});return sym}function defineProperty(it,key,D){if(D&&has(AllSymbols,key)){if(!D.enumerable){if(!has(it,HIDDEN))setDesc(it,HIDDEN,desc(1,{}));it[HIDDEN][key]=true}else{if(has(it,HIDDEN)&&it[HIDDEN][key])it[HIDDEN][key]=false;D=$create(D,{enumerable:desc(0,false)})}return setSymbolDesc(it,key,D)}return setDesc(it,key,D)}function defineProperties(it,P){assertObject(it);var keys=enumKeys(P=toObject(P)),i=0,l=keys.length,key;while(l>i)defineProperty(it,key=keys[i++],P[key]);return it}function create(it,P){return P===undefined?$create(it):defineProperties($create(it),P)}function propertyIsEnumerable(key){var E=_propertyIsEnumerable.call(this,key);return E||!has(this,key)||!has(AllSymbols,key)||has(this,HIDDEN)&&this[HIDDEN][key]?E:true}function getOwnPropertyDescriptor(it,key){var D=getDesc(it=toObject(it),key);if(D&&has(AllSymbols,key)&&!(has(it,HIDDEN)&&it[HIDDEN][key]))D.enumerable=true;return D}function getOwnPropertyNames(it){var names=getNames(toObject(it)),result=[],i=0,key;while(names.length>i)if(!has(AllSymbols,key=names[i++])&&key!=HIDDEN)result.push(key);return result}function getOwnPropertySymbols(it){var names=getNames(toObject(it)),result=[],i=0,key;while(names.length>i)if(has(AllSymbols,key=names[i++]))result.push(AllSymbols[key]);return result}if(!useNative){$Symbol=function Symbol(){if(this instanceof $Symbol)throw TypeError("Symbol is not a constructor");return wrap(uid(arguments[0]))};$redef($Symbol.prototype,"toString",function(){return this[TAG]});$.create=create;$.setDesc=defineProperty;$.getDesc=getOwnPropertyDescriptor;$.setDescs=defineProperties;$.getNames=$names.get=getOwnPropertyNames;$.getSymbols=getOwnPropertySymbols;if($.DESC&&$.FW)$redef(ObjectProto,"propertyIsEnumerable",propertyIsEnumerable,true)}var symbolStatics={"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=$Symbol(key)},keyFor:function keyFor(key){return keyOf(SymbolRegistry,key)},useSetter:function(){setter=true},useSimple:function(){setter=false}};$.each.call(("hasInstance,isConcatSpreadable,iterator,match,replace,search,"+"species,split,toPrimitive,toStringTag,unscopables").split(","),function(it){var sym=require("./$.wks")(it);symbolStatics[it]=useNative?sym:wrap(sym)});setter=true;$def($def.G+$def.W,{Symbol:$Symbol});$def($def.S,"Symbol",symbolStatics);$def($def.S+$def.F*!useNative,"Object",{create:create,defineProperty:defineProperty,defineProperties:defineProperties,getOwnPropertyDescriptor:getOwnPropertyDescriptor,getOwnPropertyNames:getOwnPropertyNames,getOwnPropertySymbols:getOwnPropertySymbols});setTag($Symbol,"Symbol");setTag(Math,"Math",true);setTag($.g.JSON,"JSON",true)},{"./$":24,"./$.assert":5,"./$.cof":7,"./$.def":13,"./$.enum-keys":15,"./$.get-names":18,"./$.keyof":25,"./$.redef":29,"./$.shared":33,"./$.uid":40,"./$.wks":42}],76:[function(require,module,exports){"use strict";var $=require("./$"),weak=require("./$.collection-weak"),leakStore=weak.leakStore,ID=weak.ID,WEAK=weak.WEAK,has=$.has,isObject=$.isObject,isExtensible=Object.isExtensible||isObject,tmp={};var $WeakMap=require("./$.collection")("WeakMap",function(get){return function WeakMap(){return get(this,arguments[0])}},{get:function get(key){if(isObject(key)){if(!isExtensible(key))return leakStore(this).get(key);if(has(key,WEAK))return key[WEAK][this[ID]]}},set:function set(key,value){return weak.def(this,key,value)}},weak,true,true);if((new $WeakMap).set((Object.freeze||Object)(tmp),7).get(tmp)!=7){$.each.call(["delete","has","get","set"],function(key){var proto=$WeakMap.prototype,method=proto[key];require("./$.redef")(proto,key,function(a,b){if(isObject(a)&&!isExtensible(a)){var result=leakStore(this)[key](a,b);
return key=="set"?this:result}return method.call(this,a,b)})})}},{"./$":24,"./$.collection":11,"./$.collection-weak":10,"./$.redef":29}],77:[function(require,module,exports){"use strict";var weak=require("./$.collection-weak");require("./$.collection")("WeakSet",function(get){return function WeakSet(){return get(this,arguments[0])}},{add:function add(value){return weak.def(this,value,true)}},weak,false,true)},{"./$.collection":11,"./$.collection-weak":10}],78:[function(require,module,exports){"use strict";var $def=require("./$.def"),$includes=require("./$.array-includes")(true);$def($def.P,"Array",{includes:function includes(el){return $includes(this,el,arguments[1])}});require("./$.unscope")("includes")},{"./$.array-includes":3,"./$.def":13,"./$.unscope":41}],79:[function(require,module,exports){require("./$.collection-to-json")("Map")},{"./$.collection-to-json":9}],80:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),ownKeys=require("./$.own-keys");$def($def.S,"Object",{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(object){var O=$.toObject(object),result={};$.each.call(ownKeys(O),function(key){$.setDesc(result,key,$.desc(0,$.getDesc(O,key)))});return result}})},{"./$":24,"./$.def":13,"./$.own-keys":27}],81:[function(require,module,exports){var $=require("./$"),$def=require("./$.def");function createObjectToArray(isEntries){return function(object){var O=$.toObject(object),keys=$.getKeys(O),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$def($def.S,"Object",{values:createObjectToArray(false),entries:createObjectToArray(true)})},{"./$":24,"./$.def":13}],82:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"RegExp",{escape:require("./$.replacer")(/[\\^$*+?.()|[\]{}]/g,"\\$&",true)})},{"./$.def":13,"./$.replacer":30}],83:[function(require,module,exports){require("./$.collection-to-json")("Set")},{"./$.collection-to-json":9}],84:[function(require,module,exports){"use strict";var $def=require("./$.def"),$at=require("./$.string-at")(true);$def($def.P,"String",{at:function at(pos){return $at(this,pos)}})},{"./$.def":13,"./$.string-at":35}],85:[function(require,module,exports){"use strict";var $def=require("./$.def"),$pad=require("./$.string-pad");$def($def.P,"String",{lpad:function lpad(n){return $pad(this,n,arguments[1],true)}})},{"./$.def":13,"./$.string-pad":36}],86:[function(require,module,exports){"use strict";var $def=require("./$.def"),$pad=require("./$.string-pad");$def($def.P,"String",{rpad:function rpad(n){return $pad(this,n,arguments[1],false)}})},{"./$.def":13,"./$.string-pad":36}],87:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),$Array=$.core.Array||Array,statics={};function setStatics(keys,length){$.each.call(keys.split(","),function(key){if(length==undefined&&key in $Array)statics[key]=$Array[key];else if(key in[])statics[key]=require("./$.ctx")(Function.call,[][key],length)})}setStatics("pop,reverse,shift,keys,values,entries",1);setStatics("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);setStatics("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");$def($def.S,"Array",statics)},{"./$":24,"./$.ctx":12,"./$.def":13}],88:[function(require,module,exports){require("./es6.array.iterator");var $=require("./$"),Iterators=require("./$.iter").Iterators,ITERATOR=require("./$.wks")("iterator"),ArrayValues=Iterators.Array,NL=$.g.NodeList,HTC=$.g.HTMLCollection,NLProto=NL&&NL.prototype,HTCProto=HTC&&HTC.prototype;if($.FW){if(NL&&!(ITERATOR in NLProto))$.hide(NLProto,ITERATOR,ArrayValues);if(HTC&&!(ITERATOR in HTCProto))$.hide(HTCProto,ITERATOR,ArrayValues)}Iterators.NodeList=Iterators.HTMLCollection=ArrayValues},{"./$":24,"./$.iter":23,"./$.wks":42,"./es6.array.iterator":49}],89:[function(require,module,exports){var $def=require("./$.def"),$task=require("./$.task");$def($def.G+$def.B,{setImmediate:$task.set,clearImmediate:$task.clear})},{"./$.def":13,"./$.task":38}],90:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),invoke=require("./$.invoke"),partial=require("./$.partial"),navigator=$.g.navigator,MSIE=!!navigator&&/MSIE .\./.test(navigator.userAgent);function wrap(set){return MSIE?function(fn,time){return set(invoke(partial,[].slice.call(arguments,2),$.isFunction(fn)?fn:Function(fn)),time)}:set}$def($def.G+$def.B+$def.F*MSIE,{setTimeout:wrap($.g.setTimeout),setInterval:wrap($.g.setInterval)})},{"./$":24,"./$.def":13,"./$.invoke":19,"./$.partial":28}],91:[function(require,module,exports){require("./modules/es5");require("./modules/es6.symbol");require("./modules/es6.object.assign");require("./modules/es6.object.is");require("./modules/es6.object.set-prototype-of");require("./modules/es6.object.to-string");require("./modules/es6.object.statics-accept-primitives");require("./modules/es6.function.name");require("./modules/es6.function.has-instance");require("./modules/es6.number.constructor");require("./modules/es6.number.statics");require("./modules/es6.math");require("./modules/es6.string.from-code-point");require("./modules/es6.string.raw");require("./modules/es6.string.iterator");require("./modules/es6.string.code-point-at");require("./modules/es6.string.ends-with");require("./modules/es6.string.includes");require("./modules/es6.string.repeat");require("./modules/es6.string.starts-with");require("./modules/es6.array.from");require("./modules/es6.array.of");require("./modules/es6.array.iterator");require("./modules/es6.array.species");require("./modules/es6.array.copy-within");require("./modules/es6.array.fill");require("./modules/es6.array.find");require("./modules/es6.array.find-index");require("./modules/es6.regexp");require("./modules/es6.promise");require("./modules/es6.map");require("./modules/es6.set");require("./modules/es6.weak-map");require("./modules/es6.weak-set");require("./modules/es6.reflect");require("./modules/es7.array.includes");require("./modules/es7.string.at");require("./modules/es7.string.lpad");require("./modules/es7.string.rpad");require("./modules/es7.regexp.escape");require("./modules/es7.object.get-own-property-descriptors");require("./modules/es7.object.to-array");require("./modules/es7.map.to-json");require("./modules/es7.set.to-json");require("./modules/js.array.statics");require("./modules/web.timers");require("./modules/web.immediate");require("./modules/web.dom.iterable");module.exports=require("./modules/$").core},{"./modules/$":24,"./modules/es5":43,"./modules/es6.array.copy-within":44,"./modules/es6.array.fill":45,"./modules/es6.array.find":47,"./modules/es6.array.find-index":46,"./modules/es6.array.from":48,"./modules/es6.array.iterator":49,"./modules/es6.array.of":50,"./modules/es6.array.species":51,"./modules/es6.function.has-instance":52,"./modules/es6.function.name":53,"./modules/es6.map":54,"./modules/es6.math":55,"./modules/es6.number.constructor":56,"./modules/es6.number.statics":57,"./modules/es6.object.assign":58,"./modules/es6.object.is":59,"./modules/es6.object.set-prototype-of":60,"./modules/es6.object.statics-accept-primitives":61,"./modules/es6.object.to-string":62,"./modules/es6.promise":63,"./modules/es6.reflect":64,"./modules/es6.regexp":65,"./modules/es6.set":66,"./modules/es6.string.code-point-at":67,"./modules/es6.string.ends-with":68,"./modules/es6.string.from-code-point":69,"./modules/es6.string.includes":70,"./modules/es6.string.iterator":71,"./modules/es6.string.raw":72,"./modules/es6.string.repeat":73,"./modules/es6.string.starts-with":74,"./modules/es6.symbol":75,"./modules/es6.weak-map":76,"./modules/es6.weak-set":77,"./modules/es7.array.includes":78,"./modules/es7.map.to-json":79,"./modules/es7.object.get-own-property-descriptors":80,"./modules/es7.object.to-array":81,"./modules/es7.regexp.escape":82,"./modules/es7.set.to-json":83,"./modules/es7.string.at":84,"./modules/es7.string.lpad":85,"./modules/es7.string.rpad":86,"./modules/js.array.statics":87,"./modules/web.dom.iterable":88,"./modules/web.immediate":89,"./modules/web.timers":90}],92:[function(require,module,exports){(function(process,global){!function(global){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var inModule=typeof module==="object";var runtime=global.regeneratorRuntime;if(runtime){if(inModule){module.exports=runtime}return}runtime=global.regeneratorRuntime=inModule?module.exports:{};function wrap(innerFn,outerFn,self,tryLocsList){var generator=Object.create((outerFn||Generator).prototype);generator._invoke=makeInvokeMethod(innerFn,self||null,new Context(tryLocsList||[]));return generator}runtime.wrap=wrap;function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName="GeneratorFunction";function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){prototype[method]=function(arg){return this._invoke(method,arg)}})}runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction||(ctor.displayName||ctor.name)==="GeneratorFunction":false};runtime.mark=function(genFun){genFun.__proto__=GeneratorFunctionPrototype;genFun.prototype=Object.create(Gp);return genFun};runtime.awrap=function(arg){return new AwaitArgument(arg)};function AwaitArgument(arg){this.arg=arg}function AsyncIterator(generator){function invoke(method,arg){var result=generator[method](arg);var value=result.value;return value instanceof AwaitArgument?Promise.resolve(value.arg).then(invokeNext,invokeThrow):Promise.resolve(value).then(function(unwrapped){result.value=unwrapped;return result})}if(typeof process==="object"&&process.domain){invoke=process.domain.bind(invoke)}var invokeNext=invoke.bind(generator,"next");var invokeThrow=invoke.bind(generator,"throw");var invokeReturn=invoke.bind(generator,"return");var previousPromise;function enqueue(method,arg){var enqueueResult=previousPromise?previousPromise.then(function(){return invoke(method,arg)}):new Promise(function(resolve){resolve(invoke(method,arg))});previousPromise=enqueueResult["catch"](function(ignored){});return enqueueResult}this._invoke=enqueue}defineIteratorMethods(AsyncIterator.prototype);runtime.async=function(innerFn,outerFn,self,tryLocsList){var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList));return runtime.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})};function makeInvokeMethod(innerFn,self,context){var state=GenStateSuspendedStart;return function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){if(method==="throw"){throw arg}return doneResult()}while(true){var delegate=context.delegate;if(delegate){if(method==="return"||method==="throw"&&delegate.iterator[method]===undefined){context.delegate=null;var returnMethod=delegate.iterator["return"];if(returnMethod){var record=tryCatch(returnMethod,delegate.iterator,arg);if(record.type==="throw"){method="throw";arg=record.arg;continue}}if(method==="return"){continue}}var record=tryCatch(delegate.iterator[method],delegate.iterator,arg);if(record.type==="throw"){context.delegate=null;method="throw";arg=record.arg;continue}method="next";arg=undefined;var info=record.arg;if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method==="next"){if(state===GenStateSuspendedYield){context.sent=arg}else{context.sent=undefined}}else if(method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg}if(context.dispatchException(arg)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:record.arg,done:context.done};if(record.arg===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}else if(record.type==="throw"){state=GenStateCompleted;method="throw";arg=record.arg}}}}defineIteratorMethods(Gp);Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(locs){var entry={tryLoc:locs[0]};if(1 in locs){entry.catchLoc=locs[1]}if(2 in locs){entry.finallyLoc=locs[2];entry.afterLoc=locs[3]}this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal";delete record.arg;entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}];tryLocsList.forEach(pushTryEntry,this);this.reset(true)}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next==="function"){return iterable}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next};return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(skipTempReset){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);if(!skipTempReset){for(var name in this){if(name.charAt(0)==="t"&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))){this[name]=undefined}}}},stop:function(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type==="throw"){throw rootRecord.arg}return this.rval},dispatchException:function(exception){if(this.done){throw exception}var context=this;function handle(loc,caught){record.type="throw";record.arg=exception;context.next=loc;return!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},abrupt:function(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}}if(finallyEntry&&(type==="break"||type==="continue")&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc){finallyEntry=null}var record=finallyEntry?finallyEntry.completion:{};record.type=type;record.arg=arg;if(finallyEntry){this.next=finallyEntry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record,afterLoc){if(record.type==="throw"){throw record.arg}if(record.type==="break"||record.type==="continue"){this.next=record.arg}else if(record.type==="return"){this.rval=record.arg;this.next="end"}else if(record.type==="normal"&&afterLoc){this.next=afterLoc}},finish:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel}}},"catch":function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}(typeof global==="object"?global:typeof window==="object"?window:typeof self==="object"?self:this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{_process:1}]},{},[2]);
|
frontend/src/Settings/Metadata/MetadataProvider/MetadataProviderConnector.js | lidarr/Lidarr | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { clearPendingChanges } from 'Store/Actions/baseActions';
import { fetchMetadataProvider, saveMetadataProvider, setMetadataProviderValue } from 'Store/Actions/settingsActions';
import createSettingsSectionSelector from 'Store/Selectors/createSettingsSectionSelector';
import MetadataProvider from './MetadataProvider';
const SECTION = 'metadataProvider';
function createMapStateToProps() {
return createSelector(
(state) => state.settings.advancedSettings,
createSettingsSectionSelector(SECTION),
(advancedSettings, sectionSettings) => {
return {
advancedSettings,
...sectionSettings
};
}
);
}
const mapDispatchToProps = {
dispatchFetchMetadataProvider: fetchMetadataProvider,
dispatchSetMetadataProviderValue: setMetadataProviderValue,
dispatchSaveMetadataProvider: saveMetadataProvider,
dispatchClearPendingChanges: clearPendingChanges
};
class MetadataProviderConnector extends Component {
//
// Lifecycle
componentDidMount() {
const {
dispatchFetchMetadataProvider,
dispatchSaveMetadataProvider,
onChildMounted
} = this.props;
dispatchFetchMetadataProvider();
onChildMounted(dispatchSaveMetadataProvider);
}
componentDidUpdate(prevProps) {
const {
hasPendingChanges,
isSaving,
onChildStateChange
} = this.props;
if (
prevProps.isSaving !== isSaving ||
prevProps.hasPendingChanges !== hasPendingChanges
) {
onChildStateChange({
isSaving,
hasPendingChanges
});
}
}
componentWillUnmount() {
this.props.dispatchClearPendingChanges({ section: 'settings.metadataProvider' });
}
//
// Listeners
onInputChange = ({ name, value }) => {
this.props.dispatchSetMetadataProviderValue({ name, value });
}
//
// Render
render() {
return (
<MetadataProvider
onInputChange={this.onInputChange}
{...this.props}
/>
);
}
}
MetadataProviderConnector.propTypes = {
isSaving: PropTypes.bool.isRequired,
hasPendingChanges: PropTypes.bool.isRequired,
dispatchFetchMetadataProvider: PropTypes.func.isRequired,
dispatchSetMetadataProviderValue: PropTypes.func.isRequired,
dispatchSaveMetadataProvider: PropTypes.func.isRequired,
dispatchClearPendingChanges: PropTypes.func.isRequired,
onChildMounted: PropTypes.func.isRequired,
onChildStateChange: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(MetadataProviderConnector);
|
node_modules/react-bootstrap/es/Pagination.js | geng890518/editor-ui | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _extends from 'babel-runtime/helpers/extends';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import elementType from 'react-prop-types/lib/elementType';
import PaginationButton from './PaginationButton';
import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
var propTypes = {
activePage: PropTypes.number,
items: PropTypes.number,
maxButtons: PropTypes.number,
/**
* When `true`, will display the first and the last button page when
* displaying ellipsis.
*/
boundaryLinks: PropTypes.bool,
/**
* When `true`, will display the default node value ('…').
* Otherwise, will display provided node (when specified).
*/
ellipsis: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
/**
* When `true`, will display the default node value ('«').
* Otherwise, will display provided node (when specified).
*/
first: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
/**
* When `true`, will display the default node value ('»').
* Otherwise, will display provided node (when specified).
*/
last: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
/**
* When `true`, will display the default node value ('‹').
* Otherwise, will display provided node (when specified).
*/
prev: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
/**
* When `true`, will display the default node value ('›').
* Otherwise, will display provided node (when specified).
*/
next: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
onSelect: PropTypes.func,
/**
* You can use a custom element for the buttons
*/
buttonComponentClass: elementType
};
var defaultProps = {
activePage: 1,
items: 1,
maxButtons: 0,
first: false,
last: false,
prev: false,
next: false,
ellipsis: true,
boundaryLinks: false
};
var Pagination = function (_React$Component) {
_inherits(Pagination, _React$Component);
function Pagination() {
_classCallCheck(this, Pagination);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Pagination.prototype.renderPageButtons = function renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps) {
var pageButtons = [];
var startPage = void 0;
var endPage = void 0;
if (maxButtons && maxButtons < items) {
startPage = Math.max(Math.min(activePage - Math.floor(maxButtons / 2, 10), items - maxButtons + 1), 1);
endPage = startPage + maxButtons - 1;
} else {
startPage = 1;
endPage = items;
}
for (var page = startPage; page <= endPage; ++page) {
pageButtons.push(React.createElement(
PaginationButton,
_extends({}, buttonProps, {
key: page,
eventKey: page,
active: page === activePage
}),
page
));
}
if (ellipsis && boundaryLinks && startPage > 1) {
if (startPage > 2) {
pageButtons.unshift(React.createElement(
PaginationButton,
{
key: 'ellipsisFirst',
disabled: true,
componentClass: buttonProps.componentClass
},
React.createElement(
'span',
{ 'aria-label': 'More' },
ellipsis === true ? '\u2026' : ellipsis
)
));
}
pageButtons.unshift(React.createElement(
PaginationButton,
_extends({}, buttonProps, {
key: 1,
eventKey: 1,
active: false
}),
'1'
));
}
if (ellipsis && endPage < items) {
if (!boundaryLinks || endPage < items - 1) {
pageButtons.push(React.createElement(
PaginationButton,
{
key: 'ellipsis',
disabled: true,
componentClass: buttonProps.componentClass
},
React.createElement(
'span',
{ 'aria-label': 'More' },
ellipsis === true ? '\u2026' : ellipsis
)
));
}
if (boundaryLinks) {
pageButtons.push(React.createElement(
PaginationButton,
_extends({}, buttonProps, {
key: items,
eventKey: items,
active: false
}),
items
));
}
}
return pageButtons;
};
Pagination.prototype.render = function render() {
var _props = this.props,
activePage = _props.activePage,
items = _props.items,
maxButtons = _props.maxButtons,
boundaryLinks = _props.boundaryLinks,
ellipsis = _props.ellipsis,
first = _props.first,
last = _props.last,
prev = _props.prev,
next = _props.next,
onSelect = _props.onSelect,
buttonComponentClass = _props.buttonComponentClass,
className = _props.className,
props = _objectWithoutProperties(_props, ['activePage', 'items', 'maxButtons', 'boundaryLinks', 'ellipsis', 'first', 'last', 'prev', 'next', 'onSelect', 'buttonComponentClass', 'className']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var classes = getClassSet(bsProps);
var buttonProps = {
onSelect: onSelect,
componentClass: buttonComponentClass
};
return React.createElement(
'ul',
_extends({}, elementProps, {
className: classNames(className, classes)
}),
first && React.createElement(
PaginationButton,
_extends({}, buttonProps, {
eventKey: 1,
disabled: activePage === 1
}),
React.createElement(
'span',
{ 'aria-label': 'First' },
first === true ? '\xAB' : first
)
),
prev && React.createElement(
PaginationButton,
_extends({}, buttonProps, {
eventKey: activePage - 1,
disabled: activePage === 1
}),
React.createElement(
'span',
{ 'aria-label': 'Previous' },
prev === true ? '\u2039' : prev
)
),
this.renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps),
next && React.createElement(
PaginationButton,
_extends({}, buttonProps, {
eventKey: activePage + 1,
disabled: activePage >= items
}),
React.createElement(
'span',
{ 'aria-label': 'Next' },
next === true ? '\u203A' : next
)
),
last && React.createElement(
PaginationButton,
_extends({}, buttonProps, {
eventKey: items,
disabled: activePage >= items
}),
React.createElement(
'span',
{ 'aria-label': 'Last' },
last === true ? '\xBB' : last
)
)
);
};
return Pagination;
}(React.Component);
Pagination.propTypes = propTypes;
Pagination.defaultProps = defaultProps;
export default bsClass('pagination', Pagination); |
src/svg-icons/av/not-interested.js | skarnecki/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvNotInterested = (props) => (
<SvgIcon {...props}>
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"/>
</SvgIcon>
);
AvNotInterested = pure(AvNotInterested);
AvNotInterested.displayName = 'AvNotInterested';
export default AvNotInterested;
|
graph_ui/__tests__/ExportURL-test.js | rwhite226/Graphalyzer | 'use strict';
jest.unmock('../js/ExportURL');
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import ExportURL from '../js/ExportURL';
describe('ExportURL', () => {
var URL = "http://graphalyzer.wk-dev.wdesk.org/"
const exportURL = TestUtils.renderIntoDocument(
<ExportURL />
);
it('renders the button', () => {
const exportURLNode = ReactDOM.findDOMNode(exportURL);
expect(exportURLNode).toBeDefined();
});
it('returns a url', () => {
exportURL.createURL();
expect(exportURL).toEqual(URL);
});
}); |
examples/with-redux-reselect-recompose/components/clock.js | arunoda/next.js | import React from 'react'
import PropTypes from 'prop-types'
import { compose, pure, setDisplayName, setPropTypes } from 'recompose'
const format = t => `${pad(t.getUTCHours())}:${pad(t.getUTCMinutes())}:${pad(t.getUTCSeconds())}`
const pad = n => n < 10 ? `0${n}` : n
const Clock = ({ lastUpdate, light }) =>
<div className={light ? 'light' : ''}>
{format(new Date(lastUpdate))}
<style jsx>{`
div {
padding: 15px;
display: inline-block;
color: #82FA58;
font: 50px menlo, monaco, monospace;
background-color: #000;
}
.light {
background-color: #999;
}
`}</style>
</div>
export default compose(
setDisplayName('Clock'),
setPropTypes({
lastUpdate: PropTypes.number,
light: PropTypes.bool
}),
pure
)(Clock)
|
app/components/BillList/index.js | balintsoos/app.rezsi.io | /**
*
* BillList
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import BillListItem from 'components/BillListItem';
import ListPlaceholder from 'components/ListPlaceholder';
function BillList(props) {
if (!props.bills.length && props.placeholder) {
return (
<ListPlaceholder>
{props.placeholder}
</ListPlaceholder>
);
}
return (
<div>
{props.bills.map((bill) => (
<BillListItem
key={bill.id}
download={() => props.download(bill)}
{...bill}
/>
))}
</div>
);
}
BillList.propTypes = {
bills: PropTypes.array.isRequired,
placeholder: PropTypes.node,
};
export default BillList;
|
src/parser/paladin/holy/modules/talents/AuraOfMercy.js | FaideWW/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import SpellLink from 'common/SpellLink';
import { formatNumber } from 'common/format';
import Analyzer from 'parser/core/Analyzer';
import AbilityTracker from 'parser/shared/modules/AbilityTracker';
import StatisticBox, { STATISTIC_ORDER } from 'interface/others/StatisticBox';
class AuraOfMercy extends Analyzer {
static dependencies = {
abilityTracker: AbilityTracker,
};
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTalent(SPELLS.AURA_OF_MERCY_TALENT.id);
}
get healing() {
const abilityTracker = this.abilityTracker;
const getAbility = spellId => abilityTracker.getAbility(spellId);
return (getAbility(SPELLS.AURA_OF_MERCY_HEAL.id).healingEffective + getAbility(SPELLS.AURA_OF_MERCY_HEAL.id).healingAbsorbed);
}
get hps() {
return this.healing / this.owner.fightDuration * 1000;
}
get suggestionThresholds() {
return {
actual: this.hps,
isLessThan: {
minor: 600,
average: 550,
major: 500,
},
};
}
suggestions(when) {
when(this.suggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(
<>
The healing done by your <SpellLink id={SPELLS.AURA_OF_MERCY_TALENT.id} /> is low. Try to find a better moment to cast it or consider changing to <SpellLink id={SPELLS.AURA_OF_SACRIFICE_TALENT.id} /> or <SpellLink id={SPELLS.DEVOTION_AURA_TALENT.id} /> which can be more reliable.
</>
)
.icon(SPELLS.AURA_OF_MERCY_TALENT.icon)
.actual(`${formatNumber(actual)} HPS`)
.recommended(`>${formatNumber(recommended)} HPS is recommended`);
});
}
statistic() {
return (
<StatisticBox
position={STATISTIC_ORDER.OPTIONAL(60)}
icon={<SpellIcon id={SPELLS.AURA_OF_MERCY_TALENT.id} />}
value={`${formatNumber(this.hps)} HPS`}
label="Healing done"
/>
);
}
}
export default AuraOfMercy;
|
src/scenes/home/resetPassword/setPassword/setPassword.js | sethbergman/operationcode_frontend | import React, { Component } from 'react';
import axios from 'axios';
import { Redirect } from 'react-router-dom';
import PropTypes from 'prop-types';
import Form from 'shared/components/form/form';
import FormPassword from 'shared/components/form/formPassword/formPassword';
import FormButton from 'shared/components/form/formButton/formButton';
import config from 'config/environment';
import styles from './setPassword.css';
class RequestToken extends Component {
constructor(props) {
super(props);
this.state = {
password: '',
passwordConfirm: '',
passwordConfirmValid: true,
error: false,
isValid: true,
success: false
};
}
onPasswordChange = (value, valid) => {
this.setState({ password: value, passwordValid: valid });
};
onConfirmPasswordChange = (value, valid) => {
this.setState({ passwordConfirm: value, passwordConfirmValid: valid });
};
validatePasswordConfirm = value => value === '' || value === this.state.password;
handleOnClick = (e) => {
e.preventDefault();
if (this.isFormValid()) {
axios
.post(`${config.apiUrl}/users/passwords/reset`, {
reset_password_token: this.props.resetPasswordToken,
password: this.state.password
})
.then(() => {
this.setState({ success: true, error: null });
})
.catch(() => {
this.setState({ error: 'Error: please email [email protected] for help' });
});
}
};
isFormValid = () => this.state.passwordValid && this.state.passwordConfirmValid;
render() {
return (
<Form className={styles.setPasswordForm}>
<FormPassword
id="password"
placeholder="Password"
onChange={this.onPasswordChange}
validationRegex={/^(?=.*[A-Z]).{6,}$/}
validationErrorMessage="Must be 6 characters long and include a capitalized letter"
/>
<FormPassword
id="passwordConfirm"
placeholder="Confirm Password"
onChange={this.onConfirmPasswordChange}
validateFunc={this.validatePasswordConfirm}
validationErrorMessage="Passwords must match"
/>
{this.state.error ? <p className={styles.errorMessage}>{this.state.error}</p> : null}
{this.state.success && <Redirect to="/login" />}
<FormButton
className={styles.joinButton}
text="Set Password"
onClick={this.handleOnClick}
theme="red"
/>
</Form>
);
}
}
RequestToken.propTypes = {
resetPasswordToken: PropTypes.string.isRequired
};
export default RequestToken;
|
examples/huge-apps/routes/Calendar/components/Calendar.js | chunwei/react-router | import React from 'react';
class Calendar extends React.Component {
render () {
var events = [{
id: 0, title: 'essay due'
}];
return (
<div>
<h2>Calendar</h2>
<ul>
{events.map(event => (
<li key={event.id}>{event.title}</li>
))}
</ul>
</div>
);
}
}
export default Calendar;
|
ajax/libs/vue-material/1.0.0-beta-4/components/MdList/index.js | jonobr1/cdnjs | !(function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"));else if("function"==typeof define&&define.amd)define(["vue"],t);else{var n=t("object"==typeof exports?require("vue"):e.Vue);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}})(this,(function(e){return (function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=419)})({0:function(e,t){e.exports=function(e,t,n,r,o,i){var u,s=e=e||{},a=typeof e.default;"object"!==a&&"function"!==a||(u=e,s=e.default);var l="function"==typeof s?s.options:s;t&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),o&&(l._scopeId=o);var c;if(i?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=c):r&&(c=r),c){var d=l.functional,f=d?l.render:l.beforeCreate;d?(l._injectStyles=c,l.render=function(e,t){return c.call(t),f(e,t)}):l.beforeCreate=f?[].concat(f,c):[c]}return{esModule:u,exports:s,options:l}}},1:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t={props:{mdTheme:null},computed:{$mdActiveTheme:function(){var e=i.default.enabled,t=i.default.getThemeName,n=i.default.getAncestorTheme;return e&&!1!==this.mdTheme?t(this.mdTheme||n(this)):null}}};return(0,s.default)(t,e)};var o=n(4),i=r(o),u=n(6),s=r(u)},100:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(101),o=n.n(r),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("a",e._b({staticClass:"md-list-item-link"},"a",{href:e.href,disabled:e.disabled,target:e.target},!1),[n("md-list-item-content",{attrs:{"md-disabled":e.isDisabled}},[e._t("default")],2)],1)},u=[],s={render:i,staticRenderFns:u},a=s,l=n(0),c=l(o.a,a,!1,null,null,null);t.default=c.exports},101:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdListItemLink",mixins:[o.default],props:{href:String,target:String}}},102:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(103),o=n.n(r),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("router-link",e._b({staticClass:"md-list-item-router"},"router-link",e.routerProps,!1),[n("md-list-item-content",{attrs:{"md-disabled":e.isDisabled}},[e._t("default")],2)],1)},u=[],s={render:i,staticRenderFns:u},a=s,l=n(0),c=l(o.a,a,!1,null,null,null);t.default=c.exports},103:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdListItemRouter",mixins:[o.default],computed:{routerProps:function(){return this.$props}}}},104:function(e,t,n){"use strict";function r(e){n(105)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(106),i=n.n(o),u=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"md-list-item-expand",class:e.expandClasses},[n("md-list-item-content",{attrs:{"md-disabled":e.isDisabled},nativeOn:{click:function(t){e.toggleExpand(t)}}},[e._t("default"),e._v(" "),n("md-arrow-down-icon",{staticClass:"md-list-expand-icon"})],2),e._v(" "),n("div",{ref:"listExpand",staticClass:"md-list-expand",style:e.expandStyles},[e._t("md-expand")],2)],1)},s=[],a={render:u,staticRenderFns:s},l=a,c=n(0),d=r,f=c(i.a,l,!1,d,null,null);t.default=f.exports},105:function(e,t){},106:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(12),i=r(o),u=n(107),s=r(u),a=n(26),l=r(a);t.default={name:"MdListItemExpand",components:{MdArrowDownIcon:s.default},mixins:[l.default],data:function(){return{expandStyles:{},showContent:!1}},computed:{expandClasses:function(){return{"md-active":this.showContent}}},methods:{getChildrenSize:function(){var e=this.$refs.listExpand,t=0;return Array.from(e.children).forEach((function(e){t+=e.offsetHeight})),t},toggleExpand:function(){var e=this;(0,i.default)((function(){var t=0;e.showContent||(t="auto"),e.expandStyles={height:t},e.showContent=!e.showContent}))}}}},107:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(108),o=n.n(r),i=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},u=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("md-icon",{staticClass:"md-icon-image"},[n("svg",{attrs:{height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg"}},[n("path",{attrs:{d:"M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"}}),e._v(" "),n("path",{attrs:{d:"M0-.75h24v24H0z",fill:"none"}})])])}],s={render:i,staticRenderFns:u},a=s,l=n(0),c=l(o.a,a,!1,null,null,null);t.default=c.exports},108:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdArrowDownIcon",components:{MdIcon:o.default}}},12:function(e,t,n){(function(t){for(var r=n(15),o="undefined"==typeof window?t:window,i=["moz","webkit"],u="AnimationFrame",s=o["request"+u],a=o["cancel"+u]||o["cancelRequest"+u],l=0;!s&&l<i.length;l++)s=o[i[l]+"Request"+u],a=o[i[l]+"Cancel"+u]||o[i[l]+"CancelRequest"+u];if(!s||!a){var c=0,d=0,f=[];s=function(e){if(0===f.length){var t=r(),n=Math.max(0,1e3/60-(t-c));c=n+t,setTimeout((function(){var e=f.slice(0);f.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return f.push({handle:++d,callback:e,cancelled:!1}),d},a=function(e){for(var t=0;t<f.length;t++)f[t].handle===e&&(f[t].cancelled=!0)}}e.exports=function(e){return s.call(o,e)},e.exports.cancel=function(){a.apply(o,arguments)},e.exports.polyfill=function(e){e||(e=o),e.requestAnimationFrame=s,e.cancelAnimationFrame=a}}).call(t,n(13))},13:function(e,t){var n;n=(function(){return this})();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},14:function(e,t,n){"use strict";function r(e){n(17)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(18),i=n.n(o),u=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"md-ripple",class:e.rippleClasses,on:{"&touchstart":function(t){t.stopPropagation(),e.touchStartCheck(t)},"&touchmove":function(t){t.stopPropagation(),e.touchMoveCheck(t)},"&mousedown":function(t){t.stopPropagation(),e.startRipple(t)}}},[e._t("default"),e._v(" "),e.isDisabled?e._e():n("transition",{attrs:{name:"md-ripple"},on:{"after-enter":e.clearWave}},[e.animating?n("span",{ref:"rippleWave",staticClass:"md-ripple-wave",class:e.waveClasses,style:e.waveStyles}):e._e()])],2)},s=[],a={render:u,staticRenderFns:s},l=a,c=n(0),d=r,f=c(i.a,l,!1,d,null,null);t.default=f.exports},15:function(e,t,n){(function(t){(function(){var n,r,o,i,u,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:void 0!==t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-u)/1e6},r=t.hrtime,n=function(){var e;return e=r(),1e9*e[0]+e[1]},i=n(),s=1e9*t.uptime(),u=i-s):Date.now?(e.exports=function(){return Date.now()-o},o=Date.now()):(e.exports=function(){return(new Date).getTime()-o},o=(new Date).getTime())}).call(this)}).call(t,n(16))},16:function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function u(){h&&m&&(h=!1,m.length?p=m.concat(p):v=-1,p.length&&s())}function s(){if(!h){var e=o(u);h=!0;for(var t=p.length;t;){for(m=p,p=[];++v<t;)m&&m[v].run();v=-1,t=p.length}m=null,h=!1,i(e)}}function a(e,t){this.fun=e,this.array=t}function l(){}var c,d,f=e.exports={};!(function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}})();var m,p=[],h=!1,v=-1;f.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];p.push(new a(e,t)),1!==p.length||h||o(s)},a.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=l,f.addListener=l,f.once=l,f.off=l,f.removeListener=l,f.removeAllListeners=l,f.emit=l,f.prependListener=l,f.prependOnceListener=l,f.listeners=function(e){return[]},f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},17:function(e,t){},18:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,i){try{var u=t[o](i),s=u.value}catch(e){return void n(e)}if(!u.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}return r("next")})}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(12),s=r(u),a=n(1),l=r(a);t.default=new l.default({name:"MdRipple",props:{mdActive:[Event,Boolean],mdDisabled:Boolean,mdCentered:Boolean},data:function(){return{eventType:null,waveStyles:null,animating:!1,touchTimeout:null}},computed:{isDisabled:function(){return!this.$material.ripple||this.mdDisabled},rippleClasses:function(){return{"md-disabled":this.isDisabled}},waveClasses:function(){return{"md-centered":this.mdCentered}}},watch:{mdActive:function(e){var t="boolean"==typeof e,n="mouseevent"===e.constructor.name.toLowerCase();this.mdCentered&&t&&e?(this.startRipple({type:"mousedown"}),this.$emit("update:mdActive",!1)):n&&(this.startRipple(e),this.$emit("update:mdActive",!1))}},methods:{touchMoveCheck:function(){window.clearTimeout(this.touchTimeout)},touchStartCheck:function(e){var t=this;this.touchTimeout=window.setTimeout((function(){t.startRipple(e)}),100)},startRipple:function(e){var t=this;(0,s.default)(o(regeneratorRuntime.mark((function n(){var r,o,i,u,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.eventType,o=t.isDisabled,i=t.mdCentered,o||r&&r!==e.type){n.next=10;break}return u=t.getSize(),s=null,s=i?t.getCenteredPosition(u):t.getHitPosition(e,u),n.next=7,t.clearWave();case 7:t.eventType=e.type,t.animating=!0,t.applyStyles(s,u);case 10:case"end":return n.stop()}}),n,t)}))))},applyStyles:function(e,t){t+="px",this.waveStyles=i({},e,{width:t,height:t})},clearWave:function(){return this.waveStyles=null,this.animating=!1,this.$nextTick()},getSize:function(){var e=this.$el,t=e.offsetWidth,n=e.offsetHeight;return Math.round(Math.max(t,n))},getCenteredPosition:function(e){var t=-e/2+"px";return{"margin-top":t,"margin-left":t}},getHitPosition:function(e,t){var n=this.$el.getBoundingClientRect(),r=e.pageY,o=e.pageX;return"touchstart"===e.type&&(r=e.changedTouches[0].pageY,o=e.changedTouches[0].pageX),{top:r-n.top-t/2-document.documentElement.scrollTop+"px",left:o-n.left-t/2-document.documentElement.scrollLeft+"px"}}}})},2:function(t,n){t.exports=e},20:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=function(e,t){return r({},t,e.$options.components["router-link"].options.props)}},21:function(e,t){},22:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o),u=n(23),s=r(u);t.default=new i.default({name:"MdIcon",components:{MdSvgLoader:s.default},props:{mdSrc:String}})},23:function(e,t,n){"use strict";function r(e){n(24)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(25),i=n.n(o),u=function(){var e=this,t=e.$createElement;return(e._self._c||t)("i",{staticClass:"md-svg-loader",domProps:{innerHTML:e._s(e.html)}})},s=[],a={render:u,staticRenderFns:s},l=a,c=n(0),d=r,f=c(i.a,l,!1,d,null,null);t.default=f.exports},24:function(e,t){},25:function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,i){try{var u=t[o](i),s=u.value}catch(e){return void n(e)}if(!u.done)return Promise.resolve(s).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(s)}return r("next")})}}Object.defineProperty(t,"__esModule",{value:!0});var o={};t.default={name:"MdSVGLoader",props:{mdSrc:{type:String,required:!0}},data:function(){return{html:null,error:null}},watch:{mdSrc:function(){this.html=null,this.loadSVG()}},methods:{isSVG:function(e){return e.indexOf("svg")>=0},setHtml:(function(){function e(e){return t.apply(this,arguments)}var t=r(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o[this.mdSrc];case 2:return this.html=e.sent,e.next=5,this.$nextTick();case 5:this.$emit("md-loaded");case 6:case"end":return e.stop()}}),e,this)})));return e})(),unexpectedError:function(e){this.error="Something bad happened trying to fetch "+this.mdSrc+".",e(this.error)},loadSVG:function(){var e=this;o.hasOwnProperty(this.mdSrc)?this.setHtml():o[this.mdSrc]=new Promise(function(t,n){var r=new window.XMLHttpRequest;r.open("GET",e.mdSrc,!0),r.onload=function(){var o=r.getResponseHeader("content-type");200===r.status?e.isSVG(o)?(t(r.response),e.setHtml()):(e.error="The file "+e.mdSrc+" is not a valid SVG.",n(e.error)):r.status>=400&&r.status<500?(e.error="The file "+e.mdSrc+" do not exists.",n(e.error)):e.unexpectedError(n)},r.onerror=function(){return e.unexpectedError(n)},r.onabort=function(){return e.unexpectedError(n)},r.send()})}},mounted:function(){this.loadSVG()}}},26:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(27),i=r(o),u=n(96),s=r(u);t.default={mixins:[i.default],components:{MdListItemContent:s.default},props:{disabled:Boolean},computed:{isDisabled:function(){return!this.mdRipple||this.disabled}}}},27:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={components:{MdRipple:o.default},props:{mdRipple:{type:Boolean,default:!0}}}},28:function(e,t,n){"use strict";function r(e){n(32)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(33),i=n.n(o),u=n(0),s=r,a=u(i.a,null,!1,s,null,null);t.default=a.exports},284:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=r(o),u=n(48),s=r(u),a=n(74),l=r(a);t.default=function(e){(0,i.default)(e),e.component(s.default.name,s.default),e.component(l.default.name,l.default)}},29:function(e,t,n){"use strict";function r(e){var t=(e.keyCode,e.target);m.currentElement=t}function o(e){m.currentElement=null}function i(){d.addEventListener("keyup",r)}function u(){d.addEventListener("pointerup",o)}function s(){d.addEventListener("MSPointerUp",o)}function a(){d.addEventListener("mouseup",o),"ontouchend"in window&&d.addEventListener("touchend",o,f)}Object.defineProperty(t,"__esModule",{value:!0});var l=n(5),c=(function(e){return e&&e.__esModule?e:{default:e}})(l),d=document.body,f=!1,m=new c.default({currentElement:null});!(function(){try{var e=Object.defineProperty({},"passive",{get:function(){f={passive:!0}}});window.addEventListener("ghost",null,e)}catch(e){}})(),(function(){window.PointerEvent?u():window.MSPointerEvent?s():a(),i()})(),t.default={data:function(){return{mdHasFocus:!1}},computed:{focusedElement:function(){return m.currentElement}},watch:{focusedElement:function(e){this.mdHasFocus=e===this.$el}}}},3:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),n(7);var o=n(5),i=r(o),u=n(4),s=r(u),a=function(){var e=new i.default({ripple:!0,theming:{},locale:{startYear:1900,endYear:2099,dateFormat:"YYYY-MM-DD",days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shorterDays:["S","M","T","W","T","F","S"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],shorterMonths:["J","F","M","A","M","Ju","Ju","A","Se","O","N","D"]}});return Object.defineProperties(e.theming,{metaColors:{get:function(){return s.default.metaColors},set:function(e){s.default.metaColors=e}},theme:{get:function(){return s.default.theme},set:function(e){s.default.theme=e}},enabled:{get:function(){return s.default.enabled},set:function(e){s.default.enabled=e}}}),e};t.default=function(e){e.material||(e.material=a(),e.prototype.$material=e.material)}},32:function(e,t){},33:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(1),u=r(i),s=n(29),a=r(s),l=n(27),c=r(l),d=n(20),f=r(d),m=n(34),p=r(m);t.default=new u.default({name:"MdButton",components:{MdButtonContent:p.default},mixins:[c.default,a.default],props:{href:String,type:{type:String,default:"button"},disabled:Boolean,to:null},render:function(e){var t=e("md-button-content",{attrs:{mdRipple:this.mdRipple,disabled:this.disabled}},this.$slots.default),n={staticClass:"md-button",class:[this.$mdActiveTheme,{"md-ripple-off":!this.mdRipple,"md-focused":this.mdHasFocus}],attrs:o({},this.attrs,{href:this.href,disabled:this.disabled,type:!this.href&&(this.type||"button")}),on:this.$listeners},r="button";return this.href?r="a":this.$router&&this.to&&(this.$options.props=(0,f.default)(this,this.$options.props),r="router-link",n.props=this.$props,delete n.props.type,delete n.attrs.type,delete n.props.href,delete n.attrs.href),e(r,n,[t])}})},34:function(e,t,n){"use strict";function r(e){n(35)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(36),i=n.n(o),u=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("md-ripple",{attrs:{"md-disabled":!e.mdRipple||e.disabled}},[n("span",{staticClass:"md-button-content"},[e._t("default")],2)])},s=[],a={render:u,staticRenderFns:s},l=a,c=n(0),d=r,f=c(i.a,l,!1,d,null,null);t.default=f.exports},35:function(e,t){},36:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdButtonContent",components:{MdRipple:o.default},props:{mdRipple:Boolean,disabled:Boolean}}},4:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=(function(e){return e&&e.__esModule?e:{default:e}})(r),i=document.querySelector('[name="msapplication-TileColor"]'),u=document.querySelector('[name="theme-color"]'),s=document.querySelector('[rel="mask-icon"]');t.default=new o.default({data:function(){return{prefix:"md-theme-",theme:"default",enabled:!0,metaColors:!1,themeTarget:document.documentElement}},computed:{fullThemeName:function(){return this.getThemeName()}},watch:{enabled:{immediate:!0,handler:function(){var e=this.fullThemeName,t=this.themeTarget;this.enabled?(t.classList.add(e),this.metaColors&&this.setHtmlMetaColors(e)):(t.classList.remove(e),this.metaColors&&this.setHtmlMetaColors())}},theme:function(e,t){var n=this.getThemeName,r=this.themeTarget;e=n(e),r.classList.remove(n(t)),r.classList.add(e),this.metaColors&&this.setHtmlMetaColors(e)},metaColors:function(e){e?this.setHtmlMetaColors(this.fullThemeName):this.setHtmlMetaColors()}},methods:{getAncestorTheme:function(e){var t=this;if(e){var n=e.mdTheme;return (function e(r){if(r){var o=r.mdTheme,i=r.$parent;return o&&o!==n?o:e(i)}return t.theme})(e.$parent)}return null},getThemeName:function(e){var t=e||this.theme;return this.prefix+t},setMicrosoftColors:function(e){i&&i.setAttribute("content",e)},setThemeColors:function(e){u&&u.setAttribute("content",e)},setMaskColors:function(e){s&&s.setAttribute("color",e)},setHtmlMetaColors:function(e){var t="#fff";if(e){t=window.getComputedStyle(document.documentElement).getPropertyValue("--"+e+"-primary")}t&&(this.setMicrosoftColors(t),this.setThemeColors(t),this.setMaskColors(t))}},created:function(){var e=this;this.enabled&&this.metaColors&&window.addEventListener("load",(function(){e.setHtmlMetaColors(e.fullThemeName)}))}})},419:function(e,t,n){e.exports=n(284)},48:function(e,t,n){"use strict";function r(e){n(64)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(65),i=n.n(o),u=function(){var e=this,t=e.$createElement;return(e._self._c||t)("ul",e._g(e._b({staticClass:"md-list",class:[e.$mdActiveTheme]},"ul",e.$attrs,!1),e.$listeners),[e._t("default")],2)},s=[],a={render:u,staticRenderFns:s},l=a,c=n(0),d=r,f=c(i.a,l,!1,d,null,null);t.default=f.exports},5:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t={};return o.default.util.defineReactive(t,"reactive",e),t.reactive};var r=n(2),o=(function(e){return e&&e.__esModule?e:{default:e}})(r)},6:function(e,t,n){"use strict";function r(e){return!!e&&"object"==typeof e}function o(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||i(e)}function i(e){return e.$$typeof===m}function u(e){return Array.isArray(e)?[]:{}}function s(e,t){return t&&!1===t.clone||!d(e)?e:c(u(e),e,t)}function a(e,t,n){return e.concat(t).map((function(e){return s(e,n)}))}function l(e,t,n){var r={};return d(e)&&Object.keys(e).forEach((function(t){r[t]=s(e[t],n)})),Object.keys(t).forEach((function(o){d(t[o])&&e[o]?r[o]=c(e[o],t[o],n):r[o]=s(t[o],n)})),r}function c(e,t,n){var r=Array.isArray(t),o=Array.isArray(e),i=n||{arrayMerge:a};if(r===o)return r?(i.arrayMerge||a)(e,t,n):l(e,t,n);return s(t,n)}Object.defineProperty(t,"__esModule",{value:!0});var d=function(e){return r(e)&&!o(e)},f="function"==typeof Symbol&&Symbol.for,m=f?Symbol.for("react.element"):60103;c.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return c(e,n,t)}),{})};var p=c;t.default=p},64:function(e,t){},65:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default=new o.default({name:"MdList"})},66:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=["click","dblclick","mousedown","mouseup"]},7:function(e,t){},74:function(e,t,n){"use strict";function r(e){n(92)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(93),i=n.n(o),u=n(0),s=r,a=u(i.a,null,!1,s,null,null);t.default=a.exports},9:function(e,t,n){"use strict";function r(e){n(21)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(22),i=n.n(o),u=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.mdSrc?n("md-svg-loader",{staticClass:"md-icon md-icon-image",class:[e.$mdActiveTheme],attrs:{"md-src":e.mdSrc},on:{"md-loaded":function(t){e.$emit("md-loaded")}}}):n("i",{staticClass:"md-icon md-icon-font",class:[e.$mdActiveTheme]},[e._t("default")],2)},s=[],a={render:u,staticRenderFns:s},l=a,c=n(0),d=r,f=c(i.a,l,!1,d,null,null);t.default=f.exports},92:function(e,t){},93:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return e.hasOwnProperty("mdExpand")&&!1!==e.mdExpand}function i(e,t){if(o(e))return{"md-expand":function(){return t["md-expand"][0]}}}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(66),a=r(s),l=n(20),c=r(l),d=n(94),f=r(d),m=n(98),p=r(m),h=n(100),v=r(h),_=n(102),y=r(_),b=n(104),M=r(b),g=n(28),w=r(g);t.default={name:"MdListItem",functional:!0,components:{MdButton:w.default},render:function(e,t){var n=t.parent,r=t.props,s=t.listeners,l=t.data,d=t.slots,m=d(),h=f.default,_="md-list-item";if(o(r))h=M.default;else if(n&&n.$router&&r.to)h=y.default,h.props=(0,c.default)(n,{target:String}),delete h.props.href;else if(r.href)h=v.default;else{var b=Object.keys(s);b.forEach((function(e){a.default.includes(e)&&(h=p.default)}))}return l.staticClass&&(_+=" "+l.staticClass),e("li",u({},l,{staticClass:_,on:s}),[e(h,{props:r,scopedSlots:i(r,m),staticClass:"md-list-item-container md-button-clean"},m.default)])}}},94:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(95),o=n.n(r),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"md-list-item-default",on:{click:e.toggleControl}},[n("md-list-item-content",{attrs:{"md-disabled":""}},[e._t("default")],2)],1)},u=[],s={render:i,staticRenderFns:u},a=s,l=n(0),c=l(o.a,a,!1,null,null,null);t.default=c.exports},95:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdListItemDefault",mixins:[o.default],methods:{toggleControl:function(){var e=this.$el.querySelector(".md-checkbox-container, .md-switch-container, .md-radio-container");e&&e.click()}}}},96:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(97),o=n.n(r),i=function(){var e=this,t=e.$createElement;return(e._self._c||t)("md-ripple",{staticClass:"md-list-item-content",attrs:{"md-disabled":e.mdDisabled}},[e._t("default")],2)},u=[],s={render:i,staticRenderFns:u},a=s,l=n(0),c=l(o.a,a,!1,null,null,null);t.default=c.exports},97:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdListItemContent",components:{MdRipple:o.default},props:{mdDisabled:Boolean}}},98:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(99),o=n.n(r),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("button",{staticClass:"md-list-item-button",attrs:{type:"button",disabled:e.disabled}},[n("md-list-item-content",{attrs:{"md-disabled":e.isDisabled}},[e._t("default")],2)],1)},u=[],s={render:i,staticRenderFns:u},a=s,l=n(0),c=l(o.a,a,!1,null,null,null);t.default=c.exports},99:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26),o=(function(e){return e&&e.__esModule?e:{default:e}})(r);t.default={name:"MdListItemButton",mixins:[o.default]}}})})); |
src/Components/Column/Column.js | apiaryio/attributes-kit | import React from 'react';
import PropTypes from 'prop-types';
import Radium from 'radium';
import merge from 'lodash/merge';
@Radium
class Column extends React.Component {
static propTypes = {
style: PropTypes.object,
children: PropTypes.oneOfType([
PropTypes.object,
PropTypes.array,
]),
};
get style() {
const style = {
height: 'auto',
width: '100%',
display: 'flex',
flexDirection: 'column',
flexWrap: 'no-wrap',
justifyContent: 'flex-start',
alignItems: 'flex-start',
};
return merge(style, this.props.style);
}
render() {
return (
<div style={this.style}>
{this.props.children}
</div>
);
}
}
export default Column;
|
app/components/ErrorLine.js | kidaa/fil | import React from 'react';
export default class ErrorLine extends React.Component {
render() {
let block = "console__error-line",
error = this.props.error;
return (
<div className={block}>
<pre className={block + "__description"}>
{error}
</pre>
</div>
);
}
}
|
ajax/libs/semantic-ui-react/0.56.5/semantic-ui-react.min.js | dakshshah96/cdnjs | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.semanticUIReact=t(require("React"),require("ReactDOM")):e.semanticUIReact=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="/",t(0)}([/*!********************!*\
!*** ./src/umd.js ***!
\********************/
function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(/*! ./index */296),s=n(a);e.exports=o({},s)},/*!************************!*\
!*** external "React" ***!
\************************/
function(t,r){t.exports=e},/*!**************************!*\
!*** ./src/lib/index.js ***!
\**************************/
function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.objectDiff=t.numberToWord=t.numberToWordMap=t.keyboardKey=t.SUI=t.META=t.getElementType=t.getUnhandledProps=t.makeDebugger=t.debug=t.customPropTypes=t.useVerticalAlignProp=t.useTextAlignProp=t.useWidthProp=t.useKeyOrValueAndKey=t.useValueAndKey=t.useKeyOnly=t.childrenUtils=t.AutoControlledComponent=void 0;var a=r(/*! ./AutoControlledComponent */297);Object.defineProperty(t,"AutoControlledComponent",{enumerable:!0,get:function(){return o(a)["default"]}});var s=r(/*! ./classNameBuilders */301);Object.defineProperty(t,"useKeyOnly",{enumerable:!0,get:function(){return s.useKeyOnly}}),Object.defineProperty(t,"useValueAndKey",{enumerable:!0,get:function(){return s.useValueAndKey}}),Object.defineProperty(t,"useKeyOrValueAndKey",{enumerable:!0,get:function(){return s.useKeyOrValueAndKey}}),Object.defineProperty(t,"useWidthProp",{enumerable:!0,get:function(){return s.useWidthProp}}),Object.defineProperty(t,"useTextAlignProp",{enumerable:!0,get:function(){return s.useTextAlignProp}}),Object.defineProperty(t,"useVerticalAlignProp",{enumerable:!0,get:function(){return s.useVerticalAlignProp}});var l=r(/*! ./debug */303);Object.defineProperty(t,"debug",{enumerable:!0,get:function(){return l.debug}}),Object.defineProperty(t,"makeDebugger",{enumerable:!0,get:function(){return l.makeDebugger}});var u=r(/*! ./factories */304);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var i=r(/*! ./getUnhandledProps */306);Object.defineProperty(t,"getUnhandledProps",{enumerable:!0,get:function(){return o(i)["default"]}});var c=r(/*! ./getElementType */305);Object.defineProperty(t,"getElementType",{enumerable:!0,get:function(){return o(c)["default"]}});var p=r(/*! ./keyboardKey */307);Object.defineProperty(t,"keyboardKey",{enumerable:!0,get:function(){return o(p)["default"]}});var d=r(/*! ./numberToWord */82);Object.defineProperty(t,"numberToWordMap",{enumerable:!0,get:function(){return d.numberToWordMap}}),Object.defineProperty(t,"numberToWord",{enumerable:!0,get:function(){return d.numberToWord}});var f=r(/*! ./objectDiff */308);Object.defineProperty(t,"objectDiff",{enumerable:!0,get:function(){return f.objectDiff}});var y=r(/*! ./childrenUtils */300),m=n(y),v=r(/*! ./customPropTypes */302),h=n(v),g=r(/*! ./META */298),b=n(g),P=r(/*! ./SUI */299),T=n(P);t.childrenUtils=m,t.customPropTypes=h,t.META=b,t.SUI=T},/*!*******************************!*\
!*** ./~/classnames/index.js ***!
\*******************************/
function(e,t,r){var n,o;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n))e.push(r.apply(null,n));else if("object"===o)for(var s in n)a.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(n=[],o=function(){return r}.apply(t,n),!(void 0!==o&&(e.exports=o)))}()},/*!*****************************!*\
!*** ./~/lodash/isArray.js ***!
\*****************************/
function(e,t){var r=Array.isArray;e.exports=r},/*!************************************!*\
!*** ./~/lodash/fp/placeholder.js ***!
\************************************/
function(e,t){e.exports={}},/*!*****************************!*\
!*** ./~/lodash/without.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_baseDifference */105),o=r(/*! ./_baseRest */12),a=r(/*! ./isArrayLikeObject */38),s=o(function(e,t){return a(e)?n(e,t):[]});e.exports=s},/*!********************************!*\
!*** ./~/lodash/fp/convert.js ***!
\********************************/
function(e,t,r){function n(e,t,r){return o(a,e,t,r)}var o=r(/*! ./_baseConvert */450),a=r(/*! ./_util */452);e.exports=n},/*!**************************!*\
!*** ./~/lodash/keys.js ***!
\**************************/
function(e,t,r){function n(e){return s(e)?o(e):a(e)}var o=r(/*! ./_arrayLikeKeys */208),a=r(/*! ./_baseKeys */216),s=r(/*! ./isArrayLike */15);e.exports=n},/*!*************************!*\
!*** ./~/lodash/map.js ***!
\*************************/
function(e,t,r){function n(e,t){var r=l(e)?o:s;return r(e,a(t,3))}var o=r(/*! ./_arrayMap */18),a=r(/*! ./_baseIteratee */14),s=r(/*! ./_baseMap */354),l=r(/*! ./isArray */4);e.exports=n},/*!************************************!*\
!*** ./src/elements/Icon/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Icon */43),a=n(o);t["default"]=a["default"]},/*!***************************!*\
!*** ./~/lodash/_root.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_freeGlobal */227),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},/*!*******************************!*\
!*** ./~/lodash/_baseRest.js ***!
\*******************************/
function(e,t,r){function n(e,t){return t=a(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,s=a(r.length-t,0),l=Array(s);++n<s;)l[n]=r[t+n];n=-1;for(var u=Array(t+1);++n<t;)u[n]=r[n];return u[t]=l,o(e,this,u)}}var o=r(/*! ./_apply */29),a=Math.max;e.exports=n},/*!******************************!*\
!*** ./~/lodash/isObject.js ***!
\******************************/
function(e,t){function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseIteratee.js ***!
\***********************************/
function(e,t,r){function n(e){return"function"==typeof e?e:null==e?s:"object"==typeof e?l(e)?a(e[0],e[1]):o(e):u(e)}var o=r(/*! ./_baseMatches */355),a=r(/*! ./_baseMatchesProperty */356),s=r(/*! ./identity */123),l=r(/*! ./isArray */4),u=r(/*! ./property */481);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/isArrayLike.js ***!
\*********************************/
function(e,t,r){function n(e){return null!=e&&a(e.length)&&!o(e)}var o=r(/*! ./isFunction */24),a=r(/*! ./isLength */125);e.exports=n},/*!*******************************************!*\
!*** ./src/collections/Form/FormField.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=e.children,n=e.className,s=e.disabled,p=e.error,f=e.inline,m=e.label,v=e.required,h=e.type,g=e.width,b=(0,l["default"])((0,c.useKeyOnly)(p,"error"),(0,c.useKeyOnly)(s,"disabled"),(0,c.useKeyOnly)(f,"inline"),(0,c.useKeyOnly)(v,"required"),(0,c.useWidthProp)(g,"wide"),"field",n),P=(0,c.getUnhandledProps)(o,e),T=(0,c.getElementType)(o,e);if(!t)return m?i["default"].createElement(T,a({},P,{className:b}),i["default"].createElement("label",null,m)):i["default"].createElement(T,a({},P,{className:b}),r);var O=a({},P,{children:r,type:h});return"input"!==t||"checkbox"!==h&&"radio"!==h?t===d["default"]||t===y["default"]?i["default"].createElement(T,{className:b},(0,u.createElement)(t,a({},O,{label:m}))):t&&m?i["default"].createElement(T,{className:b},i["default"].createElement("label",null,m),(0,u.createElement)(t,O)):t&&!m?i["default"].createElement(T,{className:b},(0,u.createElement)(t,O)):void 0:i["default"].createElement(T,{className:b},i["default"].createElement("label",null,(0,u.createElement)(t,O)," ",m))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../modules/Checkbox */46),d=n(p),f=r(/*! ../../addons/Radio */71),y=n(f);o._meta={name:"FormField",parent:"Form",type:c.META.TYPES.COLLECTION,props:{width:c.SUI.WIDTHS,control:["button","input","select","textarea"]}},o.propTypes={as:c.customPropTypes.as,control:c.customPropTypes.some([u.PropTypes.func,u.PropTypes.oneOf(o._meta.props.control)]),children:u.PropTypes.node,className:u.PropTypes.string,disabled:u.PropTypes.bool,error:u.PropTypes.bool,inline:u.PropTypes.bool,label:u.PropTypes.string,required:c.customPropTypes.every([c.customPropTypes.demand(["label"]),u.PropTypes.bool]),type:c.customPropTypes.every([c.customPropTypes.demand(["control"])]),width:u.PropTypes.oneOf(o._meta.props.width)},t["default"]=o},/*!*******************************!*\
!*** ./~/lodash/toInteger.js ***!
\*******************************/
function(e,t,r){function n(e){var t=o(e),r=t%1;return t===t?r?t-r:t:0}var o=r(/*! ./toFinite */256);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_arrayMap.js ***!
\*******************************/
function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}e.exports=r},/*!****************************!*\
!*** ./~/lodash/_toKey.js ***!
\****************************/
function(e,t,r){function n(e){if("string"==typeof e||o(e))return e;var t=e+"";return"0"==t&&1/e==-a?"-0":t}var o=r(/*! ./isSymbol */39),a=1/0;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/isObjectLike.js ***!
\**********************************/
function(e,t){function r(e){return!!e&&"object"==typeof e}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_getNative.js ***!
\********************************/
function(e,t,r){function n(e,t){var r=a(e,t);return o(r)?r:void 0}var o=r(/*! ./_baseIsNative */351),a=r(/*! ./_getValue */396);e.exports=n},/*!**************************************!*\
!*** ./~/lodash/fp/_falseOptions.js ***!
\**************************************/
function(e,t){e.exports={cap:!1,curry:!1,fixed:!1,immutable:!1,rearg:!1}},/*!*************************!*\
!*** ./~/lodash/has.js ***!
\*************************/
function(e,t,r){function n(e,t){return null!=e&&a(e,t,o)}var o=r(/*! ./_baseHas */343),a=r(/*! ./_hasPath */229);e.exports=n},/*!********************************!*\
!*** ./~/lodash/isFunction.js ***!
\********************************/
function(e,t,r){function n(e){var t=o(e)?u.call(e):"";return t==a||t==s}var o=r(/*! ./isObject */13),a="[object Function]",s="[object GeneratorFunction]",l=Object.prototype,u=l.toString;e.exports=n},/*!******************************!*\
!*** ./~/lodash/toString.js ***!
\******************************/
function(e,t,r){function n(e){return null==e?"":o(e)}var o=r(/*! ./_baseToString */220);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_baseEach.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./_baseForOwn */106),o=r(/*! ./_createBaseEach */377),a=o(n);e.exports=a},/*!**********************************!*\
!*** ./~/lodash/_baseFlatten.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,s,l){var u=-1,i=e.length;for(r||(r=a),l||(l=[]);++u<i;){var c=e[u];t>0&&r(c)?t>1?n(c,t-1,r,s,l):o(l,c):s||(l[l.length]=c)}return l}var o=r(/*! ./_arrayPush */52),a=r(/*! ./_isFlattenable */408);e.exports=n},/*!*************************************!*\
!*** ./src/elements/Image/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Image */159),a=n(o);t["default"]=a["default"]},/*!****************************!*\
!*** ./~/lodash/_apply.js ***!
\****************************/
function(e,t){function r(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_arrayEach.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_baseCreate.js ***!
\*********************************/
function(e,t,r){function n(e){return o(e)?a(e):{}}var o=r(/*! ./isObject */13),a=Object.create;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_createWrap.js ***!
\*********************************/
function(e,t,r){function n(e,t,r,n,O,_,E,j){var w=t&v;if(!w&&"function"!=typeof e)throw new TypeError(y);var M=n?n.length:0;if(M||(t&=~(b|P),n=O=void 0),E=void 0===E?E:T(f(E),0),j=void 0===j?j:f(j),M-=O?O.length:0,t&P){var S=n,x=O;n=O=void 0}var A=w?void 0:i(e),N=[e,t,r,n,O,S,x,_,E,j];if(A&&c(N,A),e=N[0],t=N[1],r=N[2],n=N[3],O=N[4],j=N[9]=null==N[9]?w?0:e.length:T(N[9]-M,0),!j&&t&(h|g)&&(t&=~(h|g)),t&&t!=m)k=t==h||t==g?s(e,t,j):t!=b&&t!=(m|b)||O.length?l.apply(void 0,N):u(e,t,r,n);else var k=a(e,t,r);var C=A?o:p;return d(C(k,N),e,t)}var o=r(/*! ./_baseSetData */218),a=r(/*! ./_createBind */379),s=r(/*! ./_createCurry */382),l=r(/*! ./_createHybrid */224),u=r(/*! ./_createPartial */385),i=r(/*! ./_getData */116),c=r(/*! ./_mergeData */421),p=r(/*! ./_setData */237),d=r(/*! ./_setWrapToString */238),f=r(/*! ./toInteger */17),y="Expected a function",m=1,v=2,h=8,g=16,b=32,P=64,T=Math.max;e.exports=n},/*!****************************!*\
!*** ./~/lodash/_isKey.js ***!
\****************************/
function(e,t,r){function n(e,t){if(o(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!a(e))||(l.test(e)||!s.test(e)||null!=t&&e in Object(t))}var o=r(/*! ./isArray */4),a=r(/*! ./isSymbol */39),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_isPrototype.js ***!
\**********************************/
function(e,t){function r(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||n;return e===r}var n=Object.prototype;e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_replaceHolders.js ***!
\*************************************/
function(e,t){function r(e,t){for(var r=-1,o=e.length,a=0,s=[];++r<o;){var l=e[r];l!==t&&l!==n||(e[r]=n,s[a++]=r)}return s}var n="__lodash_placeholder__";e.exports=r},/*!************************!*\
!*** ./~/lodash/eq.js ***!
\************************/
function(e,t){function r(e,t){return e===t||e!==e&&t!==t}e.exports=r},/*!*************************!*\
!*** ./~/lodash/get.js ***!
\*************************/
function(e,t,r){function n(e,t,r){var n=null==e?void 0:o(e,t);return void 0===n?r:n}var o=r(/*! ./_baseGet */107);e.exports=n},/*!***************************************!*\
!*** ./~/lodash/isArrayLikeObject.js ***!
\***************************************/
function(e,t,r){function n(e){return a(e)&&o(e)}var o=r(/*! ./isArrayLike */15),a=r(/*! ./isObjectLike */20);e.exports=n},/*!******************************!*\
!*** ./~/lodash/isSymbol.js ***!
\******************************/
function(e,t,r){function n(e){return"symbol"==typeof e||o(e)&&l.call(e)==a}var o=r(/*! ./isObjectLike */20),a="[object Symbol]",s=Object.prototype,l=s.toString;e.exports=n},/*!**************************!*\
!*** ./~/lodash/omit.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_arrayMap */18),o=r(/*! ./_baseDifference */105),a=r(/*! ./_baseFlatten */27),s=r(/*! ./_basePick */217),l=r(/*! ./_baseRest */12),u=r(/*! ./_getAllKeysIn */393),i=r(/*! ./_toKey */19),c=l(function(e,t){return null==e?{}:(t=n(a(t,1),i),s(e,o(u(e),t)))});e.exports=c},/*!**************************!*\
!*** ./~/lodash/pick.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_arrayMap */18),o=r(/*! ./_baseFlatten */27),a=r(/*! ./_basePick */217),s=r(/*! ./_baseRest */12),l=r(/*! ./_toKey */19),u=s(function(e,t){return null==e?{}:a(e,n(o(t,1),l))});e.exports=u},/*!********************************************!*\
!*** ./src/collections/Table/TableCell.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.children,n=e.className,s=e.collapsing,u=e.content,p=e.disabled,f=e.error,y=e.icon,m=e.negative,v=e.positive,h=e.singleLine,g=e.textAlign,b=e.verticalAlign,P=e.warning,T=e.width,O=(0,l["default"])((0,c.useKeyOnly)(t,"active"),(0,c.useKeyOnly)(s,"collapsing"),(0,c.useKeyOnly)(p,"disabled"),(0,c.useKeyOnly)(f,"error"),(0,c.useKeyOnly)(m,"negative"),(0,c.useKeyOnly)(v,"positive"),(0,c.useKeyOnly)(h,"single line"),(0,c.useKeyOnly)(P,"warning"),(0,c.useTextAlignProp)(g),(0,c.useVerticalAlignProp)(b),(0,c.useWidthProp)(T,"wide"),n),_=(0,c.getUnhandledProps)(o,e),E=(0,c.getElementType)(o,e);return r?i["default"].createElement(E,a({},_,{className:O}),r):i["default"].createElement(E,a({},_,{className:O}),d["default"].create(y),u)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */10),d=n(p);o._meta={name:"TableCell",type:c.META.TYPES.COLLECTION,parent:"Table",props:{textAlign:c.SUI.TEXT_ALIGNMENTS,verticalAlign:c.SUI.VERTICAL_ALIGNMENTS,width:c.SUI.WIDTHS}},o.defaultProps={as:"td"},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,collapsing:u.PropTypes.bool,content:c.customPropTypes.contentShorthand,disabled:u.PropTypes.bool,error:u.PropTypes.bool,icon:c.customPropTypes.itemShorthand,negative:u.PropTypes.bool,positive:u.PropTypes.bool,singleLine:u.PropTypes.bool,textAlign:u.PropTypes.oneOf(o._meta.props.textAlign),verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign),warning:u.PropTypes.bool,width:u.PropTypes.oneOf(o._meta.props.width)},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t["default"]=o},/*!***********************************!*\
!*** ./src/elements/Icon/Icon.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.bordered,r=e.className,n=e.circular,s=e.color,u=e.corner,p=e.disabled,d=e.fitted,f=e.flipped,y=e.inverted,m=e.link,v=e.loading,h=e.name,g=e.rotated,b=e.size,P=(0,l["default"])(b,s,(0,c.useKeyOnly)(t,"bordered"),(0,c.useKeyOnly)(n,"circular"),(0,c.useKeyOnly)(u,"corner"),(0,c.useKeyOnly)(p,"disabled"),(0,c.useKeyOnly)(d,"fitted"),(0,c.useValueAndKey)(f,"flipped"),(0,c.useKeyOnly)(y,"inverted"),(0,c.useKeyOnly)(m,"link"),(0,c.useKeyOnly)(v,"loading"),(0,c.useValueAndKey)(g,"rotated"),h,r,"icon"),T=(0,c.getUnhandledProps)(o,e),O=(0,c.getElementType)(o,e);return i["default"].createElement(O,a({},T,{className:P}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./IconGroup */158),d=n(p);o.Group=d["default"],o._meta={name:"Icon",type:c.META.TYPES.ELEMENT,props:{color:c.SUI.COLORS,flipped:["horizontally","vertically"],name:c.SUI.ICONS,rotated:["clockwise","counterclockwise"],size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,bordered:u.PropTypes.bool,className:u.PropTypes.string,circular:u.PropTypes.bool,color:u.PropTypes.oneOf(o._meta.props.color),corner:u.PropTypes.bool,disabled:u.PropTypes.bool,fitted:u.PropTypes.bool,flipped:u.PropTypes.oneOf(o._meta.props.flipped),inverted:u.PropTypes.bool,name:u.PropTypes.string,link:u.PropTypes.bool,loading:u.PropTypes.bool,rotated:u.PropTypes.oneOf(o._meta.props.rotated),size:u.PropTypes.oneOf(o._meta.props.size)},o.defaultProps={as:"i"},o.create=(0,c.createShorthandFactory)(o,function(e){return{name:e}}),t["default"]=o},/*!**********************************************!*\
!*** ./src/elements/List/ListDescription.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ListDescription",parent:"List",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t["default"]=o},/*!*****************************************!*\
!*** ./src/elements/List/ListHeader.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ListHeader",parent:"List",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t["default"]=o},/*!***************************************!*\
!*** ./src/modules/Checkbox/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Checkbox */310),a=n(o);t["default"]=a["default"]},/*!************************************!*\
!*** ./src/views/Feed/FeedDate.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"date"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"FeedDate",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!********************************!*\
!*** ./~/lodash/_ListCache.js ***!
\********************************/
function(e,t,r){function n(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var o=r(/*! ./_listCacheClear */411),a=r(/*! ./_listCacheDelete */412),s=r(/*! ./_listCacheGet */413),l=r(/*! ./_listCacheHas */414),u=r(/*! ./_listCacheSet */415);n.prototype.clear=o,n.prototype["delete"]=a,n.prototype.get=s,n.prototype.has=l,n.prototype.set=u,e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_SetCache.js ***!
\*******************************/
function(e,t,r){function n(e){var t=-1,r=e?e.length:0;for(this.__data__=new o;++t<r;)this.add(e[t])}var o=r(/*! ./_MapCache */101),a=r(/*! ./_setCacheAdd */427),s=r(/*! ./_setCacheHas */428);n.prototype.add=n.prototype.push=a,n.prototype.has=s,e.exports=n},/*!*****************************!*\
!*** ./~/lodash/_Symbol.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_root */11),o=n.Symbol;e.exports=o},/*!************************************!*\
!*** ./~/lodash/_arrayIncludes.js ***!
\************************************/
function(e,t,r){function n(e,t){var r=e?e.length:0;return!!r&&o(e,t,0)>-1}var o=r(/*! ./_baseIndexOf */215);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_arrayPush.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_arrayReduce.js ***!
\**********************************/
function(e,t){function r(e,t,r,n){var o=-1,a=e?e.length:0;for(n&&a&&(r=e[++o]);++o<a;)r=t(r,e[o],o,e);return r}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_assocIndexOf.js ***!
\***********************************/
function(e,t,r){function n(e,t){for(var r=e.length;r--;)if(o(e[r][0],t))return r;return-1}var o=r(/*! ./eq */36);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_copyArray.js ***!
\********************************/
function(e,t){function r(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_createCtor.js ***!
\*********************************/
function(e,t,r){function n(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=o(e.prototype),n=e.apply(r,t);return a(n)?n:r}}var o=r(/*! ./_baseCreate */31),a=r(/*! ./isObject */13);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_getHolder.js ***!
\********************************/
function(e,t){function r(e){var t=e;return t.placeholder}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_getMapData.js ***!
\*********************************/
function(e,t,r){function n(e,t){var r=e.__data__;return o(t)?r["string"==typeof t?"string":"hash"]:r.map}var o=r(/*! ./_isKeyable */409);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getPrototype.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_overArg */120),o=n(Object.getPrototypeOf,Object);e.exports=o},/*!***********************************!*\
!*** ./~/lodash/_isHostObject.js ***!
\***********************************/
function(e,t){function r(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_isIndex.js ***!
\******************************/
function(e,t){function r(e,t){return t=null==t?n:t,!!t&&("number"==typeof e||o.test(e))&&e>-1&&e%1==0&&e<t}var n=9007199254740991,o=/^(?:0|[1-9]\d*)$/;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_nativeCreate.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=n(Object,"create");e.exports=o},/*!*********************************!*\
!*** ./~/lodash/_setToArray.js ***!
\*********************************/
function(e,t){function r(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}e.exports=r},/*!**************************!*\
!*** ./~/lodash/each.js ***!
\**************************/
function(e,t,r){e.exports=r(/*! ./forEach */449)},/*!******************************!*\
!*** ./~/lodash/includes.js ***!
\******************************/
function(e,t,r){function n(e,t,r,n){e=a(e)?e:u(e),r=r&&!n?l(r):0;var c=e.length;return r<0&&(r=i(c+r,0)),s(e)?r<=c&&e.indexOf(t,r)>-1:!!c&&o(e,t,r)>-1}var o=r(/*! ./_baseIndexOf */215),a=r(/*! ./isArrayLike */15),s=r(/*! ./isString */249),l=r(/*! ./toInteger */17),u=r(/*! ./values */127),i=Math.max;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/isArguments.js ***!
\*********************************/
function(e,t,r){function n(e){return o(e)&&l.call(e,"callee")&&(!i.call(e,"callee")||u.call(e)==a)}var o=r(/*! ./isArrayLikeObject */38),a="[object Arguments]",s=Object.prototype,l=s.hasOwnProperty,u=s.toString,i=s.propertyIsEnumerable;e.exports=n},/*!*****************************!*\
!*** ./~/lodash/isEqual.js ***!
\*****************************/
function(e,t,r){function n(e,t){return o(e,t)}var o=r(/*! ./_baseIsEqual */108);e.exports=n},/*!******************************!*\
!*** ./~/lodash/toNumber.js ***!
\******************************/
function(e,t,r){function n(e){if("number"==typeof e)return e;if(a(e))return s;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=i.test(e);return r||c.test(e)?p(e.slice(2),r?2:8):u.test(e)?s:+e}var o=r(/*! ./isObject */13),a=r(/*! ./isSymbol */39),s=NaN,l=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,p=parseInt;e.exports=n},/*!**************************************************!*\
!*** ./~/node-libs-browser/~/process/browser.js ***!
\**************************************************/
function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(p===clearTimeout)return clearTimeout(e);if((p===n||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function s(){m&&f&&(m=!1,f.length?y=f.concat(y):v=-1,y.length&&l())}function l(){if(!m){var e=o(s);m=!0;for(var t=y.length;t;){for(f=y,y=[];++v<t;)f&&f[v].run();v=-1,t=y.length}f=null,m=!1,a(e)}}function u(e,t){this.fun=e,this.array=t}function i(){}var c,p,d=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(e){c=r}try{p="function"==typeof clearTimeout?clearTimeout:n}catch(e){p=n}}();var f,y=[],m=!1,v=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new u(e,t)),1!==y.length||m||o(l)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=i,d.addListener=i,d.once=i,d.off=i,d.removeListener=i,d.removeAllListeners=i,d.emit=i,d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},/*!************************************!*\
!*** ./src/addons/Portal/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Portal */262),a=n(o);t["default"]=a["default"]},/*!***********************************!*\
!*** ./src/addons/Radio/index.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Radio */263),a=n(o);t["default"]=a["default"]},/*!************************************************!*\
!*** ./src/collections/Message/MessageItem.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,l["default"])("content",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MessageItem",parent:"Message",type:c.META.TYPES.COLLECTION},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},o.defaultProps={as:"li"},t["default"]=o},/*!**********************************************!*\
!*** ./src/collections/Table/TableHeader.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.fullWidth,s=(0,l["default"])((0,c.useKeyOnly)(n,"full-width"),r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"TableHeader",type:c.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"thead"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,fullWidth:u.PropTypes.bool},t["default"]=o},/*!**************************************!*\
!*** ./src/elements/Button/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Button */152),a=n(o);t["default"]=a["default"]},/*!*************************************!*\
!*** ./src/elements/Input/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Input */286),a=n(o);t["default"]=a["default"]},/*!*************************************!*\
!*** ./src/elements/Label/Label.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../Icon/Icon */43),m=n(y),v=r(/*! ../Image/Image */159),h=n(v),g=r(/*! ./LabelDetail */161),b=n(g),P=r(/*! ./LabelGroup */162),T=n(P),O={name:"Label",type:f.META.TYPES.ELEMENT,props:{attached:["top","bottom","top right","top left","bottom left","bottom right"],color:f.SUI.COLORS,corner:["left","right"],pointing:["above","below","left","right"],ribbon:["right"],size:f.SUI.SIZES}},_=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e,n.props)},n.handleRemove=function(e){var t=n.props.onRemove;t&&t(e,n.props)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.attached,n=e.basic,o=e.children,a=e.circular,s=e.className,u=e.color,i=e.content,p=e.corner,y=e.detail,v=e.empty,g=e.floating,P=e.horizontal,T=e.icon,O=e.image,_=e.onRemove,E=e.pointing,j=e.removable,w=e.ribbon,M=e.size,S=e.tag,x=E===!0&&"pointing"||("left"===E||"right"===E)&&E+" pointing"||("above"===E||"below"===E)&&"pointing "+E,A=(0,c["default"])("ui",u,x,M,(0,f.useKeyOnly)(n,"basic"),(0,f.useKeyOnly)(a,"circular"),(0,f.useKeyOnly)(v,"empty"),(0,f.useKeyOnly)(g,"floating"),(0,f.useKeyOnly)(P,"horizontal"),(0,f.useKeyOnly)(O===!0,"image"),(0,f.useKeyOnly)(S,"tag"),(0,f.useKeyOrValueAndKey)(p,"corner"),(0,f.useKeyOrValueAndKey)(w,"ribbon"),(0,f.useValueAndKey)(r,"attached"),"label",s),N=(0,f.getUnhandledProps)(t,this.props),k=(0,f.getElementType)(t,this.props);return o?d["default"].createElement(k,l({},N,{className:A,onClick:this.handleClick}),o):d["default"].createElement(k,l({className:A,onClick:this.handleClick},N),m["default"].create(T),"boolean"!=typeof O&&h["default"].create(O),i,(0,f.createShorthand)(b["default"],function(e){return{content:e}},y),(j||_)&&d["default"].createElement(m["default"],{name:"delete",onClick:this.handleRemove}))}}]),t}(p.Component);_.propTypes={as:f.customPropTypes.as,attached:p.PropTypes.oneOf(O.props.attached),basic:p.PropTypes.bool,children:p.PropTypes.node,circular:p.PropTypes.bool,className:p.PropTypes.string,color:p.PropTypes.oneOf(O.props.color),content:f.customPropTypes.contentShorthand,corner:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.oneOf(O.props.corner)]),detail:f.customPropTypes.itemShorthand,empty:f.customPropTypes.every([f.customPropTypes.demand(["circular"]),p.PropTypes.bool]),floating:p.PropTypes.bool,horizontal:p.PropTypes.bool,icon:f.customPropTypes.itemShorthand,image:p.PropTypes.oneOfType([p.PropTypes.bool,f.customPropTypes.itemShorthand]),pointing:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.oneOf(O.props.pointing)]),onClick:p.PropTypes.func,onRemove:p.PropTypes.func,removable:p.PropTypes.bool,ribbon:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.oneOf(O.props.ribbon)]),size:p.PropTypes.oneOf(O.props.size),tag:p.PropTypes.bool},_._meta=O,_.Detail=b["default"],_.Group=T["default"],t["default"]=_,_.create=(0,f.createShorthandFactory)(_,function(e){return{content:e}})},/*!*************************************!*\
!*** ./src/elements/Label/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Label */76),a=n(o);t["default"]=a["default"]},/*!******************************************!*\
!*** ./src/elements/List/ListContent.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.description,u=e.floated,p=e.header,f=e.verticalAlign,m=(0,l["default"])((0,c.useValueAndKey)(u,"floated"),(0,c.useVerticalAlignProp)(f),"content",r),v=(0,c.getUnhandledProps)(o,e),h=(0,c.getElementType)(o,e);return t?i["default"].createElement(h,a({},v,{className:m}),t):i["default"].createElement(h,a({},v,{className:m}),y["default"].create(p),d["default"].create(s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./ListDescription */44),d=n(p),f=r(/*! ./ListHeader */45),y=n(f);o._meta={name:"ListContent",parent:"List",type:c.META.TYPES.ELEMENT,props:{floated:c.SUI.FLOATS,verticalAlign:c.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,description:c.customPropTypes.itemShorthand,floated:u.PropTypes.oneOf(o._meta.props.floated),header:c.customPropTypes.itemShorthand,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign)},o.create=(0,c.createShorthandFactory)(o,function(e){return{content:e}}),t["default"]=o},/*!***************************************!*\
!*** ./src/elements/List/ListIcon.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.verticalAlign,n=(0,l["default"])((0,c.useVerticalAlignProp)(r),t),s=(0,c.getUnhandledProps)(o,e);return i["default"].createElement(d["default"],a({},s,{className:n}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../Icon/Icon */43),d=n(p);o._meta={name:"ListIcon",parent:"List",type:c.META.TYPES.ELEMENT,props:{verticalAlign:c.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={className:u.PropTypes.string,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign)},o.create=(0,c.createShorthandFactory)(o,function(e){return{name:e}}),t["default"]=o},/*!**********************************************!*\
!*** ./src/elements/Step/StepDescription.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.description,s=(0,l["default"])(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StepDescription",parent:"Step",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,children:u.PropTypes.node,description:c.customPropTypes.contentShorthand},t["default"]=o},/*!****************************************!*\
!*** ./src/elements/Step/StepTitle.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.title,s=(0,l["default"])(r,"title"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StepTitle",parent:"Step",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,children:u.PropTypes.node,title:c.customPropTypes.contentShorthand},t["default"]=o},/*!*********************************!*\
!*** ./src/lib/numberToWord.js ***!
\*********************************/
function(e,t){"use strict";function r(e){var t="undefined"==typeof e?"undefined":n(e);return"string"===t||"number"===t?o[e]||e:""}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t.numberToWord=r;var o=t.numberToWordMap={1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine",10:"ten",11:"eleven",12:"twelve",13:"thirteen",14:"fourteen",15:"fifteen",16:"sixteen"}},/*!***************************************!*\
!*** ./src/modules/Dropdown/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Dropdown */311),a=n(o);t["default"]=a["default"]},/*!*******************************************!*\
!*** ./src/views/Card/CardDescription.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CardDescription",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!**************************************!*\
!*** ./src/views/Card/CardHeader.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CardHeader",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!************************************!*\
!*** ./src/views/Card/CardMeta.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"meta"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CardMeta",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!***************************************!*\
!*** ./src/views/Feed/FeedContent.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.extraImages,u=e.extraText,p=e.date,f=e.meta,m=e.summary,h=(0,l["default"])(r,"content"),b=(0,c.getUnhandledProps)(o,e),P=(0,c.getElementType)(o,e);return t?i["default"].createElement(P,a({},b,{className:h}),t):i["default"].createElement(P,a({},b,{className:h}),(0,c.createShorthand)(d["default"],function(e){return{content:e}},p),(0,c.createShorthand)(g["default"],function(e){return{content:e}},m),n,(0,c.createShorthand)(y["default"],function(e){return{text:!0,content:e}},u),(0,c.createShorthand)(y["default"],function(e){return{images:e}},s),(0,c.createShorthand)(v["default"],function(e){return{content:e}},f))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedDate */47),d=n(p),f=r(/*! ./FeedExtra */88),y=n(f),m=r(/*! ./FeedMeta */91),v=n(m),h=r(/*! ./FeedSummary */92),g=n(h);o._meta={name:"FeedContent",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,date:c.customPropTypes.itemShorthand,extraImages:y["default"].propTypes.images,extraText:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand,summary:c.customPropTypes.itemShorthand},t["default"]=o},/*!*************************************!*\
!*** ./src/views/Feed/FeedExtra.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,a=e.images,u=e.text,c=(0,i["default"])(r,(0,d.useKeyOnly)(a,"images"),(0,d.useKeyOnly)(n||u,"text"),"extra"),f=(0,d.getUnhandledProps)(o,e),y=(0,d.getElementType)(o,e);if(t)return p["default"].createElement(y,l({},f,{className:c}),t);var m=(0,s["default"])(a,function(e,t){var r=[t,e].join("-");return(0,d.createHTMLImage)(e,{key:r})});return p["default"].createElement(y,l({},f,{className:c}),n,m)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2);o._meta={name:"FeedExtra",parent:"Feed",type:d.META.TYPES.VIEW},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,content:d.customPropTypes.contentShorthand,images:d.customPropTypes.every([d.customPropTypes.disallow(["text"]),c.PropTypes.oneOfType([c.PropTypes.bool,d.customPropTypes.collectionShorthand])]),text:c.PropTypes.bool},t["default"]=o},/*!*************************************!*\
!*** ./src/views/Feed/FeedLabel.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.icon,u=e.image,p=(0,l["default"])(r,"label"),f=(0,c.getUnhandledProps)(o,e),y=(0,c.getElementType)(o,e);return t?i["default"].createElement(y,a({},f,{className:p}),t):i["default"].createElement(y,a({},f,{className:p}),n,d["default"].create(s),(0,c.createHTMLImage)(u))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */10),d=n(p);o._meta={name:"FeedLabel",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand,image:c.customPropTypes.itemShorthand},t["default"]=o},/*!************************************!*\
!*** ./src/views/Feed/FeedLike.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.icon,u=(0,l["default"])(r,"like"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?i["default"].createElement(f,a({},p,{className:u}),t):i["default"].createElement(f,a({},p,{className:u}),d["default"].create(s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */10),d=n(p);o._meta={name:"FeedLike",parent:"Feed",type:c.META.TYPES.VIEW},o.defaultProps={as:"a"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand},t["default"]=o},/*!************************************!*\
!*** ./src/views/Feed/FeedMeta.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.like,u=(0,l["default"])(r,"meta"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?i["default"].createElement(f,a({},p,{className:u}),t):i["default"].createElement(f,a({},p,{className:u}),(0,c.createShorthand)(d["default"],function(e){return{content:e}},s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedLike */90),d=n(p);o._meta={name:"FeedMeta",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,like:c.customPropTypes.itemShorthand},t["default"]=o},/*!***************************************!*\
!*** ./src/views/Feed/FeedSummary.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.date,u=e.user,p=(0,l["default"])(r,"summary"),f=(0,c.getUnhandledProps)(o,e),m=(0,c.getElementType)(o,e);return t?i["default"].createElement(m,a({},f,{className:p}),t):i["default"].createElement(m,a({},f,{className:p}),(0,c.createShorthand)(y["default"],function(e){return{content:e}},u),n,(0,c.createShorthand)(d["default"],function(e){return{content:e}},s))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedDate */47),d=n(p),f=r(/*! ./FeedUser */93),y=n(f);o._meta={name:"FeedSummary",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,date:c.customPropTypes.itemShorthand,user:c.customPropTypes.itemShorthand},t["default"]=o},/*!************************************!*\
!*** ./src/views/Feed/FeedUser.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"user"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"FeedUser",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},o.defaultProps={as:"a"},t["default"]=o},/*!*******************************************!*\
!*** ./src/views/Item/ItemDescription.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"description"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemDescription",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!*************************************!*\
!*** ./src/views/Item/ItemExtra.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"extra"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemExtra",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!**************************************!*\
!*** ./src/views/Item/ItemHeader.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemHeader",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!************************************!*\
!*** ./src/views/Item/ItemMeta.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"meta"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ItemMeta",parent:"Item",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!**********************************!*\
!*** ./~/lodash/_LazyWrapper.js ***!
\**********************************/
function(e,t,r){function n(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=s,this.__views__=[]}var o=r(/*! ./_baseCreate */31),a=r(/*! ./_baseLodash */109),s=4294967295;n.prototype=o(a.prototype),n.prototype.constructor=n,e.exports=n},/*!************************************!*\
!*** ./~/lodash/_LodashWrapper.js ***!
\************************************/
function(e,t,r){function n(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var o=r(/*! ./_baseCreate */31),a=r(/*! ./_baseLodash */109);n.prototype=o(a.prototype),n.prototype.constructor=n,e.exports=n},/*!**************************!*\
!*** ./~/lodash/_Map.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=r(/*! ./_root */11),a=n(o,"Map");e.exports=a},/*!*******************************!*\
!*** ./~/lodash/_MapCache.js ***!
\*******************************/
function(e,t,r){function n(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var o=r(/*! ./_mapCacheClear */416),a=r(/*! ./_mapCacheDelete */417),s=r(/*! ./_mapCacheGet */418),l=r(/*! ./_mapCacheHas */419),u=r(/*! ./_mapCacheSet */420);n.prototype.clear=o,n.prototype["delete"]=a,n.prototype.get=s,n.prototype.has=l,n.prototype.set=u,e.exports=n},/*!****************************!*\
!*** ./~/lodash/_Stack.js ***!
\****************************/
function(e,t,r){function n(e){this.__data__=new o(e)}var o=r(/*! ./_ListCache */48),a=r(/*! ./_stackClear */429),s=r(/*! ./_stackDelete */430),l=r(/*! ./_stackGet */431),u=r(/*! ./_stackHas */432),i=r(/*! ./_stackSet */433);n.prototype.clear=a,n.prototype["delete"]=s,n.prototype.get=l,n.prototype.has=u,n.prototype.set=i,e.exports=n},/*!****************************************!*\
!*** ./~/lodash/_arrayIncludesWith.js ***!
\****************************************/
function(e,t){function r(e,t,r){for(var n=-1,o=e?e.length:0;++n<o;)if(r(t,e[n]))return!0;return!1}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_assignValue.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){var n=e[t];s.call(e,t)&&o(n,r)&&(void 0!==r||t in e)||(e[t]=r)}var o=r(/*! ./eq */36),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_baseDifference.js ***!
\*************************************/
function(e,t,r){function n(e,t,r,n){var p=-1,d=a,f=!0,y=e.length,m=[],v=t.length;if(!y)return m;r&&(t=l(t,u(r))),n?(d=s,f=!1):t.length>=c&&(d=i,f=!1,t=new o(t));e:for(;++p<y;){var h=e[p],g=r?r(h):h;if(h=n||0!==h?h:0,f&&g===g){for(var b=v;b--;)if(t[b]===g)continue e;m.push(h)}else d(t,g,n)||m.push(h)}return m}var o=r(/*! ./_SetCache */49),a=r(/*! ./_arrayIncludes */51),s=r(/*! ./_arrayIncludesWith */103),l=r(/*! ./_arrayMap */18),u=r(/*! ./_baseUnary */111),i=r(/*! ./_cacheHas */112),c=200;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseForOwn.js ***!
\*********************************/
function(e,t,r){function n(e,t){return e&&o(e,t,a)}var o=r(/*! ./_baseFor */341),a=r(/*! ./keys */8);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_baseGet.js ***!
\******************************/
function(e,t,r){function n(e,t){t=a(t,e)?[t]:o(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[s(t[r++])];return r&&r==n?e:void 0}var o=r(/*! ./_castPath */113),a=r(/*! ./_isKey */33),s=r(/*! ./_toKey */19);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseIsEqual.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,l,u){return e===t||(null==e||null==t||!a(e)&&!s(t)?e!==e&&t!==t:o(e,t,n,r,l,u))}var o=r(/*! ./_baseIsEqualDeep */348),a=r(/*! ./isObject */13),s=r(/*! ./isObjectLike */20);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseLodash.js ***!
\*********************************/
function(e,t){function r(){}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseSlice.js ***!
\********************************/
function(e,t){function r(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseUnary.js ***!
\********************************/
function(e,t){function r(e){return function(t){return e(t)}}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_cacheHas.js ***!
\*******************************/
function(e,t){function r(e,t){return e.has(t)}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_castPath.js ***!
\*******************************/
function(e,t,r){function n(e){return o(e)?e:a(e)}var o=r(/*! ./isArray */4),a=r(/*! ./_stringToPath */239);e.exports=n},/*!***************************************!*\
!*** ./~/lodash/_cloneArrayBuffer.js ***!
\***************************************/
function(e,t,r){function n(e){var t=new e.constructor(e.byteLength);return new o(t).set(new o(e)),t}var o=r(/*! ./_Uint8Array */206);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_copyObject.js ***!
\*********************************/
function(e,t,r){function n(e,t,r,n){r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=n?n(r[l],e[l],l,r,e):void 0;o(r,l,void 0===u?e[l]:u)}return r}var o=r(/*! ./_assignValue */104);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_getData.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_metaMap */235),o=r(/*! ./noop */251),a=n?function(e){return n.get(e)}:o;e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_getSymbols.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_overArg */120),o=r(/*! ./stubArray */254),a=Object.getOwnPropertySymbols,s=a?n(a,Object):o;e.exports=s},/*!*****************************!*\
!*** ./~/lodash/_getTag.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_DataView */330),o=r(/*! ./_Map */100),a=r(/*! ./_Promise */332),s=r(/*! ./_Set */205),l=r(/*! ./_WeakMap */207),u=r(/*! ./_baseGetTag */342),i=r(/*! ./_toSource */240),c="[object Map]",p="[object Object]",d="[object Promise]",f="[object Set]",y="[object WeakMap]",m="[object DataView]",v=Object.prototype,h=v.toString,g=i(n),b=i(o),P=i(a),T=i(s),O=i(l),_=u;(n&&_(new n(new ArrayBuffer(1)))!=m||o&&_(new o)!=c||a&&_(a.resolve())!=d||s&&_(new s)!=f||l&&_(new l)!=y)&&(_=function(e){var t=h.call(e),r=t==p?e.constructor:void 0,n=r?i(r):void 0;if(n)switch(n){case g:return m;case b:return c;case P:return d;case T:return f;case O:return y}return t}),e.exports=_},/*!*************************************!*\
!*** ./~/lodash/_isIterateeCall.js ***!
\*************************************/
function(e,t,r){function n(e,t,r){if(!l(r))return!1;var n=typeof t;return!!("number"==n?a(r)&&s(t,r.length):"string"==n&&t in r)&&o(r[t],e)}var o=r(/*! ./eq */36),a=r(/*! ./isArrayLike */15),s=r(/*! ./_isIndex */61),l=r(/*! ./isObject */13);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_overArg.js ***!
\******************************/
function(e,t){function r(e,t){return function(r){return e(t(r))}}e.exports=r},/*!****************************!*\
!*** ./~/lodash/filter.js ***!
\****************************/
function(e,t,r){function n(e,t){var r=l(e)?o:a;return r(e,s(t,3))}var o=r(/*! ./_arrayFilter */336),a=r(/*! ./_baseFilter */340),s=r(/*! ./_baseIteratee */14),l=r(/*! ./isArray */4);e.exports=n},/*!**************************!*\
!*** ./~/lodash/find.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_createFind */383),o=r(/*! ./findIndex */244),a=n(o);e.exports=a},/*!******************************!*\
!*** ./~/lodash/identity.js ***!
\******************************/
function(e,t){function r(e){return e}e.exports=r},/*!*****************************!*\
!*** ./~/lodash/isEmpty.js ***!
\*****************************/
function(e,t,r){function n(e){if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||a(e)))return!e.length;var t=o(e);if(t==p||t==d)return!e.size;if(v||i(e))return!c(e).length;for(var r in e)if(y.call(e,r))return!1;return!0}var o=r(/*! ./_getTag */118),a=r(/*! ./isArguments */66),s=r(/*! ./isArray */4),l=r(/*! ./isArrayLike */15),u=r(/*! ./isBuffer */247),i=r(/*! ./_isPrototype */34),c=r(/*! ./_nativeKeys */236),p="[object Map]",d="[object Set]",f=Object.prototype,y=f.hasOwnProperty,m=f.propertyIsEnumerable,v=!m.call({valueOf:1},"valueOf");e.exports=n},/*!******************************!*\
!*** ./~/lodash/isLength.js ***!
\******************************/
function(e,t){function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}var n=9007199254740991;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/isPlainObject.js ***!
\***********************************/
function(e,t,r){function n(e){if(!s(e)||f.call(e)!=l||a(e))return!1;var t=o(e);if(null===t)return!0;var r=p.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==d}var o=r(/*! ./_getPrototype */59),a=r(/*! ./_isHostObject */60),s=r(/*! ./isObjectLike */20),l="[object Object]",u=Function.prototype,i=Object.prototype,c=u.toString,p=i.hasOwnProperty,d=c.call(Object),f=i.toString;e.exports=n},/*!****************************!*\
!*** ./~/lodash/values.js ***!
\****************************/
function(e,t,r){function n(e){return e?o(e,a(e)):[]}var o=r(/*! ./_baseValues */364),a=r(/*! ./keys */8);e.exports=n},/*!************************************!*\
!*** ./src/addons/Select/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Select */264),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/addons/TextArea/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./TextArea */265),a=n(o);t["default"]=a["default"]},/*!*********************************************************!*\
!*** ./src/collections/Breadcrumb/BreadcrumbDivider.js ***!
\*********************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.icon,n=e.className,s=(0,l["default"])(n,"divider"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return r?d["default"].create(r,a({},u,{className:s})):i["default"].createElement(p,a({},u,{className:s}),t||"/")}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */10),d=n(p);o._meta={name:"BreadcrumbDivider",type:c.META.TYPES.COLLECTION,parent:"Breadcrumb"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,icon:c.customPropTypes.itemShorthand},t["default"]=o},/*!*********************************************************!*\
!*** ./src/collections/Breadcrumb/BreadcrumbSection.js ***!
\*********************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.href,s=e.link,u=e.onClick,i=(0,c["default"])((0,f.useKeyOnly)(r,"active"),"section",o),p=(0,f.getUnhandledProps)(t,this.props),y=(0,f.getElementType)(t,this.props,function(){if(s||u)return"a"});return d["default"].createElement(y,l({},p,{className:i,href:a,onClick:this.handleClick}),n)}}]),t}(p.Component);y.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,link:f.customPropTypes.every([f.customPropTypes.disallow(["href"]),p.PropTypes.bool]),href:f.customPropTypes.every([f.customPropTypes.disallow(["link"]),p.PropTypes.string]),onClick:p.PropTypes.func},y._meta={name:"BreadcrumbSection",type:f.META.TYPES.COLLECTION,parent:"Breadcrumb"},t["default"]=y},/*!********************************************!*\
!*** ./src/collections/Form/FormButton.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../elements/Button */74),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormButton",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!**********************************************!*\
!*** ./src/collections/Form/FormCheckbox.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Checkbox */46),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormCheckbox",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!**********************************************!*\
!*** ./src/collections/Form/FormDropdown.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Dropdown */83),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormDropdown",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!*******************************************!*\
!*** ./src/collections/Form/FormGroup.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.children,r=e.className,n=e.grouped,o=e.inline,l=e.widths,i=(0,c["default"])((0,p.useWidthProp)(l,null,!0),(0,p.useKeyOnly)(o,"inline"),(0,p.useKeyOnly)(n,"grouped"),"fields",r),d=(0,p.getUnhandledProps)(a,e),f=(0,p.getElementType)(a,e);return u["default"].createElement(f,s({},d,{className:i}),t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! react */1),u=n(l),i=r(/*! classnames */3),c=n(i),p=r(/*! ../../lib */2);a._meta={name:"FormGroup",parent:"Form",type:p.META.TYPES.COLLECTION,props:{widths:[].concat(o(p.SUI.WIDTHS),["equal"])}},a.propTypes={as:p.customPropTypes.as,children:l.PropTypes.node,className:l.PropTypes.string,grouped:p.customPropTypes.every([p.customPropTypes.disallow(["inline"]),l.PropTypes.bool]),inline:p.customPropTypes.every([p.customPropTypes.disallow(["grouped"]),l.PropTypes.bool]),widths:l.PropTypes.oneOf(a._meta.props.widths)},a.defaultProps={as:"div"},t["default"]=a},/*!*******************************************!*\
!*** ./src/collections/Form/FormInput.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../elements/Input */75),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormInput",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!*******************************************!*\
!*** ./src/collections/Form/FormRadio.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../addons/Radio */71),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormRadio",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!********************************************!*\
!*** ./src/collections/Form/FormSelect.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../addons/Select */128),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormSelect",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!**********************************************!*\
!*** ./src/collections/Form/FormTextArea.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.control,r=(0,u.getUnhandledProps)(o,e),n=(0,u.getElementType)(o,e);return l["default"].createElement(n,a({},r,{control:t}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../addons/TextArea */129),c=n(i),p=r(/*! ./FormField */16),d=n(p);o._meta={name:"FormTextArea",parent:"Form",type:u.META.TYPES.COLLECTION},o.propTypes={as:u.customPropTypes.as,control:d["default"].propTypes.control},o.defaultProps={as:d["default"],control:c["default"]},t["default"]=o},/*!********************************************!*\
!*** ./src/collections/Grid/GridColumn.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.computer,s=e.color,u=e.floated,p=e.largeScreen,d=e.mobile,f=e.only,y=e.stretched,m=e.tablet,v=e.textAlign,h=e.verticalAlign,g=e.widescreen,b=e.width,P=(0,l["default"])(s,(0,c.useKeyOnly)(y,"stretched"),(0,c.useTextAlignProp)(v),(0,c.useValueAndKey)(u,"floated"),(0,c.useValueAndKey)(f,"only"),(0,c.useVerticalAlignProp)(h),(0,c.useWidthProp)(n,"wide computer"),(0,c.useWidthProp)(p,"wide large screen"),(0,c.useWidthProp)(d,"wide mobile"),(0,c.useWidthProp)(m,"wide tablet"),(0,c.useWidthProp)(g,"wide widescreen"),(0,c.useWidthProp)(b,"wide"),"column",r),T=(0,c.getUnhandledProps)(o,e),O=(0,c.getElementType)(o,e);return i["default"].createElement(O,a({},T,{className:P}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"GridColumn",parent:"Grid",type:c.META.TYPES.COLLECTION,props:{color:c.SUI.COLORS,computer:c.SUI.WIDTHS,floated:c.SUI.FLOATS,largeScreen:c.SUI.WIDTHS,mobile:c.SUI.WIDTHS,only:["computer","large screen","mobile","tablet mobile","tablet","widescreen"],tablet:c.SUI.WIDTHS,textAlign:c.SUI.TEXT_ALIGNMENTS,verticalAlign:c.SUI.VERTICAL_ALIGNMENTS,widescreen:c.SUI.WIDTHS,width:c.SUI.WIDTHS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,computer:u.PropTypes.oneOf(o._meta.props.width),color:u.PropTypes.oneOf(o._meta.props.color),floated:u.PropTypes.oneOf(o._meta.props.floated),largeScreen:u.PropTypes.oneOf(o._meta.props.width),mobile:u.PropTypes.oneOf(o._meta.props.width),only:u.PropTypes.oneOf(o._meta.props.only),stretched:u.PropTypes.bool,tablet:u.PropTypes.oneOf(o._meta.props.width),textAlign:u.PropTypes.oneOf(o._meta.props.textAlign),verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign),widescreen:u.PropTypes.oneOf(o._meta.props.width),width:u.PropTypes.oneOf(o._meta.props.width)},t["default"]=o},/*!*****************************************!*\
!*** ./src/collections/Grid/GridRow.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.centered,r=e.children,n=e.className,o=e.color,l=e.columns,i=e.divided,d=e.only,f=e.reversed,y=e.stretched,m=e.textAlign,v=e.verticalAlign,h=(0,u["default"])(o,(0,p.useKeyOnly)(t,"centered"),(0,p.useKeyOnly)(i,"divided"),(0,p.useKeyOnly)(y,"stretched"),(0,p.useTextAlignProp)(m),(0,p.useValueAndKey)(d,"only"),(0,p.useValueAndKey)(f,"reversed"),(0,p.useVerticalAlignProp)(v),(0,p.useWidthProp)(l,"column",!0),"row",n),g=(0,p.getUnhandledProps)(a,e),b=(0,p.getElementType)(a,e);return c["default"].createElement(b,s({},g,{className:h}),r)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! classnames */3),u=n(l),i=r(/*! react */1),c=n(i),p=r(/*! ../../lib */2);a._meta={name:"GridRow",parent:"Grid",type:p.META.TYPES.COLLECTION,props:{color:p.SUI.COLORS,columns:[].concat(o(p.SUI.WIDTHS),["equal"]),only:["computer","large screen","mobile","tablet mobile","tablet","widescreen"],reversed:["computer","computer vertically","mobile","mobile vertically","tablet","tablet vertically"],textAlign:p.SUI.TEXT_ALIGNMENTS,verticalAlign:p.SUI.VERTICAL_ALIGNMENTS}},a.propTypes={as:p.customPropTypes.as,centered:i.PropTypes.bool,children:i.PropTypes.node,className:i.PropTypes.string,color:i.PropTypes.oneOf(a._meta.props.color),columns:i.PropTypes.oneOf(a._meta.props.columns),divided:i.PropTypes.bool,only:i.PropTypes.oneOf(a._meta.props.only),reversed:i.PropTypes.oneOf(a._meta.props.reversed),stretched:i.PropTypes.bool,textAlign:i.PropTypes.oneOf(a._meta.props.textAlign),verticalAlign:i.PropTypes.oneOf(a._meta.props.verticalAlign)},t["default"]=a},/*!********************************************!*\
!*** ./src/collections/Menu/MenuHeader.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])(r,"header"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MenuHeader",type:c.META.TYPES.COLLECTION,parent:"Menu"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!******************************************!*\
!*** ./src/collections/Menu/MenuItem.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/startCase */485),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p=r(/*! classnames */3),d=n(p),f=r(/*! react */1),y=n(f),m=r(/*! ../../lib */2),v=r(/*! ../../elements/Icon */10),h=n(v),g={name:"MenuItem",type:m.META.TYPES.COLLECTION,parent:"Menu",props:{color:m.SUI.COLORS,fitted:["horizontally","vertically"],position:["right"]}},b=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props,r=t.index,o=t.name,a=t.onClick;a&&a(e,{name:o,index:r})},s=r,a(n,s)}return s(t,e),c(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.color,s=e.content,l=e.fitted,c=e.header,p=e.icon,f=e.link,v=e.name,g=e.onClick,b=e.position,P=(0,d["default"])(a,b,(0,m.useKeyOnly)(r,"active"),(0,m.useKeyOnly)(p===!0||p&&!(v||s),"icon"),(0,m.useKeyOnly)(c,"header"),(0,m.useKeyOnly)(f,"link"),(0,m.useKeyOrValueAndKey)(l,"fitted"),"item",o),T=(0,m.getElementType)(t,this.props,function(){if(g)return"a"}),O=(0,m.getUnhandledProps)(t,this.props);return n?y["default"].createElement(T,i({},O,{className:P,onClick:this.handleClick}),n):y["default"].createElement(T,i({},O,{className:P,onClick:this.handleClick}),h["default"].create(p),s||(0,u["default"])(v))}}]),t}(f.Component);b.propTypes={as:m.customPropTypes.as,active:f.PropTypes.bool,children:f.PropTypes.node,className:f.PropTypes.string,color:f.PropTypes.oneOf(g.props.color),content:m.customPropTypes.contentShorthand,fitted:f.PropTypes.oneOfType([f.PropTypes.bool,f.PropTypes.oneOf(g.props.fitted)]),header:f.PropTypes.bool,icon:f.PropTypes.oneOfType([f.PropTypes.bool,m.customPropTypes.itemShorthand]),index:f.PropTypes.number,link:f.PropTypes.bool,name:f.PropTypes.string,onClick:f.PropTypes.func,position:f.PropTypes.oneOf(g.props.position)},b._meta=g,t["default"]=b},/*!******************************************!*\
!*** ./src/collections/Menu/MenuMenu.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.position,s=(0,l["default"])(r,n,"menu"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MenuMenu",type:c.META.TYPES.COLLECTION,parent:"Menu",props:{position:["right"]}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,position:u.PropTypes.oneOf(o._meta.props.position)},t["default"]=o},/*!***************************************************!*\
!*** ./src/collections/Message/MessageContent.js ***!
\***************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,l["default"])("content",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MessageContent",parent:"Message",type:c.META.TYPES.COLLECTION},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!**************************************************!*\
!*** ./src/collections/Message/MessageHeader.js ***!
\**************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,l["default"])("header",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"MessageHeader",parent:"Message",type:c.META.TYPES.COLLECTION},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!************************************************!*\
!*** ./src/collections/Message/MessageList.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.items,a=(0,i["default"])("list",r),u=(0,d.getUnhandledProps)(o,e),c=(0,d.getElementType)(o,e);if(t)return p["default"].createElement(c,l({},u,{className:a}),t);var f=(0,s["default"])(n,function(e){return p["default"].createElement(y["default"],{key:e},e)});return p["default"].createElement(c,l({},u,{className:a}),f)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./MessageItem */72),y=n(f);o._meta={name:"MessageList",parent:"Message",type:d.META.TYPES.COLLECTION},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,items:c.PropTypes.arrayOf(c.PropTypes.string)},o.defaultProps={as:"ul"},t["default"]=o},/*!********************************************!*\
!*** ./src/collections/Table/TableBody.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,l["default"])(r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"TableBody",type:c.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"tbody"},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!**********************************************!*\
!*** ./src/collections/Table/TableFooter.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return s["default"].createElement(i["default"],e)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! react */1),s=n(a),l=r(/*! ../../lib */2),u=r(/*! ./TableHeader */73),i=n(u);o._meta={name:"TableFooter",type:l.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"tfoot"},t["default"]=o},/*!**************************************************!*\
!*** ./src/collections/Table/TableHeaderCell.js ***!
\**************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return s["default"].createElement(i["default"],e)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! react */1),s=n(a),l=r(/*! ../../lib */2),u=r(/*! ./TableCell */42),i=n(u);o._meta={name:"TableHeaderCell",type:l.META.TYPES.COLLECTION,parent:"Table"},o.defaultProps={as:"th"},t["default"]=o},/*!*******************************************!*\
!*** ./src/collections/Table/TableRow.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.cellAs,n=e.cells,a=e.children,u=e.className,c=e.disabled,f=e.error,m=e.negative,v=e.positive,h=e.textAlign,g=e.verticalAlign,b=e.warning,P=(0,i["default"])((0,d.useKeyOnly)(t,"active"),(0,d.useKeyOnly)(c,"disabled"),(0,d.useKeyOnly)(f,"error"),(0,d.useKeyOnly)(m,"negative"),(0,d.useKeyOnly)(v,"positive"),(0,d.useKeyOnly)(b,"warning"),(0,d.useTextAlignProp)(h),(0,d.useVerticalAlignProp)(g),u),T=(0,d.getUnhandledProps)(o,e),O=(0,d.getElementType)(o,e);return a?p["default"].createElement(O,l({},T,{className:P}),a):p["default"].createElement(O,l({},T,{className:P}),(0,s["default"])(n,function(e){return y["default"].create(e,{as:r})}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./TableCell */42),y=n(f);o._meta={name:"TableRow",type:d.META.TYPES.COLLECTION,parent:"Table",props:{textAlign:d.SUI.TEXT_ALIGNMENTS,verticalAlign:d.SUI.VERTICAL_ALIGNMENTS}},o.defaultProps={as:"tr",cellAs:"td"},o.propTypes={as:d.customPropTypes.as,active:c.PropTypes.bool,cellAs:d.customPropTypes.as,cells:d.customPropTypes.collectionShorthand,children:c.PropTypes.node,className:c.PropTypes.string,disabled:c.PropTypes.bool,error:c.PropTypes.bool,negative:c.PropTypes.bool,positive:c.PropTypes.bool,textAlign:c.PropTypes.oneOf(o._meta.props.textAlign),verticalAlign:c.PropTypes.oneOf(o._meta.props.verticalAlign),warning:c.PropTypes.bool},o.create=(0,d.createShorthandFactory)(o,function(e){return{cells:e}}),t["default"]=o},/*!***************************************!*\
!*** ./src/elements/Button/Button.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.active,r=e.animated,n=e.attached,o=e.basic,l=e.children,i=e.circular,d=e.className,y=e.color,v=e.compact,h=e.content,g=e.disabled,b=e.floated,P=e.fluid,T=e.icon,_=e.inverted,E=e.label,j=e.labelPosition,w=e.loading,M=e.negative,S=e.positive,x=e.primary,A=e.secondary,N=e.size,k=e.toggle,C=(0,u["default"])((0,p.useKeyOrValueAndKey)(j||!!E,"labeled")),I=(0,u["default"])(y,N,(0,p.useKeyOnly)(t,"active"),(0,p.useKeyOrValueAndKey)(r,"animated"),(0,p.useKeyOrValueAndKey)(n,"attached"),(0,p.useKeyOnly)(o,"basic"),(0,p.useKeyOnly)(i,"circular"),(0,p.useKeyOnly)(v,"compact"),(0,p.useKeyOnly)(g,"disabled"),(0,p.useValueAndKey)(b,"floated"),(0,p.useKeyOnly)(P,"fluid"),(0,p.useKeyOnly)(T===!0||T&&(j||!l&&!h),"icon"),(0,p.useKeyOnly)(_,"inverted"),(0,p.useKeyOnly)(w,"loading"),(0,p.useKeyOnly)(M,"negative"),(0,p.useKeyOnly)(S,"positive"),(0,p.useKeyOnly)(x,"primary"),(0,p.useKeyOnly)(A,"secondary"),(0,p.useKeyOnly)(k,"toggle")),K=(0,p.getUnhandledProps)(a,e),L=(0,p.getElementType)(a,e,function(){if(E||n)return"div"}),U="div"===L?0:void 0;if(l){var D=(0,u["default"])("ui",I,C,"button",d);return O("render children:",{classes:D}),c["default"].createElement(L,s({},K,{className:D,tabIndex:U}),l)}if(E){var R=(0,u["default"])("ui",I,"button",d),z=(0,u["default"])("ui",C,"button",d);O("render label:",{classes:R,containerClasses:z},e);var W=m["default"].create(E,{basic:!0,pointing:"left"===j?"right":"left"});return c["default"].createElement(L,s({},K,{className:z}),"left"===j&&W,c["default"].createElement("button",{className:R},f["default"].create(T)," ",h),("right"===j||!j)&&W)}if(T&&!E){var F=(0,u["default"])("ui",C,I,"button",d);return O("render icon && !label:",{classes:F}),c["default"].createElement(L,s({},K,{className:F,tabIndex:U}),f["default"].create(T)," ",h)}var V=(0,u["default"])("ui",C,I,"button",d);return O("render default:",{classes:V}),c["default"].createElement(L,s({},K,{className:V,tabIndex:U}),h)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! classnames */3),u=n(l),i=r(/*! react */1),c=n(i),p=r(/*! ../../lib */2),d=r(/*! ../Icon/Icon */43),f=n(d),y=r(/*! ../Label/Label */76),m=n(y),v=r(/*! ./ButtonContent */153),h=n(v),g=r(/*! ./ButtonGroup */154),b=n(g),P=r(/*! ./ButtonOr */155),T=n(P),O=(0,p.makeDebugger)("button");a.Content=h["default"],a.Group=b["default"],a.Or=T["default"],a._meta={name:"Button",type:p.META.TYPES.ELEMENT,props:{animated:["fade","vertical"],attached:["left","right","top","bottom"],color:[].concat(o(p.SUI.COLORS),["facebook","twitter","google plus","vk","linkedin","instagram","youtube"]),floated:p.SUI.FLOATS,labelPosition:["right","left"],size:p.SUI.SIZES}},a.propTypes={as:p.customPropTypes.as,active:i.PropTypes.bool,animated:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.animated)]),attached:i.PropTypes.oneOf(a._meta.props.attached),basic:i.PropTypes.bool,children:p.customPropTypes.every([i.PropTypes.node,p.customPropTypes.disallow(["label"]),p.customPropTypes.givenProps({icon:i.PropTypes.oneOfType([i.PropTypes.string.isRequired,i.PropTypes.object.isRequired,i.PropTypes.element.isRequired])},p.customPropTypes.disallow(["icon"]))]),circular:i.PropTypes.bool,className:i.PropTypes.string,content:p.customPropTypes.contentShorthand,color:i.PropTypes.oneOf(a._meta.props.color),compact:i.PropTypes.bool,disabled:i.PropTypes.bool,floated:i.PropTypes.oneOf(a._meta.props.floated),fluid:i.PropTypes.bool,icon:p.customPropTypes.some([i.PropTypes.bool,i.PropTypes.string,i.PropTypes.object,i.PropTypes.element]),inverted:i.PropTypes.bool,labelPosition:i.PropTypes.oneOf(a._meta.props.labelPosition),label:p.customPropTypes.some([i.PropTypes.string,i.PropTypes.object,i.PropTypes.element]),loading:i.PropTypes.bool,negative:i.PropTypes.bool,positive:i.PropTypes.bool,primary:i.PropTypes.bool,secondary:i.PropTypes.bool,toggle:i.PropTypes.bool,size:i.PropTypes.oneOf(a._meta.props.size)},a.defaultProps={as:"button"},a.create=(0,p.createShorthandFactory)(a,function(e){return{content:e}}),t["default"]=a},/*!**********************************************!*\
!*** ./src/elements/Button/ButtonContent.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.hidden,s=e.visible,u=(0,l["default"])((0,c.useKeyOnly)(s,"visible"),(0,c.useKeyOnly)(n,"hidden"),"content",r),p=(0,c.getUnhandledProps)(o,e),d=(0,c.getElementType)(o,e);return i["default"].createElement(d,a({},p,{className:u}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ButtonContent",parent:"Button",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,children:u.PropTypes.node,hidden:u.PropTypes.bool,visible:u.PropTypes.bool},t["default"]=o},/*!********************************************!*\
!*** ./src/elements/Button/ButtonGroup.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.attached,r=e.basic,n=e.children,s=e.className,u=e.color,p=e.compact,d=e.fluid,f=e.icon,y=e.inverted,m=e.labeled,v=e.negative,h=e.positive,g=e.primary,b=e.secondary,P=e.size,T=e.toggle,O=e.vertical,_=e.widths,E=(0,l["default"])("ui",P,u,(0,c.useValueAndKey)(t,"attached"),(0,c.useKeyOnly)(r,"basic"),(0,c.useKeyOnly)(p,"compact"),(0,c.useKeyOnly)(d,"fluid"),(0,c.useKeyOnly)(f,"icon"),(0,c.useKeyOnly)(y,"inverted"),(0,c.useKeyOnly)(m,"labeled"),(0,c.useKeyOnly)(v,"negative"),(0,c.useKeyOnly)(h,"positive"),(0,c.useKeyOnly)(g,"primary"),(0,c.useKeyOnly)(b,"secondary"),(0,c.useKeyOnly)(T,"toggle"),(0,c.useKeyOnly)(O,"vertical"),(0,c.useWidthProp)(_),"buttons",s),j=(0,c.getUnhandledProps)(o,e),w=(0,c.getElementType)(o,e);return i["default"].createElement(w,a({},j,{className:E}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ButtonGroup",parent:"Button",type:c.META.TYPES.ELEMENT,props:{attached:["left","right","top","bottom"],color:c.SUI.COLORS,size:c.SUI.SIZES,widths:c.SUI.WIDTHS}},o.propTypes={as:c.customPropTypes.as,attached:u.PropTypes.oneOf(o._meta.props.attached),basic:u.PropTypes.bool,className:u.PropTypes.string,children:u.PropTypes.node,color:u.PropTypes.oneOf(o._meta.props.color),compact:u.PropTypes.bool,fluid:u.PropTypes.bool,icon:u.PropTypes.bool,inverted:u.PropTypes.bool,labeled:u.PropTypes.bool,negative:u.PropTypes.bool,positive:u.PropTypes.bool,primary:u.PropTypes.bool,secondary:u.PropTypes.bool,size:u.PropTypes.oneOf(o._meta.props.size),toggle:u.PropTypes.bool,vertical:u.PropTypes.bool,widths:u.PropTypes.oneOf(o._meta.props.widths)},t["default"]=o},/*!*****************************************!*\
!*** ./src/elements/Button/ButtonOr.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=(0,l["default"])("or",t),n=(0,c.getUnhandledProps)(o,e),s=(0,c.getElementType)(o,e);return i["default"].createElement(s,a({},n,{className:r}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ButtonOr",parent:"Button",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string},t["default"]=o},/*!**********************************************!*\
!*** ./src/elements/Header/HeaderContent.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,l["default"])(r,"content"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"HeaderContent",parent:"Header",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!************************************************!*\
!*** ./src/elements/Header/HeaderSubheader.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])("sub header",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"HeaderSubheader",parent:"Header",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!****************************************!*\
!*** ./src/elements/Icon/IconGroup.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.size,s=(0,l["default"])(n,"icons",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"IconGroup",parent:"Icon",type:c.META.TYPES.ELEMENT,props:{size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,size:u.PropTypes.oneOf(o._meta.props.size)},o.defaultProps={as:"i"},t["default"]=o},/*!*************************************!*\
!*** ./src/elements/Image/Image.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.alt,r=e.avatar,n=e.bordered,s=e.centered,u=e.className,p=e.disabled,f=e.floated,y=e.fluid,m=e.height,v=e.hidden,h=e.href,g=e.inline,b=e.label,P=e.shape,T=e.size,O=e.spaced,_=e.src,E=e.verticalAlign,j=e.width,w=e.wrapped,M=e.ui,S=(0,l["default"])((0,c.useKeyOnly)(M,"ui"),T,(0,c.useVerticalAlignProp)(E,"aligned"),(0,c.useKeyOnly)(r,"avatar"),(0,c.useKeyOnly)(n,"bordered"),(0,c.useKeyOnly)(s,"centered"),(0,c.useKeyOnly)(p,"disabled"),(0,c.useValueAndKey)(f,"floated"),(0,c.useKeyOnly)(y,"fluid"),(0,c.useKeyOnly)(v,"hidden"),(0,c.useKeyOnly)(g,"inline"),(0,c.useKeyOrValueAndKey)(O,"spaced"),P,u,"image"),x=(0,c.getUnhandledProps)(o,e),A=a({className:S},x),N={src:_,alt:t,width:j,height:m},k=(0,c.getElementType)(o,e,function(){if(b||w)return"div"});return"img"===k?i["default"].createElement(k,a({},A,N)):i["default"].createElement(k,a({},A,{href:h}),d["default"].create(b),i["default"].createElement("img",N))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../Label/Label */76),d=n(p),f=r(/*! ./ImageGroup */160),y=n(f);o.Group=y["default"],o._meta={name:"Image",type:c.META.TYPES.ELEMENT,props:{verticalAlign:c.SUI.VERTICAL_ALIGNMENTS,floated:c.SUI.FLOATS,shape:["rounded","circular"],size:c.SUI.SIZES,spaced:["left","right"]}},o.propTypes={as:c.customPropTypes.as,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign),alt:u.PropTypes.string,avatar:u.PropTypes.bool,bordered:u.PropTypes.bool,centered:u.PropTypes.bool,className:u.PropTypes.string,disabled:u.PropTypes.bool,floated:u.PropTypes.oneOf(o._meta.props.floated),fluid:c.customPropTypes.every([u.PropTypes.bool,c.customPropTypes.disallow(["size"])]),hidden:u.PropTypes.bool,height:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),href:u.PropTypes.string,inline:u.PropTypes.bool,label:c.customPropTypes.itemShorthand,shape:u.PropTypes.oneOf(o._meta.props.shape),size:u.PropTypes.oneOf(o._meta.props.size),spaced:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.oneOf(o._meta.props.spaced)]),src:u.PropTypes.string,ui:u.PropTypes.bool,width:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),wrapped:c.customPropTypes.every([u.PropTypes.bool,c.customPropTypes.disallow(["href"])])},o.defaultProps={as:"img",ui:!0},o.create=(0,c.createShorthandFactory)(o,function(e){return{src:e}}),t["default"]=o},/*!******************************************!*\
!*** ./src/elements/Image/ImageGroup.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.size,s=(0,i["default"])("ui",n,r,"images"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l["default"].createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ImageGroup",parent:"Image",type:c.META.TYPES.ELEMENT,props:{size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string,size:s.PropTypes.oneOf(o._meta.props.size)},t["default"]=o},/*!*******************************************!*\
!*** ./src/elements/Label/LabelDetail.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=(0,l["default"])("detail",r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"LabelDetail",parent:"Label",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand},t["default"]=o},/*!******************************************!*\
!*** ./src/elements/Label/LabelGroup.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.circular,n=e.className,s=e.color,u=e.size,p=e.tag,d=(0,l["default"])("ui",s,u,(0,c.useKeyOnly)(r,"circular"),(0,c.useKeyOnly)(p,"tag"),"labels",n),f=(0,c.getUnhandledProps)(o,e),y=(0,c.getElementType)(o,e);return i["default"].createElement(y,a({},f,{className:d}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"LabelGroup",parent:"Label",type:c.META.TYPES.ELEMENT,props:{color:c.SUI.COLORS,size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,circular:u.PropTypes.bool,className:u.PropTypes.string,color:u.PropTypes.oneOf(o._meta.props.color),size:u.PropTypes.oneOf(o._meta.props.size),tag:u.PropTypes.bool},t["default"]=o},/*!***************************************!*\
!*** ./src/elements/List/ListItem.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.children,n=e.className,a=e.content,u=e.description,f=e.disabled,m=e.header,h=e.icon,b=e.image,T=e.value,_=(0,d.getElementType)(o,e),E=(0,i["default"])((0,d.useKeyOnly)(t,"active"),(0,d.useKeyOnly)(f,"disabled"),(0,d.useKeyOnly)("li"!==_,"item"),n),j=(0,d.getUnhandledProps)(o,e),w="li"===_?{value:T}:{"data-value":T};if(r)return p["default"].createElement(_,l({},j,{className:E},w),r);var M=O["default"].create(h),S=y["default"].create(b);if(!(0,c.isValidElement)(a)&&(0,s["default"])(a))return p["default"].createElement(_,l({},j,{className:E},w),M||S,v["default"].create(a,{header:m,description:u}));var x=P["default"].create(m),A=g["default"].create(u);return M||S?p["default"].createElement(_,l({},j,{className:E},w),M||S,(a||x||A)&&p["default"].createElement(v["default"],null,x,A,a)):p["default"].createElement(_,l({},j,{className:E},w),x,A,a)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/isPlainObject */126),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ../../elements/Image */28),y=n(f),m=r(/*! ./ListContent */78),v=n(m),h=r(/*! ./ListDescription */44),g=n(h),b=r(/*! ./ListHeader */45),P=n(b),T=r(/*! ./ListIcon */79),O=n(T);o._meta={name:"ListItem",parent:"List",type:d.META.TYPES.ELEMENT},o.propTypes={as:d.customPropTypes.as,active:c.PropTypes.bool,children:c.PropTypes.node,className:c.PropTypes.string,content:d.customPropTypes.itemShorthand,description:d.customPropTypes.itemShorthand,disabled:c.PropTypes.bool,header:d.customPropTypes.itemShorthand,icon:d.customPropTypes.every([d.customPropTypes.disallow(["image"]),d.customPropTypes.itemShorthand]),image:d.customPropTypes.every([d.customPropTypes.disallow(["icon"]),d.customPropTypes.itemShorthand]),value:c.PropTypes.string},o.create=(0,d.createShorthandFactory)(o,function(e){return{content:e}}),t["default"]=o},/*!***************************************!*\
!*** ./src/elements/List/ListList.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,c.getUnhandledProps)(o,e),s=(0,c.getElementType)(o,e),u=(0,l["default"])((0,c.useKeyOnly)("ul"!==s&&"ol"!==s,"list"),r);return i["default"].createElement(s,a({},n,{className:u}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ListList",parent:"List",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!**********************************************!*\
!*** ./src/elements/Segment/SegmentGroup.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.compact,a=e.horizontal,s=e.piled,u=e.raised,c=e.size,f=e.stacked,y=(0,i["default"])("ui",c,(0,d.useKeyOnly)(a,"horizontal"),(0,d.useKeyOnly)(n,"compact"),(0,d.useKeyOnly)(s,"piled"),(0,d.useKeyOnly)(u,"raised"),(0,d.useKeyOnly)(f,"stacked"),r,"segments"),m=(0,d.getUnhandledProps)(o,e),v=(0,d.getElementType)(o,e);return p["default"].createElement(v,l({},m,{className:y}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2);o._meta={name:"SegmentGroup",parent:"Segment",type:d.META.TYPES.ELEMENT,props:{size:(0,s["default"])(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,className:c.PropTypes.string,children:c.PropTypes.node,compact:c.PropTypes.bool,horizontal:c.PropTypes.bool,piled:c.PropTypes.bool,raised:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),stacked:c.PropTypes.bool},t["default"]=o},/*!***********************************!*\
!*** ./src/elements/Step/Step.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Icon */10),m=n(y),v=r(/*! ./StepContent */167),h=n(v),g=r(/*! ./StepDescription */80),b=n(g),P=r(/*! ./StepGroup */168),T=n(P),O=r(/*! ./StepTitle */81),_=n(O),E=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.completed,s=e.description,u=e.disabled,i=e.href,p=e.icon,y=e.link,v=e.onClick,g=e.title,b=(0,c["default"])((0,f.useKeyOnly)(r,"active"),(0,f.useKeyOnly)(a,"completed"),(0,f.useKeyOnly)(u,"disabled"),(0,f.useKeyOnly)(y,"link"),"step",o),P=(0,f.getUnhandledProps)(t,this.props),T=(0,f.getElementType)(t,this.props,function(){if(v)return"a"});return n?d["default"].createElement(T,l({},P,{className:b,href:i,onClick:this.handleClick}),n):d["default"].createElement(T,l({},P,{className:b,href:i,onClick:this.handleClick}),m["default"].create(p),d["default"].createElement(h["default"],{description:s,title:g}))}}]),t}(p.Component);E.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,className:p.PropTypes.string,children:p.PropTypes.node,completed:p.PropTypes.bool,description:f.customPropTypes.itemShorthand,disabled:p.PropTypes.bool,icon:f.customPropTypes.itemShorthand,link:p.PropTypes.bool,href:p.PropTypes.string,onClick:p.PropTypes.func,ordered:p.PropTypes.bool,title:f.customPropTypes.itemShorthand},E._meta={name:"Step",type:f.META.TYPES.ELEMENT},E.Content=h["default"],E.Description=b["default"],E.Group=T["default"],E.Title=_["default"],t["default"]=E},/*!******************************************!*\
!*** ./src/elements/Step/StepContent.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.description,s=e.title,u=(0,i["default"])(r,"content"),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?l["default"].createElement(f,a({},p,{className:u}),t):l["default"].createElement(f,a({},p,{className:u}),(0,c.createShorthand)(y["default"],function(e){return{title:e}},s),(0,c.createShorthand)(d["default"],function(e){return{description:e}},n))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./StepDescription */80),d=n(p),f=r(/*! ./StepTitle */81),y=n(f);o._meta={name:"StepContent",parent:"Step",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,className:s.PropTypes.string,children:s.PropTypes.node,description:c.customPropTypes.itemShorthand,title:c.customPropTypes.itemShorthand},t["default"]=o},/*!****************************************!*\
!*** ./src/elements/Step/StepGroup.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.fluid,a=e.items,s=e.ordered,l=e.size,c=e.stackable,d=e.vertical,m=(0,p["default"])("ui",(0,y.useKeyOnly)(n,"fluid"),(0,y.useKeyOnly)(s,"ordered"),(0,y.useValueAndKey)(c,"stackable"),(0,y.useKeyOnly)(d,"vertical"),l,r,"steps"),h=(0,y.getUnhandledProps)(o,e),g=(0,y.getElementType)(o,e);if(t)return f["default"].createElement(g,i({},h,{className:m}),t);var b=(0,u["default"])(a,function(e){var t=e.key||[e.title,e.description].join("-");return f["default"].createElement(v["default"],i({key:t},e))});return f["default"].createElement(g,i({},h,{className:m}),b)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=r(/*! lodash/map */9),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(/*! classnames */3),p=n(c),d=r(/*! react */1),f=n(d),y=r(/*! ../../lib */2),m=r(/*! ./Step */166),v=n(m);o._meta={name:"StepGroup",parent:"Step",props:{sizes:(0,s["default"])(y.SUI.SIZES,"medium"),stackable:["tablet"]},type:y.META.TYPES.ELEMENT},o.propTypes={as:y.customPropTypes.as,className:d.PropTypes.string,children:d.PropTypes.node,fluid:d.PropTypes.bool,items:y.customPropTypes.collectionShorthand,ordered:d.PropTypes.bool,size:d.PropTypes.oneOf(o._meta.props.sizes),stackable:d.PropTypes.oneOf(o._meta.props.stackable),vertical:d.PropTypes.bool},t["default"]=o},/*!***************************************************!*\
!*** ./src/modules/Accordion/AccordionContent.js ***!
\***************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.children,n=e.className,s=(0,i["default"])("content",(0,c.useKeyOnly)(t,"active"),n),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l["default"].createElement(p,a({},u,{className:s}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o.displayName="AccordionContent",o.propTypes={as:c.customPropTypes.as,active:s.PropTypes.bool,children:s.PropTypes.node,className:s.PropTypes.string},o._meta={name:"AccordionContent",type:c.META.TYPES.MODULE,parent:"Accordion"},t["default"]=o},/*!*************************************************!*\
!*** ./src/modules/Accordion/AccordionTitle.js ***!
\*************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=(0,c["default"])((0,f.useKeyOnly)(r,"active"),"title",o),s=(0,f.getUnhandledProps)(t,this.props),u=(0,f.getElementType)(t,this.props);return d["default"].createElement(u,l({},s,{className:a,onClick:this.handleClick}),n)}}]),t}(p.Component);y.displayName="AccordionTitle",y.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,onClick:p.PropTypes.func},y._meta={name:"AccordionTitle",type:f.META.TYPES.MODULE,parent:"Accordion"},t["default"]=y},/*!*************************************************!*\
!*** ./src/modules/Dropdown/DropdownDivider.js ***!
\*************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=(0,l["default"])("divider",t),n=(0,c.getUnhandledProps)(o,e),s=(0,c.getElementType)(o,e);return i["default"].createElement(s,a({},n,{className:r}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"DropdownDivider",parent:"Dropdown",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string},t["default"]=o},/*!************************************************!*\
!*** ./src/modules/Dropdown/DropdownHeader.js ***!
\************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.icon,u=(0,l["default"])("header",r),p=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return t?i["default"].createElement(f,a({},p,{className:u}),t):i["default"].createElement(f,a({},p,{className:u}),d["default"].create(s),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Icon */10),d=n(p);o._meta={name:"DropdownHeader",parent:"Dropdown",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,icon:c.customPropTypes.itemShorthand},t["default"]=o},/*!**********************************************!*\
!*** ./src/modules/Dropdown/DropdownItem.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Icon */10),m=n(y),v=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props,r=t.onClick,o=t.value;r&&r(e,o)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.children,o=e.className,a=e.disabled,s=e.description,u=e.icon,i=e.selected,p=e.text,y=(0,c["default"])((0,f.useKeyOnly)(r,"active"),(0,f.useKeyOnly)(a,"disabled"),(0,f.useKeyOnly)(i,"selected"),"item",o),v=u||f.childrenUtils.someByType(n,"DropdownMenu")&&"dropdown",h=(0,f.getUnhandledProps)(t,this.props),g=(0,f.getElementType)(t,this.props);return d["default"].createElement(g,l({},h,{className:y,onClick:this.handleClick}),(0,f.createShorthand)("span",function(e){return{className:"description",children:e}},s),m["default"].create(v),n||p)}}]),t}(p.Component);v.propTypes={as:f.customPropTypes.as,active:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,description:f.customPropTypes.itemShorthand,disabled:p.PropTypes.bool,icon:p.PropTypes.string,selected:p.PropTypes.bool,text:f.customPropTypes.contentShorthand,value:p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string]),onClick:p.PropTypes.func},v._meta={name:"DropdownItem",parent:"Dropdown",type:f.META.TYPES.MODULE},t["default"]=v},/*!**********************************************!*\
!*** ./src/modules/Dropdown/DropdownMenu.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])("menu transition",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"DropdownMenu",parent:"Dropdown",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t["default"]=o},/*!*******************************************!*\
!*** ./src/modules/Modal/ModalActions.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])(r,"actions"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalActions",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t["default"]=o},/*!*******************************************!*\
!*** ./src/modules/Modal/ModalContent.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.image,n=e.className,s=(0,i["default"])(n,(0,c.useKeyOnly)(r,"image"),"content"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return l["default"].createElement(p,a({},u,{className:s}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalContent",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string,image:s.PropTypes.bool},t["default"]=o},/*!***********************************************!*\
!*** ./src/modules/Modal/ModalDescription.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])(r,"description"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalDescription",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t["default"]=o},/*!******************************************!*\
!*** ./src/modules/Modal/ModalHeader.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])(r,"header"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"ModalHeader",type:c.META.TYPES.MODULE,parent:"Modal"},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t["default"]=o},/*!************************************!*\
!*** ./src/modules/Modal/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Modal */312),a=n(o);t["default"]=a["default"]},/*!*******************************************!*\
!*** ./src/modules/Popup/PopupContent.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])("content",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t["default"]=o;var s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o.create=(0,c.createShorthandFactory)(o,function(e){return{children:e}}),o.propTypes={children:s.PropTypes.node,className:s.PropTypes.string},o._meta={name:"PopupContent",type:c.META.TYPES.MODULE,parent:"Popup"}},/*!******************************************!*\
!*** ./src/modules/Popup/PopupHeader.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])("header",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t["default"]=o;var s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o.create=(0,c.createShorthandFactory)(o,function(e){return{children:e}}),o.propTypes={children:s.PropTypes.node,className:s.PropTypes.string},o._meta={name:"PopupHeader",type:c.META.TYPES.MODULE,parent:"Popup"}},/*!**********************************************!*\
!*** ./src/modules/Search/SearchCategory.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.children,n=e.className,s=e.renderer,u=(0,i["default"])((0,c.useKeyOnly)(t,"active"),"category",n),d=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return l["default"].createElement(f,a({},d,{className:u}),l["default"].createElement("div",{className:"name"},s?s(e):p(e)),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2),p=function(e){var t=e.name;return t};o._meta={name:"SearchCategory",parent:"Search",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,active:s.PropTypes.bool,children:s.PropTypes.node,className:s.PropTypes.string,name:s.PropTypes.string,renderer:s.PropTypes.func,results:s.PropTypes.array},t["default"]=o},/*!********************************************!*\
!*** ./src/modules/Search/SearchResult.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! react */1),c=n(i),p=r(/*! classnames */3),d=n(p),f=r(/*! ../../lib */2),y=function(e){var t=e.image,r=e.price,n=e.title,o=e.description;return[t&&c["default"].createElement("div",{key:"image",className:"image"},(0,f.createHTMLImage)(t)),c["default"].createElement("div",{key:"content",className:"content"},r&&c["default"].createElement("div",{className:"price"},r),n&&c["default"].createElement("div",{className:"title"},n),o&&c["default"].createElement("div",{className:"description"},o))]},m=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props,r=t.id,o=t.onClick;o&&o(e,r)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.active,n=e.className,o=e.renderer,a=(0,d["default"])((0,f.useKeyOnly)(r,"active"),"result",n),s=(0,f.getUnhandledProps)(t,this.props),u=(0,f.getElementType)(t,this.props);return c["default"].createElement(u,l({},s,{className:a,onClick:this.handleClick}),o?o(this.props):y(this.props))}}]),t}(i.Component);m.propTypes={as:f.customPropTypes.as,active:i.PropTypes.bool,className:i.PropTypes.string,description:i.PropTypes.string,id:i.PropTypes.number,image:i.PropTypes.string,onClick:i.PropTypes.func,price:i.PropTypes.string,renderer:i.PropTypes.func,title:i.PropTypes.string},m._meta={name:"SearchResult",parent:"Search",type:f.META.TYPES.MODULE},t["default"]=m},/*!*********************************************!*\
!*** ./src/modules/Search/SearchResults.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=(0,i["default"])("results transition",r),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return l["default"].createElement(u,a({},s,{className:n}),t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! classnames */3),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"SearchResults",parent:"Search",type:c.META.TYPES.MODULE},o.propTypes={as:c.customPropTypes.as,children:s.PropTypes.node,className:s.PropTypes.string},t["default"]=o},/*!********************************!*\
!*** ./src/views/Card/Card.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ../../elements/Image */28),m=n(y),v=r(/*! ./CardContent */186),h=n(v),g=r(/*! ./CardDescription */84),b=n(g),P=r(/*! ./CardGroup */187),T=n(P),O=r(/*! ./CardHeader */85),_=n(O),E=r(/*! ./CardMeta */86),j=n(E),w={name:"Card",type:f.META.TYPES.VIEW,props:{color:f.SUI.COLORS}},M=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props.onClick;t&&t(e)},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.centered,n=e.children,o=e.className,a=e.color,s=e.description,u=e.extra,i=e.fluid,p=e.header,y=e.href,v=e.image,g=e.meta,b=e.onClick,P=e.raised,T=(0,c["default"])("ui",a,(0,f.useKeyOnly)(r,"centered"),(0,f.useKeyOnly)(i,"fluid"),(0,f.useKeyOnly)(P,"raised"),"card",o),O=(0,f.getUnhandledProps)(t,this.props),_=(0,f.getElementType)(t,this.props,function(){if(b)return"a"});return n?d["default"].createElement(_,l({},O,{className:T,href:y,onClick:this.handleClick}),n):d["default"].createElement(_,l({},O,{className:T,href:y,onClick:this.handleClick}),m["default"].create(v),(s||p||g)&&d["default"].createElement(h["default"],{description:s,header:p,meta:g}),u&&d["default"].createElement(h["default"],{extra:!0},u))}}]),t}(p.Component);M.propTypes={as:f.customPropTypes.as,centered:p.PropTypes.bool,children:p.PropTypes.node,className:p.PropTypes.string,color:p.PropTypes.oneOf(w.props.color),description:f.customPropTypes.itemShorthand,extra:f.customPropTypes.contentShorthand,fluid:p.PropTypes.bool,header:f.customPropTypes.itemShorthand,href:p.PropTypes.string,image:f.customPropTypes.itemShorthand,meta:f.customPropTypes.itemShorthand,onClick:p.PropTypes.func,raised:p.PropTypes.bool},M._meta=w,M.Content=h["default"],M.Description=b["default"],M.Group=T["default"],M.Header=_["default"],M.Meta=j["default"],t["default"]=M},/*!***************************************!*\
!*** ./src/views/Card/CardContent.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.description,s=e.extra,u=e.header,p=e.meta,f=(0,l["default"])(r,(0,c.useKeyOnly)(s,"extra"),"content"),m=(0,c.getUnhandledProps)(o,e),h=(0,c.getElementType)(o,e);return t?i["default"].createElement(h,a({},m,{className:f}),t):i["default"].createElement(h,a({},m,{className:f}),(0,c.createShorthand)(y["default"],function(e){return{content:e}},u),(0,c.createShorthand)(v["default"],function(e){return{content:e}},p),(0,c.createShorthand)(d["default"],function(e){return{content:e}},n))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./CardDescription */84),d=n(p),f=r(/*! ./CardHeader */85),y=n(f),m=r(/*! ./CardMeta */86),v=n(m);o._meta={name:"CardContent",parent:"Card",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,description:c.customPropTypes.itemShorthand,extra:u.PropTypes.bool,header:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand},t["default"]=o},/*!*************************************!*\
!*** ./src/views/Card/CardGroup.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.doubling,a=e.items,u=e.itemsPerRow,c=e.stackable,f=(0,i["default"])("ui",(0,d.useWidthProp)(u),(0,d.useKeyOnly)(n,"doubling"),(0,d.useKeyOnly)(c,"stackable"),r,"cards"),m=(0,d.getUnhandledProps)(o,e),v=(0,d.getElementType)(o,e);if(t)return p["default"].createElement(v,l({},m,{className:f}),t);var h=(0,s["default"])(a,function(e){var t=e.key||[e.header,e.description].join("-");return p["default"].createElement(y["default"],l({key:t},e))});return p["default"].createElement(v,l({},m,{className:f}),h)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./Card */185),y=n(f);o._meta={name:"CardGroup",parent:"Card",props:{itemsPerRow:d.SUI.WIDTHS},type:d.META.TYPES.VIEW},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,doubling:c.PropTypes.bool,items:d.customPropTypes.collectionShorthand,itemsPerRow:c.PropTypes.oneOf(o._meta.props.itemsPerRow),stackable:c.PropTypes.bool},t["default"]=o},/*!********************************************!*\
!*** ./src/views/Comment/CommentAction.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.className,n=e.children,s=(0,l["default"])((0,c.useKeyOnly)(t,"active"),r),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentAction",parent:"Comment",type:c.META.TYPES.VIEW},o.defaultProps={as:"a"},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!*********************************************!*\
!*** ./src/views/Comment/CommentActions.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=(0,l["default"])("actions",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentActions",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!********************************************!*\
!*** ./src/views/Comment/CommentAuthor.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=(0,l["default"])("author",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentAuthor",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!********************************************!*\
!*** ./src/views/Comment/CommentAvatar.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.src,n=(0,l["default"])("avatar",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),(0,c.createHTMLImage)(r))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentAvatar",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,src:u.PropTypes.string},t["default"]=o},/*!*********************************************!*\
!*** ./src/views/Comment/CommentContent.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=(0,l["default"])("content",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentContent",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!*******************************************!*\
!*** ./src/views/Comment/CommentGroup.js ***!
\*******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=e.collapsed,s=e.minimal,u=e.threaded,p=(0,l["default"])("ui",(0,c.useKeyOnly)(n,"collapsed"),(0,c.useKeyOnly)(s,"minimal"),(0,c.useKeyOnly)(u,"threaded"),"comments",t),d=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return i["default"].createElement(f,a({},d,{className:p}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentGroup",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,collapsed:u.PropTypes.bool,minimal:u.PropTypes.bool,threaded:u.PropTypes.bool},t["default"]=o},/*!**********************************************!*\
!*** ./src/views/Comment/CommentMetadata.js ***!
\**********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=(0,l["default"])("metadata",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentMetadata",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!******************************************!*\
!*** ./src/views/Comment/CommentText.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=(0,l["default"])("text",t),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"CommentText",parent:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string},t["default"]=o},/*!*************************************!*\
!*** ./src/views/Feed/FeedEvent.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.content,r=e.children,n=e.className,s=e.date,u=e.extraImages,p=e.extraText,f=e.image,m=e.icon,v=e.meta,h=e.summary,g=(0,l["default"])(n,"event"),b=(0,c.getUnhandledProps)(o,e),P=(0,c.getElementType)(o,e),T=t||s||u||p||v||h,O={content:t,date:s,extraImages:u,extraText:p,meta:v,summary:h};return i["default"].createElement(P,a({},b,{className:g}),(0,c.createShorthand)(y["default"],function(e){return{icon:e}},m),(0,c.createShorthand)(y["default"],function(e){return{image:e}},f),T&&i["default"].createElement(d["default"],O),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./FeedContent */87),d=n(p),f=r(/*! ./FeedLabel */89),y=n(f);o._meta={name:"FeedEvent",parent:"Feed",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:d["default"].propTypes.content,date:d["default"].propTypes.date,extraImages:d["default"].propTypes.extraImages,extraText:d["default"].propTypes.extraText,icon:c.customPropTypes.itemShorthand,image:c.customPropTypes.itemShorthand,meta:d["default"].propTypes.meta,summary:d["default"].propTypes.summary},t["default"]=o},/*!********************************!*\
!*** ./src/views/Item/Item.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.description,u=e.extra,p=e.header,f=e.image,y=e.meta,m=(0,l["default"])(r,"item"),v=(0,c.getUnhandledProps)(o,e),h=(0,c.getElementType)(o,e);return t?i["default"].createElement(h,a({},v,{className:m}),t):i["default"].createElement(h,a({},v,{className:m}),(0,c.createShorthand)(O["default"],function(e){return{src:e}},f),i["default"].createElement(d["default"],{content:n,description:s,extra:u,header:p,meta:y}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./ItemContent */198),d=n(p),f=r(/*! ./ItemDescription */94),y=n(f),m=r(/*! ./ItemExtra */95),v=n(m),h=r(/*! ./ItemGroup */199),g=n(h),b=r(/*! ./ItemHeader */96),P=n(b),T=r(/*! ./ItemImage */200),O=n(T),_=r(/*! ./ItemMeta */97),E=n(_);o._meta={name:"Item",type:c.META.TYPES.VIEW},o.Content=d["default"],o.Description=y["default"],o.Extra=v["default"],o.Group=g["default"],o.Header=P["default"],o.Image=O["default"],o.Meta=E["default"],o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,description:c.customPropTypes.itemShorthand,extra:c.customPropTypes.itemShorthand,image:c.customPropTypes.itemShorthand,header:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand},t["default"]=o},/*!***************************************!*\
!*** ./src/views/Item/ItemContent.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,s=e.description,u=e.extra,p=e.header,f=e.meta,m=e.verticalAlign,h=(0,l["default"])(r,(0,c.useVerticalAlignProp)(m),"content"),b=(0,c.getUnhandledProps)(o,e),P=(0,c.getElementType)(o,e);return t?i["default"].createElement(P,a({},b,{className:h}),t):i["default"].createElement(P,a({},b,{className:h}),(0,c.createShorthand)(d["default"],function(e){return{content:e}},p),(0,c.createShorthand)(g["default"],function(e){return{content:e}},f),(0,c.createShorthand)(y["default"],function(e){return{content:e}},s),(0,c.createShorthand)(v["default"],function(e){return{content:e}},u),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./ItemHeader */96),d=n(p),f=r(/*! ./ItemDescription */94),y=n(f),m=r(/*! ./ItemExtra */95),v=n(m),h=r(/*! ./ItemMeta */97),g=n(h);o._meta={name:"ItemContent",parent:"Item",type:c.META.TYPES.VIEW,props:{verticalAlign:c.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,description:c.customPropTypes.itemShorthand,extra:c.customPropTypes.itemShorthand,header:c.customPropTypes.itemShorthand,meta:c.customPropTypes.itemShorthand,verticalAlign:u.PropTypes.oneOf(o._meta.props.verticalAlign)},t["default"]=o},/*!*************************************!*\
!*** ./src/views/Item/ItemGroup.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e){var t=e.children,r=e.className,n=e.divided,s=e.items,i=e.link,p=e.relaxed,y=(0,c["default"])("ui",r,(0,f.useKeyOnly)(n,"divided"),(0,f.useKeyOnly)(i,"link"),(0,f.useKeyOrValueAndKey)(p,"relaxed"),"items"),v=(0,f.getUnhandledProps)(a,e),h=(0,f.getElementType)(a,e);if(t)return d["default"].createElement(h,u({},v,{className:y}),t);var g=(0,l["default"])(s,function(e){var t=e.childKey,r=o(e,["childKey"]),n=t||[r.content,r.description,r.header,r.meta].join("-");return d["default"].createElement(m["default"],u({},r,{key:n}))});return d["default"].createElement(h,u({},v,{className:y}),g)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(/*! lodash/map */9),l=n(s),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(/*! classnames */3),c=n(i),p=r(/*! react */1),d=n(p),f=r(/*! ../../lib */2),y=r(/*! ./Item */197),m=n(y);a._meta={name:"ItemGroup",type:f.META.TYPES.VIEW,parent:"Item",props:{relaxed:["very"]}},a.propTypes={as:f.customPropTypes.as,children:p.PropTypes.node,className:p.PropTypes.string,divided:p.PropTypes.bool,items:f.customPropTypes.collectionShorthand,link:p.PropTypes.bool,relaxed:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.oneOf(a._meta.props.relaxed)])},t["default"]=a},/*!*************************************!*\
!*** ./src/views/Item/ItemImage.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return l["default"].createElement(c["default"],a({},e,{ui:!1,wrapped:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../elements/Image */28),c=n(i);o._meta={name:"ItemImage",parent:"Item",type:u.META.TYPES.VIEW},t["default"]=o},/*!******************************************!*\
!*** ./src/views/Statistic/Statistic.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.color,a=e.floated,s=e.horizontal,u=e.inverted,c=e.label,f=e.size,y=e.text,m=e.value,h=(0,i["default"])("ui",n,(0,d.useValueAndKey)(a,"floated"),(0,d.useKeyOnly)(s,"horizontal"),(0,d.useKeyOnly)(u,"inverted"),f,r,"statistic"),b=(0,d.getUnhandledProps)(o,e),P=(0,d.getElementType)(o,e);return t?p["default"].createElement(P,l({},b,{className:h}),t):p["default"].createElement(P,l({},b,{className:h}),p["default"].createElement(g["default"],{text:y,value:m}),p["default"].createElement(v["default"],{label:c}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./StatisticGroup */202),y=n(f),m=r(/*! ./StatisticLabel */203),v=n(m),h=r(/*! ./StatisticValue */204),g=n(h);o._meta={name:"Statistic",type:d.META.TYPES.VIEW,props:{color:d.SUI.COLORS,floated:d.SUI.FLOATS,size:(0,s["default"])(d.SUI.SIZES,"big","massive","medium")}},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,color:c.PropTypes.oneOf(o._meta.props.color),floated:c.PropTypes.oneOf(o._meta.props.floated),horizontal:c.PropTypes.bool,inverted:c.PropTypes.bool,label:d.customPropTypes.contentShorthand,size:c.PropTypes.oneOf(o._meta.props.size),text:c.PropTypes.bool,value:d.customPropTypes.contentShorthand},o.Group=y["default"],o.Label=v["default"],o.Value=g["default"],t["default"]=o},/*!***********************************************!*\
!*** ./src/views/Statistic/StatisticGroup.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.horizontal,a=e.items,u=e.widths,c=(0,i["default"])("ui",(0,d.useKeyOnly)(n,"horizontal"),(0,d.useWidthProp)(u),"statistics",r),f=(0,d.getUnhandledProps)(o,e),m=(0,d.getElementType)(o,e);if(t)return p["default"].createElement(m,l({},f,{className:c}),t);var v=(0,s["default"])(a,function(e){return p["default"].createElement(y["default"],l({key:e.childKey||[e.label,e.title].join("-")},e))});return p["default"].createElement(m,l({},f,{className:c}),v)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./Statistic */201),y=n(f);o._meta={name:"StatisticGroup",type:d.META.TYPES.VIEW,parent:"Statistic",props:{widths:d.SUI.WIDTHS}},o.propTypes={as:d.customPropTypes.as,children:c.PropTypes.node,className:c.PropTypes.string,horizontal:c.PropTypes.bool,items:d.customPropTypes.collectionShorthand,widths:c.PropTypes.oneOf(o._meta.props.widths)},t["default"]=o},/*!***********************************************!*\
!*** ./src/views/Statistic/StatisticLabel.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.label,s=(0,l["default"])(r,"label"),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),t||n)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StatisticLabel",parent:"Statistic",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,label:c.customPropTypes.contentShorthand},t["default"]=o},/*!***********************************************!*\
!*** ./src/views/Statistic/StatisticValue.js ***!
\***********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.text,s=e.value,u=(0,l["default"])((0,c.useKeyOnly)(n,"text"),r,"value"),p=(0,c.getUnhandledProps)(o,e),d=(0,c.getElementType)(o,e);return i["default"].createElement(d,a({},p,{className:u}),t||s)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"StatisticValue",parent:"Statistic",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,text:u.PropTypes.bool,value:c.customPropTypes.contentShorthand},t["default"]=o},/*!**************************!*\
!*** ./~/lodash/_Set.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=r(/*! ./_root */11),a=n(o,"Set");e.exports=a},/*!*********************************!*\
!*** ./~/lodash/_Uint8Array.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_root */11),o=n.Uint8Array;e.exports=o},/*!******************************!*\
!*** ./~/lodash/_WeakMap.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=r(/*! ./_root */11),a=n(o,"WeakMap");e.exports=a},/*!************************************!*\
!*** ./~/lodash/_arrayLikeKeys.js ***!
\************************************/
function(e,t,r){function n(e,t){var r=s(e)||a(e)?o(e.length,String):[],n=r.length,u=!!n;for(var c in e)!t&&!i.call(e,c)||u&&("length"==c||l(c,n))||r.push(c);return r}var o=r(/*! ./_baseTimes */219),a=r(/*! ./isArguments */66),s=r(/*! ./isArray */4),l=r(/*! ./_isIndex */61),u=Object.prototype,i=u.hasOwnProperty;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_arraySome.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_baseAssign.js ***!
\*********************************/
function(e,t,r){function n(e,t){return e&&o(t,a(t),e)}var o=r(/*! ./_copyObject */115),a=r(/*! ./keys */8);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseClamp.js ***!
\********************************/
function(e,t){function r(e,t,r){return e===e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e}e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseClone.js ***!
\********************************/
function(e,t,r){function n(e,t,r,O,_,E,j){var S;if(O&&(S=E?O(e,_,E,j):O(e)),void 0!==S)return S;if(!b(e))return e;var x=v(e);if(x){if(S=f(e),!t)return i(e,S)}else{var N=d(e),k=N==w||N==M;if(h(e))return u(e,t);if(N==A||N==T||k&&!E){if(g(e))return E?e:{};if(S=m(k?{}:e),!t)return c(e,l(S,e))}else{if(!H[N])return E?e:{};S=y(e,N,n,t)}}j||(j=new o);var C=j.get(e);if(C)return C;if(j.set(e,S),!x)var I=r?p(e):P(e);return a(I||e,function(o,a){I&&(a=o,o=e[a]),s(S,a,n(o,t,r,O,a,e,j))}),S}var o=r(/*! ./_Stack */102),a=r(/*! ./_arrayEach */30),s=r(/*! ./_assignValue */104),l=r(/*! ./_baseAssign */210),u=r(/*! ./_cloneBuffer */366),i=r(/*! ./_copyArray */55),c=r(/*! ./_copySymbols */373),p=r(/*! ./_getAllKeys */392),d=r(/*! ./_getTag */118),f=r(/*! ./_initCloneArray */404),y=r(/*! ./_initCloneByTag */405),m=r(/*! ./_initCloneObject */406),v=r(/*! ./isArray */4),h=r(/*! ./isBuffer */247),g=r(/*! ./_isHostObject */60),b=r(/*! ./isObject */13),P=r(/*! ./keys */8),T="[object Arguments]",O="[object Array]",_="[object Boolean]",E="[object Date]",j="[object Error]",w="[object Function]",M="[object GeneratorFunction]",S="[object Map]",x="[object Number]",A="[object Object]",N="[object RegExp]",k="[object Set]",C="[object String]",I="[object Symbol]",K="[object WeakMap]",L="[object ArrayBuffer]",U="[object DataView]",D="[object Float32Array]",R="[object Float64Array]",z="[object Int8Array]",W="[object Int16Array]",F="[object Int32Array]",V="[object Uint8Array]",B="[object Uint8ClampedArray]",Y="[object Uint16Array]",q="[object Uint32Array]",H={};H[T]=H[O]=H[L]=H[U]=H[_]=H[E]=H[D]=H[R]=H[z]=H[W]=H[F]=H[S]=H[x]=H[A]=H[N]=H[k]=H[C]=H[I]=H[V]=H[B]=H[Y]=H[q]=!0,H[j]=H[w]=H[K]=!1,e.exports=n},/*!************************************!*\
!*** ./~/lodash/_baseFindIndex.js ***!
\************************************/
function(e,t){function r(e,t,r,n){for(var o=e.length,a=r+(n?1:-1);n?a--:++a<o;)if(t(e[a],a,e))return a;return-1}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_baseGetAllKeys.js ***!
\*************************************/
function(e,t,r){function n(e,t,r){var n=t(e);return a(e)?n:o(n,r(e))}var o=r(/*! ./_arrayPush */52),a=r(/*! ./isArray */4);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseIndexOf.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){if(t!==t)return o(e,a,r);for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}var o=r(/*! ./_baseFindIndex */213),a=r(/*! ./_baseIsNaN */350);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_baseKeys.js ***!
\*******************************/
function(e,t,r){function n(e){if(!o(e))return a(e);var t=[];for(var r in Object(e))l.call(e,r)&&"constructor"!=r&&t.push(r);return t}var o=r(/*! ./_isPrototype */34),a=r(/*! ./_nativeKeys */236),s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_basePick.js ***!
\*******************************/
function(e,t,r){function n(e,t){return e=Object(e),o(e,t,function(t,r){return r in e})}var o=r(/*! ./_basePickBy */357);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseSetData.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./identity */123),o=r(/*! ./_metaMap */235),a=o?function(e,t){return o.set(e,t),e}:n;e.exports=a},/*!********************************!*\
!*** ./~/lodash/_baseTimes.js ***!
\********************************/
function(e,t){function r(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseToString.js ***!
\***********************************/
function(e,t,r){function n(e){if("string"==typeof e)return e;if(a(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-s?"-0":t}var o=r(/*! ./_Symbol */50),a=r(/*! ./isSymbol */39),s=1/0,l=o?o.prototype:void 0,u=l?l.toString:void 0;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_castSlice.js ***!
\********************************/
function(e,t,r){function n(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:o(e,t,r)}var o=r(/*! ./_baseSlice */110);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_composeArgs.js ***!
\**********************************/
function(e,t){function r(e,t,r,o){for(var a=-1,s=e.length,l=r.length,u=-1,i=t.length,c=n(s-l,0),p=Array(i+c),d=!o;++u<i;)p[u]=t[u];for(;++a<l;)(d||a<s)&&(p[r[a]]=e[a]);for(;c--;)p[u++]=e[a++];return p}var n=Math.max;e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_composeArgsRight.js ***!
\***************************************/
function(e,t){function r(e,t,r,o){for(var a=-1,s=e.length,l=-1,u=r.length,i=-1,c=t.length,p=n(s-u,0),d=Array(p+c),f=!o;++a<p;)d[a]=e[a];for(var y=a;++i<c;)d[y+i]=t[i];for(;++l<u;)(f||a<s)&&(d[y+r[l]]=e[a++]);return d}var n=Math.max;e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_createHybrid.js ***!
\***********************************/
function(e,t,r){function n(e,t,r,b,P,T,O,_,E,j){function w(){for(var f=arguments.length,y=Array(f),m=f;m--;)y[m]=arguments[m];if(A)var v=i(w),h=s(y,v);if(b&&(y=o(y,b,P,A)),T&&(y=a(y,T,O,A)),f-=h,A&&f<j){var g=p(y,v);return u(e,t,n,w.placeholder,r,y,g,_,E,j-f)}var C=S?r:this,I=x?C[e]:e;return f=y.length,_?y=c(y,_):N&&f>1&&y.reverse(),M&&E<f&&(y.length=E),this&&this!==d&&this instanceof w&&(I=k||l(I)),I.apply(C,y)}var M=t&h,S=t&f,x=t&y,A=t&(m|v),N=t&g,k=x?void 0:l(e);return w}var o=r(/*! ./_composeArgs */222),a=r(/*! ./_composeArgsRight */223),s=r(/*! ./_countHolders */375),l=r(/*! ./_createCtor */56),u=r(/*! ./_createRecurry */225),i=r(/*! ./_getHolder */57),c=r(/*! ./_reorder */426),p=r(/*! ./_replaceHolders */35),d=r(/*! ./_root */11),f=1,y=2,m=8,v=16,h=128,g=512;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_createRecurry.js ***!
\************************************/
function(e,t,r){function n(e,t,r,n,f,y,m,v,h,g){var b=t&c,P=b?m:void 0,T=b?void 0:m,O=b?y:void 0,_=b?void 0:y;t|=b?p:d,t&=~(b?d:p),t&i||(t&=~(l|u));var E=[e,t,f,O,P,_,T,v,h,g],j=r.apply(void 0,E);return o(e)&&a(j,E),j.placeholder=n,s(j,e,t)}var o=r(/*! ./_isLaziable */231),a=r(/*! ./_setData */237),s=r(/*! ./_setWrapToString */238),l=1,u=2,i=4,c=8,p=32,d=64;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_equalArrays.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,n,u,i){var c=u&l,p=e.length,d=t.length;if(p!=d&&!(c&&d>p))return!1;var f=i.get(e);if(f&&i.get(t))return f==t;var y=-1,m=!0,v=u&s?new o:void 0;for(i.set(e,t),i.set(t,e);++y<p;){var h=e[y],g=t[y];if(n)var b=c?n(g,h,y,t,e,i):n(h,g,y,e,t,i);if(void 0!==b){if(b)continue;m=!1;break}if(v){if(!a(t,function(e,t){if(!v.has(t)&&(h===e||r(h,e,n,u,i)))return v.add(t)})){m=!1;break}}else if(h!==g&&!r(h,g,n,u,i)){m=!1;break}}return i["delete"](e),i["delete"](t),m}var o=r(/*! ./_SetCache */49),a=r(/*! ./_arraySome */209),s=1,l=2;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_freeGlobal.js ***!
\*********************************/
function(e,t){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(t,function(){return this}())},/*!**********************************!*\
!*** ./~/lodash/_getFuncName.js ***!
\**********************************/
function(e,t,r){function n(e){for(var t=e.name+"",r=o[t],n=s.call(o,t)?r.length:0;n--;){var a=r[n],l=a.func;if(null==l||l==e)return a.name}return t}var o=r(/*! ./_realNames */425),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_hasPath.js ***!
\******************************/
function(e,t,r){function n(e,t,r){t=u(t,e)?[t]:o(t);for(var n,p=-1,d=t.length;++p<d;){var f=c(t[p]);if(!(n=null!=e&&r(e,f)))break;e=e[f]}if(n)return n;var d=e?e.length:0;return!!d&&i(d)&&l(f,d)&&(s(e)||a(e))}var o=r(/*! ./_castPath */113),a=r(/*! ./isArguments */66),s=r(/*! ./isArray */4),l=r(/*! ./_isIndex */61),u=r(/*! ./_isKey */33),i=r(/*! ./isLength */125),c=r(/*! ./_toKey */19);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_hasUnicode.js ***!
\*********************************/
function(e,t){function r(e){return u.test(e)}var n="\\ud800-\\udfff",o="\\u0300-\\u036f\\ufe20-\\ufe23",a="\\u20d0-\\u20f0",s="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+n+o+a+s+"]");e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_isLaziable.js ***!
\*********************************/
function(e,t,r){function n(e){var t=s(e),r=l[t];if("function"!=typeof r||!(t in o.prototype))return!1;if(e===r)return!0;var n=a(r);return!!n&&e===n[0]}var o=r(/*! ./_LazyWrapper */98),a=r(/*! ./_getData */116),s=r(/*! ./_getFuncName */228),l=r(/*! ./wrapperLodash */491);e.exports=n},/*!*****************************************!*\
!*** ./~/lodash/_isStrictComparable.js ***!
\*****************************************/
function(e,t,r){function n(e){return e===e&&!o(e)}var o=r(/*! ./isObject */13);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_mapToArray.js ***!
\*********************************/
function(e,t){function r(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}e.exports=r},/*!**********************************************!*\
!*** ./~/lodash/_matchesStrictComparable.js ***!
\**********************************************/
function(e,t){function r(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_metaMap.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_WeakMap */207),o=n&&new n;e.exports=o},/*!*********************************!*\
!*** ./~/lodash/_nativeKeys.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_overArg */120),o=n(Object.keys,Object);e.exports=o},/*!******************************!*\
!*** ./~/lodash/_setData.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_baseSetData */218),o=r(/*! ./now */478),a=150,s=16,l=function(){var e=0,t=0;return function(r,l){var u=o(),i=s-(u-t);if(t=u,i>0){if(++e>=a)return r}else e=0;return n(r,l)}}();e.exports=l},/*!**************************************!*\
!*** ./~/lodash/_setWrapToString.js ***!
\**************************************/
function(e,t,r){var n=r(/*! ./constant */443),o=r(/*! ./_defineProperty */389),a=r(/*! ./_getWrapDetails */397),s=r(/*! ./identity */123),l=r(/*! ./_insertWrapDetails */407),u=r(/*! ./_updateWrapDetails */437),i=o?function(e,t,r){var s=t+"";return o(e,"toString",{configurable:!0,enumerable:!1,value:n(l(s,u(a(s),r)))})}:s;e.exports=i},/*!***********************************!*\
!*** ./~/lodash/_stringToPath.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./memoize */477),o=r(/*! ./toString */25),a=/^\./,s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/\\(\\)?/g,u=n(function(e){e=o(e);var t=[];return a.test(e)&&t.push(""),e.replace(s,function(e,r,n,o){t.push(n?o.replace(l,"$1"):r||e)}),t});e.exports=u},/*!*******************************!*\
!*** ./~/lodash/_toSource.js ***!
\*******************************/
function(e,t){function r(e){if(null!=e){try{return o.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var n=Function.prototype,o=n.toString;e.exports=r},/*!*****************************!*\
!*** ./~/lodash/compact.js ***!
\*****************************/
function(e,t){function r(e){for(var t=-1,r=e?e.length:0,n=0,o=[];++t<r;){var a=e[t];a&&(o[n++]=a)}return o}e.exports=r},/*!***************************!*\
!*** ./~/lodash/curry.js ***!
\***************************/
function(e,t,r){function n(e,t,r){t=r?void 0:t;var s=o(e,a,void 0,void 0,void 0,void 0,void 0,t);return s.placeholder=n.placeholder,s}var o=r(/*! ./_createWrap */32),a=8;n.placeholder={},e.exports=n},/*!***************************!*\
!*** ./~/lodash/every.js ***!
\***************************/
function(e,t,r){function n(e,t,r){var n=l(e)?o:a;return r&&u(e,t,r)&&(t=void 0),n(e,s(t,3))}var o=r(/*! ./_arrayEvery */335),a=r(/*! ./_baseEvery */339),s=r(/*! ./_baseIteratee */14),l=r(/*! ./isArray */4),u=r(/*! ./_isIterateeCall */119);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/findIndex.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=e?e.length:0;if(!n)return-1;var u=null==r?0:s(r);return u<0&&(u=l(n+u,0)),o(e,a(t,3),u)}var o=r(/*! ./_baseFindIndex */213),a=r(/*! ./_baseIteratee */14),s=r(/*! ./toInteger */17),l=Math.max;e.exports=n},/*!*****************************!*\
!*** ./~/lodash/fp/flow.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("flow",r(/*! ../flow */448));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/invoke.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./_baseInvoke */347),o=r(/*! ./_baseRest */12),a=o(n);e.exports=a},/*!******************************!*\
!*** ./~/lodash/isBuffer.js ***!
\******************************/
function(e,t,r){(function(e){var n=r(/*! ./_root */11),o=r(/*! ./stubFalse */487),a="object"==typeof t&&t&&!t.nodeType&&t,s=a&&"object"==typeof e&&e&&!e.nodeType&&e,l=s&&s.exports===a,u=l?n.Buffer:void 0,i=u?u.isBuffer:void 0,c=i||o;e.exports=c}).call(t,r(/*! ./../webpack/buildin/module.js */259)(e))},/*!******************************!*\
!*** ./~/lodash/isNumber.js ***!
\******************************/
function(e,t,r){function n(e){return"number"==typeof e||o(e)&&l.call(e)==a}var o=r(/*! ./isObjectLike */20),a="[object Number]",s=Object.prototype,l=s.toString;e.exports=n},/*!******************************!*\
!*** ./~/lodash/isString.js ***!
\******************************/
function(e,t,r){function n(e){return"string"==typeof e||!o(e)&&a(e)&&u.call(e)==s}var o=r(/*! ./isArray */4),a=r(/*! ./isObjectLike */20),s="[object String]",l=Object.prototype,u=l.toString;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/isTypedArray.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_baseIsTypedArray */352),o=r(/*! ./_baseUnary */111),a=r(/*! ./_nodeUtil */423),s=a&&a.isTypedArray,l=s?o(s):n;e.exports=l},/*!**************************!*\
!*** ./~/lodash/noop.js ***!
\**************************/
function(e,t){function r(){}e.exports=r},/*!****************************!*\
!*** ./~/lodash/reduce.js ***!
\****************************/
function(e,t,r){function n(e,t,r){var n=u(e)?o:l,i=arguments.length<3;return n(e,s(t,4),r,i,a)}var o=r(/*! ./_arrayReduce */53),a=r(/*! ./_baseEach */26),s=r(/*! ./_baseIteratee */14),l=r(/*! ./_baseReduce */361),u=r(/*! ./isArray */4);e.exports=n},/*!**************************!*\
!*** ./~/lodash/some.js ***!
\**************************/
function(e,t,r){function n(e,t,r){var n=l(e)?o:s;return r&&u(e,t,r)&&(t=void 0),n(e,a(t,3))}var o=r(/*! ./_arraySome */209),a=r(/*! ./_baseIteratee */14),s=r(/*! ./_baseSome */362),l=r(/*! ./isArray */4),u=r(/*! ./_isIterateeCall */119);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/stubArray.js ***!
\*******************************/
function(e,t){function r(){return[]}e.exports=r},/*!***************************!*\
!*** ./~/lodash/times.js ***!
\***************************/
function(e,t,r){function n(e,t){if(e=s(e),e<1||e>l)return[];var r=u,n=i(e,u);t=o(t),e-=u;for(var c=a(n,t);++r<e;)t(r);return c}var o=r(/*! ./_baseIteratee */14),a=r(/*! ./_baseTimes */219),s=r(/*! ./toInteger */17),l=9007199254740991,u=4294967295,i=Math.min;e.exports=n},/*!******************************!*\
!*** ./~/lodash/toFinite.js ***!
\******************************/
function(e,t,r){function n(e){if(!e)return 0===e?e:0;if(e=o(e),e===a||e===-a){var t=e<0?-1:1;return t*s}return e===e?e:0}var o=r(/*! ./toNumber */68),a=1/0,s=1.7976931348623157e308;e.exports=n},/*!*******************************!*\
!*** ./~/lodash/transform.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=i(e)||d(e);if(t=l(t,4),null==r)if(n||p(e)){var f=e.constructor;r=n?i(e)?new f:[]:c(f)?a(u(e)):{}}else r={};return(n?o:s)(e,function(e,n,o){return t(r,e,n,o)}),r}var o=r(/*! ./_arrayEach */30),a=r(/*! ./_baseCreate */31),s=r(/*! ./_baseForOwn */106),l=r(/*! ./_baseIteratee */14),u=r(/*! ./_getPrototype */59),i=r(/*! ./isArray */4),c=r(/*! ./isFunction */24),p=r(/*! ./isObject */13),d=r(/*! ./isTypedArray */250);e.exports=n},/*!***************************!*\
!*** ./~/lodash/union.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_baseFlatten */27),o=r(/*! ./_baseRest */12),a=r(/*! ./_baseUniq */363),s=r(/*! ./isArrayLikeObject */38),l=o(function(e){return a(n(e,1,s,!0))});e.exports=l},/*!***********************************!*\
!*** (webpack)/buildin/module.js ***!
\***********************************/
function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},/*!***************************************!*\
!*** ./src/addons/Confirm/Confirm.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.open,r=e.cancelButton,n=e.confirmButton,a=e.header,u=e.content,p=e.onConfirm,f=e.onCancel,m=(0,c.getUnhandledProps)(o,e),v={};return(0,s["default"])(e,"open")&&(v.open=t),i["default"].createElement(y["default"],l({},v,{size:"small",onClose:f},m),a&&i["default"].createElement(y["default"].Header,null,a),u&&i["default"].createElement(y["default"].Content,null,u),i["default"].createElement(y["default"].Actions,null,i["default"].createElement(d["default"],{onClick:f},r),i["default"].createElement(d["default"],{primary:!0,onClick:p},n)))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/has */23),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ../../elements/Button */74),d=n(p),f=r(/*! ../../modules/Modal */179),y=n(f);o._meta={name:"Confirm",type:c.META.TYPES.ADDON},o.propTypes={open:u.PropTypes.bool,cancelButton:u.PropTypes.string,confirmButton:u.PropTypes.string,header:u.PropTypes.string,content:u.PropTypes.string,onConfirm:u.PropTypes.func,onCancel:u.PropTypes.func},o.defaultProps={cancelButton:"Cancel",confirmButton:"OK",content:"Are you sure?"},t["default"]=o},/*!*************************************!*\
!*** ./src/addons/Confirm/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Confirm */260),a=n(o);t["default"]=a["default"]},/*!*************************************!*\
!*** ./src/addons/Portal/Portal.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/invoke */246),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p=r(/*! react */1),d=n(p),f=r(/*! react-dom */493),y=n(f),m=r(/*! ../../lib */2),v=(0,m.makeDebugger)("portal"),h={name:"Portal",type:m.META.TYPES.ADDON},g=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,c=Array(l),p=0;p<l;p++)c[p]=arguments[p];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),n.handleDocumentClick=function(e){var t=n.props,r=t.closeOnDocumentClick,o=t.closeOnRootNodeClick;n.portal.contains(e.target)||(r||o&&n.node.contains(e.target))&&(v("handleDocumentClick()"),e.stopPropagation(),n.close(e))},n.handleEscape=function(e){n.props.closeOnEscape&&m.keyboardKey.getCode(e)===m.keyboardKey.Escape&&(v("handleEscape()"),e.preventDefault(),n.close(e))},n.handlePortalMouseLeave=function(e){var t=n.props,r=t.closeOnPortalMouseLeave,o=t.mouseLeaveDelay;r&&(v("handlePortalMouseLeave()"),n.mouseLeaveTimer=n.closeWithTimeout(e,o))},n.handlePortalMouseOver=function(e){var t=n.props.closeOnPortalMouseLeave;t&&(v("handlePortalMouseOver()"),clearTimeout(n.mouseLeaveTimer))},n.handleTriggerBlur=function(e){var t=n.props,r=t.trigger,o=t.closeOnTriggerBlur;(0,u["default"])(r,"props.onBlur",e),o&&(v("handleTriggerBlur()"),n.close(e))},n.handleTriggerClick=function(e){var t=n.props,r=t.trigger,o=t.closeOnTriggerClick,a=t.openOnTriggerClick,s=n.state.open;(0,u["default"])(r,"props.onClick",e),s&&o?(v("handleTriggerClick() - close"),e.stopPropagation(),n.close(e)):!s&&a&&(v("handleTriggerClick() - open"),e.stopPropagation(),n.open(e)),e.nativeEvent.stopImmediatePropagation()},n.handleTriggerFocus=function(e){var t=n.props,r=t.trigger,o=t.openOnTriggerFocus;(0,u["default"])(r,"props.onFocus",e),o&&(v("handleTriggerFocus()"),n.open(e))},n.handleTriggerMouseLeave=function(e){clearTimeout(n.mouseOverTimer);var t=n.props,r=t.trigger,o=t.closeOnTriggerMouseLeave,a=t.mouseLeaveDelay;(0,u["default"])(r,"props.onMouseLeave",e),o&&(v("handleTriggerMouseLeave()"),n.mouseLeaveTimer=n.closeWithTimeout(e,a))},n.handleTriggerMouseOver=function(e){clearTimeout(n.mouseLeaveTimer);var t=n.props,r=t.trigger,o=t.mouseOverDelay,a=t.openOnTriggerMouseOver;(0,u["default"])(r,"props.onMouseOver",e),a&&(v("handleTriggerMouseOver()"),n.mouseOverTimer=n.openWithTimeout(e,o))},n.open=function(e){v("open()");var t=n.props.onOpen;t&&t(e),n.trySetState({open:!0})},n.openWithTimeout=function(e,t){var r=i({},e);return setTimeout(function(){return n.open(r)},t||0)},n.close=function(e){v("close()");var t=n.props.onClose;t&&t(e),n.trySetState({open:!1})},n.closeWithTimeout=function(e,t){var r=i({},e);return setTimeout(function(){return n.close(r)},t||0)},n.mountPortal=function(){if(!n.node){v("mountPortal()");var e=n.props,t=e.mountNode,r=void 0===t?document.body:t,o=e.prepend;n.node=document.createElement("div"),o?r.insertBefore(n.node,r.firstElementChild):r.appendChild(n.node),document.addEventListener("click",n.handleDocumentClick),document.addEventListener("keydown",n.handleEscape);var a=n.props.onMount;a&&a()}},n.unmountPortal=function(){if(n.node){v("unmountPortal()"),y["default"].unmountComponentAtNode(n.node),n.node.parentNode.removeChild(n.node),n.portal.removeEventListener("mouseleave",n.handlePortalMouseLeave),n.portal.removeEventListener("mouseover",n.handlePortalMouseOver),n.node=null,n.portal=null,document.removeEventListener("click",n.handleDocumentClick),document.removeEventListener("keydown",n.handleEscape);var e=n.props.onUnmount;e&&e()}},s=r,a(n,s)}return s(t,e),c(t,[{key:"componentDidMount",value:function(){this.state.open&&this.renderPortal()}},{key:"componentDidUpdate",value:function(e,t){this.state.open&&this.renderPortal(),t.open&&!this.state.open&&(v("portal closed"),this.unmountPortal())}},{key:"componentWillUnmount",value:function(){this.unmountPortal(),clearTimeout(this.mouseOverTimer),clearTimeout(this.mouseLeaveTimer)}},{key:"renderPortal",value:function(){var e=this.props,t=e.children,r=e.className;this.mountPortal(),this.node.className=r||"",y["default"].unstable_renderSubtreeIntoContainer(this,p.Children.only(t),this.node),this.portal=this.node.firstElementChild,this.portal.addEventListener("mouseleave",this.handlePortalMouseLeave),this.portal.addEventListener("mouseover",this.handlePortalMouseOver)}},{key:"render",value:function(){var e=this.props.trigger;return e?d["default"].cloneElement(e,{onBlur:this.handleTriggerBlur,onClick:this.handleTriggerClick,onFocus:this.handleTriggerFocus,onMouseLeave:this.handleTriggerMouseLeave,onMouseOver:this.handleTriggerMouseOver}):null}}]),t}(m.AutoControlledComponent);g.propTypes={children:p.PropTypes.node.isRequired,className:p.PropTypes.string,closeOnRootNodeClick:m.customPropTypes.every([m.customPropTypes.disallow(["closeOnDocumentClick"]),p.PropTypes.bool]),closeOnDocumentClick:m.customPropTypes.every([m.customPropTypes.disallow(["closeOnRootNodeClick"]),p.PropTypes.bool]),closeOnEscape:p.PropTypes.bool,closeOnPortalMouseLeave:p.PropTypes.bool,closeOnTriggerBlur:p.PropTypes.bool,closeOnTriggerClick:p.PropTypes.bool,closeOnTriggerMouseLeave:p.PropTypes.bool,defaultOpen:p.PropTypes.bool,mountNode:p.PropTypes.any,mouseLeaveDelay:p.PropTypes.number,mouseOverDelay:p.PropTypes.number,onClose:p.PropTypes.func,onMount:p.PropTypes.func,onOpen:p.PropTypes.func,onUnmount:p.PropTypes.func,open:p.PropTypes.bool,openOnTriggerClick:p.PropTypes.bool,openOnTriggerFocus:p.PropTypes.bool,openOnTriggerMouseOver:p.PropTypes.bool,prepend:p.PropTypes.bool,trigger:p.PropTypes.node},g.defaultProps={closeOnDocumentClick:!0,closeOnEscape:!0,openOnTriggerClick:!0},g.autoControlledProps=["open"],g._meta=h,t["default"]=g},/*!***********************************!*\
!*** ./src/addons/Radio/Radio.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.slider,r=e.toggle,n=e.type,s=(0,u.getUnhandledProps)(o,e),i=!(t||r)||void 0;return l["default"].createElement(c["default"],a({},s,{type:n,radio:i,slider:t,toggle:r}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Checkbox */46),c=n(i);o._meta={name:"Radio",type:u.META.TYPES.ADDON,props:{type:c["default"]._meta.props.type}},o.propTypes={slider:c["default"].propTypes.slider,toggle:c["default"].propTypes.toggle,type:s.PropTypes.oneOf(o._meta.props.type)},o.defaultProps={type:"radio"},t["default"]=o},/*!*************************************!*\
!*** ./src/addons/Select/Select.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return l["default"].createElement(c["default"],a({},e,{selection:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! react */1),l=n(s),u=r(/*! ../../lib */2),i=r(/*! ../../modules/Dropdown */83),c=n(i);o._meta={name:"Select",type:u.META.TYPES.ADDON},t["default"]=o},/*!*****************************************!*\
!*** ./src/addons/TextArea/TextArea.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=(0,l.getUnhandledProps)(o,e),r=(0,l.getElementType)(o,e);return s["default"].createElement(r,t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! react */1),s=n(a),l=r(/*! ../../lib */2);o._meta={name:"TextArea",type:l.META.TYPES.ADDON},o.propTypes={as:l.customPropTypes.as},o.defaultProps={as:"textarea"},t["default"]=o},/*!**************************************************!*\
!*** ./src/collections/Breadcrumb/Breadcrumb.js ***!
\**************************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e){var t=e.children,r=e.className,n=e.divider,s=e.icon,l=e.size,u=e.sections,p=(0,d["default"])("ui",r,l,"breadcrumb"),f=(0,m.getUnhandledProps)(a,e),v=(0,m.getElementType)(a,e);if(t)return y["default"].createElement(v,c({},f,{className:p}),t);var g=y["default"].createElement(h["default"],{icon:s},n),P=[];return(0,i["default"])(u,function(e,t){var r=e.text,n=e.key,a=o(e,["text","key"]),s=n||r,l=s+"-divider";P.push(y["default"].createElement(b["default"],c({},a,{key:s}),r)),t!==u.length-1&&P.push(y["default"].cloneElement(g,{key:l}))}),y["default"].createElement(v,c({},f,{className:p}),P)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(/*! lodash/without */6),l=n(s),u=r(/*! lodash/each */64),i=n(u),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p=r(/*! classnames */3),d=n(p),f=r(/*! react */1),y=n(f),m=r(/*! ../../lib */2),v=r(/*! ./BreadcrumbDivider */130),h=n(v),g=r(/*! ./BreadcrumbSection */131),b=n(g);a._meta={name:"Breadcrumb",type:m.META.TYPES.COLLECTION,props:{size:(0,l["default"])(m.SUI.SIZES,"medium")}},a.propTypes={as:m.customPropTypes.as,children:f.PropTypes.node,className:f.PropTypes.string,divider:m.customPropTypes.every([m.customPropTypes.disallow(["icon"]),m.customPropTypes.contentShorthand]),icon:m.customPropTypes.every([m.customPropTypes.disallow(["divider"]),m.customPropTypes.itemShorthand]),sections:m.customPropTypes.collectionShorthand,size:f.PropTypes.oneOf(a._meta.props.size)},a.Divider=h["default"],a.Section=b["default"],t["default"]=a},/*!*********************************************!*\
!*** ./src/collections/Breadcrumb/index.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Breadcrumb */266),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/collections/Form/Form.js ***!
\**************************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(t){B("formSerializer()");var r={};return t?((0,g["default"])(t.querySelectorAll('input[type="checkbox"]'),function(n,o,a){var s=Y(n),l=(0,v["default"])(a,{name:s});if(1===l.length)return r[s]=n.checked&&"on"!==n.value?n.value:n.checked,void q(r,s,n);if(Array.isArray(r[s])||(r[s]=[]),n.checked&&r[s].push(n.value),q(r,s,n),"production"!==e.NODE_ENV&&"on"===n.value){var u=["Encountered a checkbox in a group with the default browser value 'on'.","Each checkbox in a group should have a unique value.","Otherwise, the checkbox value will serialize as ['on', ...]."].join(" ");console.error(u,n,t)}}),(0,g["default"])(t.querySelectorAll('input[type="radio"]'),function(n,o,a){var s=Y(n),l=(0,y["default"])(a,{name:s,checked:!0});if(l?r[s]=l.value:r[s]=null,q(r,s,n),"production"!==e.NODE_ENV&&"on"===n.value){var u=["Encountered a radio with the default browser value 'on'.","Each radio should have a unique value.","Otherwise, the radio value will serialize as { [name]: 'on' }."].join(" ");console.error(u,n,t)}}),(0,g["default"])(t.querySelectorAll('input:not([type="radio"]):not([type="checkbox"])'),function(e){var t=Y(e);r[t]=e.value,q(r,t,e)}),(0,g["default"])(t.querySelectorAll("textarea"),function(e){var t=Y(e);r[t]=e.value,q(r,t,e)}),(0,g["default"])(t.querySelectorAll("select"),function(e){var t=Y(e);e.multiple?r[t]=(0,d["default"])((0,v["default"])(e.querySelectorAll("option"),"selected"),"value"):r[t]=e.value,q(r,t,e)}),r):r}Object.defineProperty(t,"__esModule",{value:!0});var i=r(/*! lodash/without */6),c=n(i),p=r(/*! lodash/map */9),d=n(p),f=r(/*! lodash/find */122),y=n(f),m=r(/*! lodash/filter */121),v=n(m),h=r(/*! lodash/each */64),g=n(h),b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},P=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),T=r(/*! classnames */3),O=n(T),_=r(/*! react */1),E=n(_),j=r(/*! ../../lib */2),w=r(/*! ./FormButton */132),M=n(w),S=r(/*! ./FormCheckbox */133),x=n(S),A=r(/*! ./FormDropdown */134),N=n(A),k=r(/*! ./FormField */16),C=n(k),I=r(/*! ./FormGroup */135),K=n(I),L=r(/*! ./FormInput */136),U=n(L),D=r(/*! ./FormRadio */137),R=n(D),z=r(/*! ./FormSelect */138),W=n(z),F=r(/*! ./FormTextArea */139),V=n(F),B=(0,j.makeDebugger)("form"),Y=function(e){var t=e.name;return t},q=function(){};"production"!==e.NODE_ENV&&(q=function(e,t,r){B("serialized "+JSON.stringify(l({},t,e[t]))+" from:",r)},Y=function(e){var t=e.name;if(!t){var r=["Encountered a form control node without a name attribute.","Each node in a group should have a name.",'Otherwise, the node will serialize as { "undefined": <value> }.'].join(" ");console.error(r,e)}return t});var H={name:"Form",type:j.META.TYPES.COLLECTION,props:{widths:["equal"],size:(0,c["default"])(j.SUI.SIZES,"medium")}},G=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n._form=null,n.handleRef=function(e){return n._form=n._form||e},n.handleSubmit=function(e){var t=n.props,r=t.onSubmit,o=t.serializer;r&&r(e,o(n._form))},s=r,a(n,s)}return s(t,e),P(t,[{key:"render",value:function(){var e=this.props,r=e.children,n=e.className,o=e.error,a=e.loading,s=e.reply,l=e.size,u=e.success,i=e.warning,c=e.widths,p=(0,O["default"])("ui",l,(0,j.useKeyOnly)(o,"error"),(0,j.useKeyOnly)(a,"loading"),(0,j.useKeyOnly)(s,"reply"),(0,j.useKeyOnly)(u,"success"),(0,j.useKeyOnly)(i,"warning"),(0,j.useWidthProp)(c,null,!0),"form",n),d=(0,j.getUnhandledProps)(t,this.props),f=(0,j.getElementType)(t,this.props);return E["default"].createElement(f,b({},d,{className:p,ref:this.handleRef,onSubmit:this.handleSubmit}),r)}}]),t}(_.Component);G.defaultProps={as:"form",serializer:u},G.propTypes={as:j.customPropTypes.as,children:_.PropTypes.node,className:_.PropTypes.string,error:_.PropTypes.bool,loading:_.PropTypes.bool,onSubmit:_.PropTypes.func,reply:_.PropTypes.bool,serializer:_.PropTypes.func,size:_.PropTypes.oneOf(H.props.size),success:_.PropTypes.bool,warning:_.PropTypes.bool,widths:_.PropTypes.oneOf(H.props.widths)},G._meta=H,G.Field=C["default"],G.Button=M["default"],G.Checkbox=x["default"],G.Dropdown=N["default"],G.Group=K["default"],G.Input=U["default"],G.Radio=R["default"],G.Select=W["default"],G.TextArea=V["default"],t["default"]=G}).call(t,r(/*! ./~/node-libs-browser/~/process/browser.js */69))},/*!***************************************!*\
!*** ./src/collections/Form/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Form */268),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/collections/Grid/Grid.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=e.celled,r=e.centered,n=e.children,o=e.className,l=e.columns,i=e.divided,d=e.doubling,f=e.padded,y=e.relaxed,m=e.reversed,v=e.stackable,h=e.stretched,g=e.textAlign,b=e.verticalAlign,P=(0,u["default"])("ui",(0,p.useKeyOnly)(r,"centered"),(0,p.useKeyOnly)(d,"doubling"),(0,p.useKeyOnly)(v,"stackable"),(0,p.useKeyOnly)(h,"stretched"),(0,p.useKeyOrValueAndKey)(t,"celled"),(0,p.useKeyOrValueAndKey)(i,"divided"),(0,p.useKeyOrValueAndKey)(f,"padded"),(0,p.useKeyOrValueAndKey)(y,"relaxed"),(0,p.useTextAlignProp)(g),(0,p.useValueAndKey)(m,"reversed"),(0,p.useVerticalAlignProp)(b),(0,p.useWidthProp)(l,"column",!0),"grid",o),T=(0,p.getUnhandledProps)(a,e),O=(0,p.getElementType)(a,e);return c["default"].createElement(O,s({},T,{className:P}),n)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(/*! classnames */3),u=n(l),i=r(/*! react */1),c=n(i),p=r(/*! ../../lib */2),d=r(/*! ./GridColumn */140),f=n(d),y=r(/*! ./GridRow */141),m=n(y);a.Column=f["default"],a.Row=m["default"],a._meta={name:"Grid",type:p.META.TYPES.COLLECTION,props:{celled:["internally"],columns:[].concat(o(p.SUI.WIDTHS),["equal"]),divided:["vertically"],padded:["horizontally","vertically"],relaxed:["very"],reversed:["computer","computer vertically","mobile","mobile vertically","tablet","tablet vertically"],textAlign:p.SUI.TEXT_ALIGNMENTS,verticalAlign:p.SUI.VERTICAL_ALIGNMENTS}},a.propTypes={as:p.customPropTypes.as,celled:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.celled)]),centered:i.PropTypes.bool,children:i.PropTypes.node,className:i.PropTypes.string,columns:i.PropTypes.oneOf(a._meta.props.columns),divided:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.divided)]),doubling:i.PropTypes.bool,padded:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.padded)]),relaxed:i.PropTypes.oneOfType([i.PropTypes.bool,i.PropTypes.oneOf(a._meta.props.relaxed)]),reversed:i.PropTypes.oneOf(a._meta.props.reversed),stackable:i.PropTypes.bool,stretched:i.PropTypes.bool,textAlign:i.PropTypes.oneOf(a._meta.props.textAlign),verticalAlign:i.PropTypes.oneOf(f["default"]._meta.props.verticalAlign)},t["default"]=a},/*!***************************************!*\
!*** ./src/collections/Grid/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Grid */270),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/collections/Menu/Menu.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/map */9),u=n(l),i=r(/*! lodash/get */37),c=n(i),p=r(/*! lodash/without */6),d=n(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),m=r(/*! classnames */3),v=n(m),h=r(/*! react */1),g=n(h),b=r(/*! ../../lib */2),P=r(/*! ./MenuHeader */142),T=n(P),O=r(/*! ./MenuItem */143),_=n(O),E=r(/*! ./MenuMenu */144),j=n(E),w={name:"Menu",type:b.META.TYPES.COLLECTION,props:{attached:["top","bottom"],color:b.SUI.COLORS,floated:["right"],icon:["labeled"],fixed:["left","right","bottom","top"],size:(0,d["default"])(b.SUI.SIZES,"medium","big"),tabular:["right"],widths:b.SUI.WIDTHS}},M=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleItemClick=function(e,t){var r=t.name,o=t.index;n.trySetState({activeIndex:o});var a=n.props,s=a.items,l=a.onItemClick;(0,c["default"])(s[o],"onClick")&&s[o].onClick(e,{name:r,index:o}),l&&l(e,{name:r,index:o})},s=r,a(n,s)}return s(t,e),y(t,[{key:"renderItems",value:function(){var e=this,t=this.props.items,r=this.state.activeIndex;return(0,u["default"])(t,function(t,n){return(0,b.createShorthand)(_["default"],function(e){return{content:e}},t,{active:r===n,childKey:function(e){var t=e.content,r=e.name;return[t,r].join("-")},index:n,onClick:e.handleItemClick})})}},{key:"render",value:function(){var e=this.props,r=e.attached,n=e.borderless,o=e.children,a=e.className,s=e.color,l=e.compact,u=e.fixed,i=e.floated,c=e.fluid,p=e.icon,d=e.inverted,y=e.pagination,m=e.pointing,h=e.secondary,P=e.stackable,T=e.tabular,O=e.text,_=e.vertical,E=e.size,j=e.widths,w=(0,v["default"])("ui",s,E,(0,b.useWidthProp)(j,"item"),(0,b.useKeyOrValueAndKey)(r,"attached"),(0,b.useKeyOnly)(n,"borderless"),(0,b.useKeyOnly)(l,"compact"),(0,b.useValueAndKey)(u,"fixed"),(0,b.useKeyOrValueAndKey)(i,"floated"),(0,b.useKeyOnly)(c,"fluid"),(0,b.useKeyOrValueAndKey)(p,"icon"),(0,b.useKeyOnly)(d,"inverted"),(0,b.useKeyOnly)(y,"pagination"),(0,b.useKeyOnly)(m,"pointing"),(0,b.useKeyOnly)(h,"secondary"),(0,b.useKeyOnly)(P,"stackable"),(0,b.useKeyOrValueAndKey)(T,"tabular"),(0,b.useKeyOnly)(O,"text"),(0,b.useKeyOnly)(_,"vertical"),a,"menu"),M=(0,b.getUnhandledProps)(t,this.props),S=(0,b.getElementType)(t,this.props);return g["default"].createElement(S,f({},M,{className:w}),o||this.renderItems())}}]),t}(b.AutoControlledComponent);M.propTypes={as:b.customPropTypes.as,activeIndex:h.PropTypes.number,attached:h.PropTypes.oneOfType([h.PropTypes.bool,h.PropTypes.oneOf(w.props.attached)]),borderless:h.PropTypes.bool,children:h.PropTypes.node,className:h.PropTypes.string,color:h.PropTypes.oneOf(w.props.color),compact:h.PropTypes.bool,defaultActiveIndex:h.PropTypes.number,fixed:h.PropTypes.oneOf(w.props.fixed),floated:h.PropTypes.oneOfType([h.PropTypes.bool,h.PropTypes.oneOf(w.props.floated)]),fluid:h.PropTypes.bool,icon:h.PropTypes.oneOfType([h.PropTypes.bool,h.PropTypes.oneOf(w.props.icon)]),inverted:h.PropTypes.bool,items:b.customPropTypes.collectionShorthand,onItemClick:b.customPropTypes.every([b.customPropTypes.disallow(["children"]),h.PropTypes.func]),pagination:h.PropTypes.bool,pointing:h.PropTypes.bool,secondary:h.PropTypes.bool,stackable:h.PropTypes.bool,tabular:h.PropTypes.oneOfType([h.PropTypes.bool,h.PropTypes.oneOf(w.props.tabular)]),text:h.PropTypes.bool,vertical:h.PropTypes.bool,size:h.PropTypes.oneOf(w.props.size),widths:h.PropTypes.oneOf(w.props.widths)},M._meta=w,M.autoControlledProps=["activeIndex"],M.Header=T["default"],M.Item=_["default"],M.Menu=j["default"],t["default"]=M},/*!***************************************!*\
!*** ./src/collections/Menu/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Menu */272),a=n(o);t["default"]=a["default"]},/*!********************************************!*\
!*** ./src/collections/Message/Message.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.className,n=e.content,a=e.header,s=e.icon,u=e.list,c=e.onDismiss,f=e.hidden,m=e.visible,h=e.floating,b=e.compact,T=e.attached,O=e.warning,_=e.info,E=e.positive,j=e.success,w=e.negative,M=e.error,S=e.color,x=e.size,A=(0,p["default"])("ui",x,S,(0,d.useKeyOnly)(s,"icon"),(0,d.useKeyOnly)(f,"hidden"),(0,d.useKeyOnly)(m,"visible"),(0,d.useKeyOnly)(h,"floating"),(0,d.useKeyOnly)(b,"compact"),(0,d.useKeyOrValueAndKey)(T,"attached"),(0,d.useKeyOnly)(O,"warning"),(0,d.useKeyOnly)(_,"info"),(0,d.useKeyOnly)(E,"positive"),(0,d.useKeyOnly)(j,"success"),(0,d.useKeyOnly)(w,"negative"),(0,d.useKeyOnly)(M,"error"),"message",r),N=c&&i["default"].createElement(y["default"],{name:"close",onClick:c}),k=(0,d.getUnhandledProps)(o,e),C=(0,d.getElementType)(o,e);return t?i["default"].createElement(C,l({},k,{className:A}),N,t):i["default"].createElement(C,l({},k,{className:A}),N,y["default"].create(s),(a||n||u)&&i["default"].createElement(v["default"],null,(0,d.createShorthand)(g["default"],function(e){return{children:e}},a),(0,d.createShorthand)(P["default"],function(e){return{items:e}},u),(0,d.createShorthand)("p",function(e){return{children:e}},n)))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! react */1),i=n(u),c=r(/*! classnames */3),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ../../elements/Icon */10),y=n(f),m=r(/*! ./MessageContent */145),v=n(m),h=r(/*! ./MessageHeader */146),g=n(h),b=r(/*! ./MessageList */147),P=n(b),T=r(/*! ./MessageItem */72),O=n(T);o._meta={name:"Message",type:d.META.TYPES.COLLECTION,props:{attached:["bottom"],color:d.SUI.COLORS,size:(0,s["default"])(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,content:d.customPropTypes.contentShorthand,header:d.customPropTypes.itemShorthand,icon:u.PropTypes.oneOfType([u.PropTypes.bool,d.customPropTypes.itemShorthand]),list:d.customPropTypes.collectionShorthand,onDismiss:u.PropTypes.func,hidden:u.PropTypes.bool,visible:u.PropTypes.bool,floating:u.PropTypes.bool,compact:u.PropTypes.bool,attached:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.oneOf(o._meta.props.attached)]),warning:u.PropTypes.bool,info:u.PropTypes.bool,positive:u.PropTypes.bool,success:u.PropTypes.bool,negative:u.PropTypes.bool,error:u.PropTypes.bool,color:u.PropTypes.oneOf(o._meta.props.color),size:u.PropTypes.oneOf(o._meta.props.size)},o.Content=v["default"],o.Header=g["default"],o.List=P["default"],o.Item=O["default"],t["default"]=o},/*!******************************************!*\
!*** ./src/collections/Message/index.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Message */274),a=n(o);t["default"]=a["default"]},/*!****************************************!*\
!*** ./src/collections/Table/Table.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.basic,r=e.attached,n=e.renderBodyRow,a=e.celled,s=e.children,l=e.className,c=e.collapsing,d=e.color,m=e.columns,h=e.compact,g=e.definition,b=e.fixed,T=e.footerRow,_=e.headerRow,E=e.inverted,j=e.padded,M=e.selectable,S=e.singleLine,x=e.size,A=e.stackable,N=e.striped,k=e.structured,C=e.tableData,I=e.unstackable,K=(0,p["default"])("ui",d,x,(0,y.useKeyOrValueAndKey)(r,"attached"),(0,y.useKeyOrValueAndKey)(t,"basic"),(0,y.useKeyOnly)(a,"celled"),(0,y.useKeyOnly)(c,"collapsing"),(0,y.useKeyOrValueAndKey)(h,"compact"),(0,y.useKeyOnly)(g,"definition"),(0,y.useKeyOnly)(b,"fixed"),(0,y.useKeyOnly)(E,"inverted"),(0,y.useKeyOrValueAndKey)(j,"padded"),(0,y.useKeyOnly)(M,"selectable"),(0,y.useKeyOnly)(S,"single line"),(0,y.useKeyOnly)(A,"stackable"),(0,y.useKeyOnly)(N,"striped"),(0,y.useKeyOnly)(k,"structured"),(0,y.useKeyOnly)(I,"unstackable"),(0,y.useWidthProp)(m,"column"),l,"table"),L=(0,y.getUnhandledProps)(o,e),U=(0,y.getElementType)(o,e);return s?f["default"].createElement(U,i({},L,{className:K}),s):f["default"].createElement(U,i({},L,{className:K}),_&&f["default"].createElement(O["default"],null,w["default"].create(_,{cellAs:"th"})),f["default"].createElement(v["default"],null,n&&(0,u["default"])(C,function(e,t){return w["default"].create(n(e,t))})),T&&f["default"].createElement(P["default"],null,w["default"].create(T)))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=r(/*! lodash/map */9),u=n(l),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(/*! classnames */3),p=n(c),d=r(/*! react */1),f=n(d),y=r(/*! ../../lib */2),m=r(/*! ./TableBody */148),v=n(m),h=r(/*! ./TableCell */42),g=n(h),b=r(/*! ./TableFooter */149),P=n(b),T=r(/*! ./TableHeader */73),O=n(T),_=r(/*! ./TableHeaderCell */150),E=n(_),j=r(/*! ./TableRow */151),w=n(j);o._meta={name:"Table",type:y.META.TYPES.COLLECTION,props:{attached:["top","bottom"],basic:["very"],color:y.SUI.COLORS,columns:y.SUI.WIDTHS,compact:["very"],padded:["very"],size:(0,s["default"])(y.SUI.SIZES,"mini","tiny","medium","big","huge","massive")}},o.defaultProps={as:"table"},o.propTypes={as:y.customPropTypes.as,attached:d.PropTypes.oneOfType([d.PropTypes.oneOf(o._meta.props.attached),d.PropTypes.bool]),basic:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(o._meta.props.basic)]),celled:d.PropTypes.bool,children:d.PropTypes.node,className:d.PropTypes.string,collapsing:d.PropTypes.bool,color:d.PropTypes.oneOf(o._meta.props.color),columns:d.PropTypes.oneOf(o._meta.props.columns),compact:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(o._meta.props.compact)]),definition:d.PropTypes.bool,fixed:d.PropTypes.bool,footerRow:y.customPropTypes.itemShorthand,headerRow:y.customPropTypes.itemShorthand,inverted:d.PropTypes.bool,padded:d.PropTypes.oneOfType([d.PropTypes.bool,d.PropTypes.oneOf(o._meta.props.padded)]),renderBodyRow:y.customPropTypes.every([y.customPropTypes.disallow(["children"]),y.customPropTypes.demand(["tableData"]),d.PropTypes.func]),selectable:d.PropTypes.bool,singleLine:d.PropTypes.bool,size:d.PropTypes.oneOf(o._meta.props.size),stackable:d.PropTypes.bool,striped:d.PropTypes.bool,structured:d.PropTypes.bool,tableData:y.customPropTypes.every([y.customPropTypes.disallow(["children"]),y.customPropTypes.demand(["renderBodyRow"]),d.PropTypes.array]),unstackable:d.PropTypes.bool},o.Body=v["default"],o.Cell=g["default"],o.Footer=P["default"],o.Header=O["default"],o.HeaderCell=E["default"],o.Row=w["default"],t["default"]=o},/*!****************************************!*\
!*** ./src/collections/Table/index.js ***!
\****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Table */276),a=n(o);t["default"]=a["default"]},/*!*********************************************!*\
!*** ./src/elements/Container/Container.js ***!
\*********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.text,r=e.textAlign,n=e.fluid,s=e.children,u=e.className,p=(0,l["default"])("ui",(0,c.useKeyOnly)(t,"text"),(0,c.useKeyOnly)(n,"fluid"),(0,c.useTextAlignProp)(r),"container",u),d=(0,c.getUnhandledProps)(o,e),f=(0,c.getElementType)(o,e);return i["default"].createElement(f,a({},d,{className:p}),s)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"Container",type:c.META.TYPES.ELEMENT,props:{textAlign:c.SUI.TEXT_ALIGNMENTS}},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,text:u.PropTypes.bool,fluid:u.PropTypes.bool,textAlign:u.PropTypes.oneOf(o._meta.props.textAlign)},t["default"]=o},/*!*****************************************!*\
!*** ./src/elements/Container/index.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Container */278),a=n(o);t["default"]=a["default"]},/*!*****************************************!*\
!*** ./src/elements/Divider/Divider.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.horizontal,r=e.vertical,n=e.inverted,s=e.fitted,u=e.hidden,p=e.section,d=e.clearing,f=e.children,y=e.className,m=(0,l["default"])("ui",(0,c.useKeyOnly)(t,"horizontal"),(0,c.useKeyOnly)(r,"vertical"),(0,c.useKeyOnly)(n,"inverted"),(0,c.useKeyOnly)(s,"fitted"),(0,c.useKeyOnly)(u,"hidden"),(0,c.useKeyOnly)(p,"section"),(0,c.useKeyOnly)(d,"clearing"),"divider",y),v=(0,c.getUnhandledProps)(o,e),h=(0,c.getElementType)(o,e);return i["default"].createElement(h,a({},v,{className:m}),f)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"Divider",type:c.META.TYPES.ELEMENT},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,horizontal:u.PropTypes.bool,vertical:u.PropTypes.bool,inverted:u.PropTypes.bool,fitted:u.PropTypes.bool,hidden:u.PropTypes.bool,section:u.PropTypes.bool,clearing:u.PropTypes.bool},t["default"]=o},/*!***************************************!*\
!*** ./src/elements/Divider/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Divider */280),a=n(o);t["default"]=a["default"]},/*!***********************************!*\
!*** ./src/elements/Flag/Flag.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.name,n=(0,l["default"])(r,t,"flag"),s=(0,c.getUnhandledProps)(o,e),u=(0,c.getElementType)(o,e);return i["default"].createElement(u,a({},s,{className:n}))}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=["ad","andorra","ae","united arab emirates","uae","af","afghanistan","ag","antigua","ai","anguilla","al","albania","am","armenia","an","netherlands antilles","ao","angola","ar","argentina","as","american samoa","at","austria","au","australia","aw","aruba","ax","aland islands","az","azerbaijan","ba","bosnia","bb","barbados","bd","bangladesh","be","belgium","bf","burkina faso","bg","bulgaria","bh","bahrain","bi","burundi","bj","benin","bm","bermuda","bn","brunei","bo","bolivia","br","brazil","bs","bahamas","bt","bhutan","bv","bouvet island","bw","botswana","by","belarus","bz","belize","ca","canada","cc","cocos islands","cd","congo","cf","central african republic","cg","congo brazzaville","ch","switzerland","ci","cote divoire","ck","cook islands","cl","chile","cm","cameroon","cn","china","co","colombia","cr","costa rica","cs","cu","cuba","cv","cape verde","cx","christmas island","cy","cyprus","cz","czech republic","de","germany","dj","djibouti","dk","denmark","dm","dominica","do","dominican republic","dz","algeria","ec","ecuador","ee","estonia","eg","egypt","eh","western sahara","er","eritrea","es","spain","et","ethiopia","eu","european union","fi","finland","fj","fiji","fk","falkland islands","fm","micronesia","fo","faroe islands","fr","france","ga","gabon","gb","united kingdom","gd","grenada","ge","georgia","gf","french guiana","gh","ghana","gi","gibraltar","gl","greenland","gm","gambia","gn","guinea","gp","guadeloupe","gq","equatorial guinea","gr","greece","gs","sandwich islands","gt","guatemala","gu","guam","gw","guinea-bissau","gy","guyana","hk","hong kong","hm","heard island","hn","honduras","hr","croatia","ht","haiti","hu","hungary","id","indonesia","ie","ireland","il","israel","in","india","io","indian ocean territory","iq","iraq","ir","iran","is","iceland","it","italy","jm","jamaica","jo","jordan","jp","japan","ke","kenya","kg","kyrgyzstan","kh","cambodia","ki","kiribati","km","comoros","kn","saint kitts and nevis","kp","north korea","kr","south korea","kw","kuwait","ky","cayman islands","kz","kazakhstan","la","laos","lb","lebanon","lc","saint lucia","li","liechtenstein","lk","sri lanka","lr","liberia","ls","lesotho","lt","lithuania","lu","luxembourg","lv","latvia","ly","libya","ma","morocco","mc","monaco","md","moldova","me","montenegro","mg","madagascar","mh","marshall islands","mk","macedonia","ml","mali","mm","myanmar","burma","mn","mongolia","mo","macau","mp","northern mariana islands","mq","martinique","mr","mauritania","ms","montserrat","mt","malta","mu","mauritius","mv","maldives","mw","malawi","mx","mexico","my","malaysia","mz","mozambique","na","namibia","nc","new caledonia","ne","niger","nf","norfolk island","ng","nigeria","ni","nicaragua","nl","netherlands","no","norway","np","nepal","nr","nauru","nu","niue","nz","new zealand","om","oman","pa","panama","pe","peru","pf","french polynesia","pg","new guinea","ph","philippines","pk","pakistan","pl","poland","pm","saint pierre","pn","pitcairn islands","pr","puerto rico","ps","palestine","pt","portugal","pw","palau","py","paraguay","qa","qatar","re","reunion","ro","romania","rs","serbia","ru","russia","rw","rwanda","sa","saudi arabia","sb","solomon islands","sc","seychelles","gb sct","scotland","sd","sudan","se","sweden","sg","singapore","sh","saint helena","si","slovenia","sj","svalbard","jan mayen","sk","slovakia","sl","sierra leone","sm","san marino","sn","senegal","so","somalia","sr","suriname","st","sao tome","sv","el salvador","sy","syria","sz","swaziland","tc","caicos islands","td","chad","tf","french territories","tg","togo","th","thailand","tj","tajikistan","tk","tokelau","tl","timorleste","tm","turkmenistan","tn","tunisia","to","tonga","tr","turkey","tt","trinidad","tv","tuvalu","tw","taiwan","tz","tanzania","ua","ukraine","ug","uganda","um","us minor islands","us","america","united states","uy","uruguay","uz","uzbekistan","va","vatican city","vc","saint vincent","ve","venezuela","vg","british virgin islands","vi","us virgin islands","vn","vietnam","vu","vanuatu","gb wls","wales","wf","wallis and futuna","ws","samoa","ye","yemen","yt","mayotte","za","south africa","zm","zambia","zw","zimbabwe"];o._meta={name:"Flag",type:c.META.TYPES.ELEMENT,props:{name:p}},o.propTypes={as:c.customPropTypes.as,className:u.PropTypes.string,name:u.PropTypes.oneOf(o._meta.props.name).isRequired},o.defaultProps={as:"i"},t["default"]=o},/*!************************************!*\
!*** ./src/elements/Flag/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Flag */282),a=n(o);t["default"]=a["default"]},/*!***************************************!*\
!*** ./src/elements/Header/Header.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.color,r=e.content,n=e.dividing,a=e.block,s=e.attached,u=e.floated,c=e.inverted,f=e.disabled,m=e.sub,h=e.size,b=e.textAlign,T=e.icon,O=e.image,_=e.children,E=e.className,j=e.subheader,w=(0,i["default"])("ui",h,t,(0,d.useKeyOrValueAndKey)(s,"attached"),(0,d.useKeyOnly)(a,"block"),(0,d.useKeyOnly)(f,"disabled"),(0,d.useKeyOnly)(n,"dividing"),(0,d.useValueAndKey)(u,"floated"),(0,d.useKeyOnly)(T===!0,"icon"),(0,d.useKeyOnly)(O===!0,"image"),(0,d.useKeyOnly)(c,"inverted"),(0,d.useKeyOnly)(m,"sub"),(0,d.useTextAlignProp)(b),E,"header"),M=(0,d.getUnhandledProps)(o,e),S=(0,d.getElementType)(o,e);if(_)return p["default"].createElement(S,l({},M,{className:w}),_);var x=y["default"].create(T),A=v["default"].create(O);return x||A?p["default"].createElement(S,l({},M,{className:w}),x||A,(r||j)&&p["default"].createElement(P["default"],null,r,(0,d.createShorthand)(g["default"],function(e){return{content:e}},j))):p["default"].createElement(S,l({},M,{className:w}),r,(0,d.createShorthand)(g["default"],function(e){return{content:e}},j))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ../../elements/Icon */10),y=n(f),m=r(/*! ../../elements/Image */28),v=n(m),h=r(/*! ./HeaderSubheader */157),g=n(h),b=r(/*! ./HeaderContent */156),P=n(b);o._meta={name:"Header",type:d.META.TYPES.ELEMENT,props:{attached:["top","bottom"],color:d.SUI.COLORS,size:(0,s["default"])(d.SUI.SIZES,"big","massive"),floated:d.SUI.FLOATS,textAlign:d.SUI.TEXT_ALIGNMENTS}},o.propTypes={as:d.customPropTypes.as,className:c.PropTypes.string,children:c.PropTypes.node,content:d.customPropTypes.contentShorthand,icon:d.customPropTypes.every([d.customPropTypes.disallow(["image"]),c.PropTypes.oneOfType([c.PropTypes.bool,d.customPropTypes.itemShorthand])]),image:d.customPropTypes.every([d.customPropTypes.disallow(["icon"]),c.PropTypes.oneOfType([c.PropTypes.bool,d.customPropTypes.itemShorthand])]),color:c.PropTypes.oneOf(o._meta.props.color),dividing:c.PropTypes.bool,block:c.PropTypes.bool,attached:c.PropTypes.oneOfType([c.PropTypes.oneOf(o._meta.props.attached),c.PropTypes.bool]),floated:c.PropTypes.oneOf(o._meta.props.floated),inverted:c.PropTypes.bool,disabled:c.PropTypes.bool,sub:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),subheader:d.customPropTypes.itemShorthand,textAlign:c.PropTypes.oneOf(o._meta.props.textAlign)},o.Content=P["default"],o.Subheader=g["default"],t["default"]=o},/*!**************************************!*\
!*** ./src/elements/Header/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Header */284),a=n(o);t["default"]=a["default"]},/*!*************************************!*\
!*** ./src/elements/Input/Input.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.action,r=e.actionPosition,n=e.children,a=e.className,l=e.disabled,i=e.error,d=e.focus,y=e.fluid,h=e.icon,b=e.iconPosition,T=e.inverted,E=e.label,j=e.labelPosition,w=e.loading,M=e.size,S=e.type,x=e.input,A=e.transparent,N=(0,m["default"])("ui",M,(0,v.useValueAndKey)(r,"action")||(0,v.useKeyOnly)(t,"action"),(0,v.useKeyOnly)(l,"disabled"),(0,v.useKeyOnly)(i,"error"),(0,v.useKeyOnly)(d,"focus"),(0,v.useKeyOnly)(y,"fluid"),(0,v.useKeyOnly)(T,"inverted"),(0,v.useValueAndKey)(j,"labeled")||(0,v.useKeyOnly)(E,"labeled"),(0,v.useKeyOnly)(w,"loading"),(0,v.useKeyOnly)(A,"transparent"),(0,v.useValueAndKey)(b,"icon")||(0,v.useKeyOnly)(h,"icon"),a,"input"),k=(0,v.getUnhandledProps)(o,e),C=(0,c["default"])(k,_),I=(0,u["default"])(e,_),K=(0,v.getElementType)(o,e);if(n)return f["default"].createElement(K,p({},C,{className:N}),n);var L=g["default"].create(t,function(e){return{className:(0,m["default"])(!(0,s["default"])(e.className,"button")&&"button")}}),U=P["default"].create(h),D=O["default"].create(E,function(e){return{className:(0,m["default"])(!(0,s["default"])(e.className,"label")&&"label",(0,s["default"])(j,"corner")&&j)}});return f["default"].createElement(K,p({},C,{className:N}),"left"===r&&L,"left"===b&&U,"right"!==j&&D,(0,v.createHTMLInput)(x||S,I),"left"!==r&&L,"left"!==b&&U,"right"===j&&D)}Object.defineProperty(t,"__esModule",{value:!0}),t.htmlInputPropNames=void 0;var a=r(/*! lodash/includes */65),s=n(a),l=r(/*! lodash/pick */41),u=n(l),i=r(/*! lodash/omit */40),c=n(i),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d=r(/*! react */1),f=n(d),y=r(/*! classnames */3),m=n(y),v=r(/*! ../../lib */2),h=r(/*! ../../elements/Button */74),g=n(h),b=r(/*! ../../elements/Icon */10),P=n(b),T=r(/*! ../../elements/Label */77),O=n(T),_=t.htmlInputPropNames=["selected","defaultValue","defaultChecked","autoComplete","autoFocus","checked","form","max","maxLength","min","name","onChange","pattern","placeholder","readOnly","required","step","type","value"];o._meta={name:"Input",type:v.META.TYPES.ELEMENT,props:{actionPosition:["left"],iconPosition:["left"],labelPosition:["left","right","left corner","right corner"],size:v.SUI.SIZES}},o.defaultProps={type:"text"},o.propTypes={as:v.customPropTypes.as,action:d.PropTypes.oneOfType([d.PropTypes.bool,v.customPropTypes.itemShorthand]),actionPosition:d.PropTypes.oneOf(o._meta.props.actionPosition),children:d.PropTypes.node,className:d.PropTypes.string,disabled:d.PropTypes.bool,error:d.PropTypes.bool,focus:d.PropTypes.bool,fluid:d.PropTypes.bool,icon:d.PropTypes.oneOfType([d.PropTypes.bool,v.customPropTypes.itemShorthand]),iconPosition:d.PropTypes.oneOf(o._meta.props.iconPosition),inverted:d.PropTypes.bool,input:v.customPropTypes.itemShorthand,label:v.customPropTypes.itemShorthand,labelPosition:d.PropTypes.oneOf(o._meta.props.labelPosition),loading:d.PropTypes.bool,size:d.PropTypes.oneOf(o._meta.props.size),transparent:d.PropTypes.bool,type:d.PropTypes.string},t["default"]=o},/*!***********************************!*\
!*** ./src/elements/List/List.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.animated,r=e.bulleted,n=e.celled,a=e.children,u=e.className,c=e.divided,f=e.floated,y=e.horizontal,m=e.inverted,v=e.items,h=e.link,g=e.ordered,b=e.relaxed,P=e.size,T=e.selection,_=e.verticalAlign,E=(0,i["default"])("ui",P,(0,d.useKeyOnly)(t,"animated"),(0,d.useKeyOnly)(r,"bulleted"),(0,d.useKeyOnly)(n,"celled"),(0,d.useKeyOnly)(c,"divided"),(0,d.useKeyOnly)(y,"horizontal"),(0,d.useKeyOnly)(m,"inverted"),(0,d.useKeyOnly)(h,"link"),(0,d.useKeyOnly)(g,"ordered"),(0,d.useKeyOnly)(T,"selection"),(0,d.useKeyOrValueAndKey)(b,"relaxed"),(0,d.useValueAndKey)(f,"floated"),(0,d.useVerticalAlignProp)(_),"list",u),j=(0,d.getUnhandledProps)(o,e),w=(0,d.getElementType)(o,e);return a?p["default"].createElement(w,l({},j,{className:E}),a):p["default"].createElement(w,l({},j,{className:E}),(0,s["default"])(v,function(e){return O["default"].create(e)}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/map */9),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./ListContent */78),y=n(f),m=r(/*! ./ListDescription */44),v=n(m),h=r(/*! ./ListHeader */45),g=n(h),b=r(/*! ./ListIcon */79),P=n(b),T=r(/*! ./ListItem */163),O=n(T),_=r(/*! ./ListList */164),E=n(_);o._meta={name:"List",type:d.META.TYPES.ELEMENT,props:{floated:d.SUI.FLOATS,relaxed:["very"],size:d.SUI.SIZES,verticalAlign:d.SUI.VERTICAL_ALIGNMENTS}},o.propTypes={as:d.customPropTypes.as,animated:c.PropTypes.bool,bulleted:c.PropTypes.bool,celled:c.PropTypes.bool,children:c.PropTypes.node,className:c.PropTypes.string,divided:c.PropTypes.bool,floated:c.PropTypes.oneOf(o._meta.props.floated),horizontal:c.PropTypes.bool,inverted:c.PropTypes.bool,items:d.customPropTypes.collectionShorthand,link:c.PropTypes.bool,ordered:c.PropTypes.bool,relaxed:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.oneOf(o._meta.props.relaxed)]),selection:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),verticalAlign:c.PropTypes.oneOf(o._meta.props.verticalAlign)},o.Content=y["default"],o.Description=v["default"],o.Header=g["default"],o.Icon=P["default"],o.Item=O["default"],o.List=E["default"],t["default"]=o},/*!************************************!*\
!*** ./src/elements/List/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./List */287),a=n(o);t["default"]=a["default"]},/*!***************************************!*\
!*** ./src/elements/Loader/Loader.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.children,n=e.className,s=e.content,u=e.disabled,p=e.indeterminate,d=e.inline,f=e.inverted,y=e.size,m=(0,l["default"])("ui",y,(0,c.useKeyOnly)(t,"active"),(0,c.useKeyOnly)(u,"disabled"),(0,c.useKeyOnly)(p,"indeterminate"),(0,c.useKeyOnly)(f,"inverted"),(0,c.useKeyOnly)(r||s,"text"),(0,c.useKeyOrValueAndKey)(d,"inline"),"loader",n),v=(0,c.getUnhandledProps)(o,e),h=(0,c.getElementType)(o,e);return i["default"].createElement(h,a({},v,{className:m}),r||s)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2);o._meta={name:"Loader",type:c.META.TYPES.ELEMENT,props:{inline:["centered"],size:c.SUI.SIZES}},o.propTypes={as:c.customPropTypes.as,active:u.PropTypes.bool,children:u.PropTypes.node,className:u.PropTypes.string,content:c.customPropTypes.contentShorthand,disabled:u.PropTypes.bool,indeterminate:u.PropTypes.bool,inline:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.oneOf(o._meta.props.inline)]),inverted:u.PropTypes.bool,size:u.PropTypes.oneOf(o._meta.props.size)},t["default"]=o},/*!**************************************!*\
!*** ./src/elements/Loader/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Loader */289),a=n(o);t["default"]=a["default"]},/*!***********************************!*\
!*** ./src/elements/Rail/Rail.js ***!
\***********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.attached,r=e.children,n=e.className,a=e.close,s=e.dividing,u=e.internal,c=e.position,f=e.size,y=(0,i["default"])("ui",c,f,(0,d.useKeyOnly)(t,"attached"),(0,d.useKeyOnly)(s,"dividing"),(0,d.useKeyOnly)(u,"internal"),(0,d.useKeyOrValueAndKey)(a,"close"),"rail",n),m=(0,d.getUnhandledProps)(o,e),v=(0,d.getElementType)(o,e);return p["default"].createElement(v,l({},m,{className:y}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2);o._meta={name:"Rail",type:d.META.TYPES.ELEMENT,props:{close:["very"],position:d.SUI.FLOATS,size:(0,s["default"])(d.SUI.SIZES,"medium")}},o.propTypes={as:d.customPropTypes.as,attached:c.PropTypes.bool,children:c.PropTypes.node,className:c.PropTypes.string,close:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.oneOf(o._meta.props.close)]),dividing:c.PropTypes.bool,internal:c.PropTypes.bool,position:c.PropTypes.oneOf(o._meta.props.position).isRequired,size:c.PropTypes.oneOf(o._meta.props.size)},t["default"]=o},/*!************************************!*\
!*** ./src/elements/Rail/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Rail */291),a=n(o);t["default"]=a["default"]},/*!*****************************************!*\
!*** ./src/elements/Segment/Segment.js ***!
\*****************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.attached,r=e.basic,n=e.children,a=e.circular,s=e.className,u=e.clearing,c=e.color,f=e.compact,y=e.disabled,m=e.floated,v=e.inverted,h=e.loading,g=e.padded,b=e.piled,P=e.raised,T=e.secondary,O=e.size,_=e.stacked,E=e.tertiary,j=e.textAlign,w=e.vertical,M=(0,i["default"])("ui",c,O,(0,d.useKeyOrValueAndKey)(t,"attached"),(0,d.useKeyOnly)(r,"basic"),(0,d.useKeyOnly)(a,"circular"),(0,d.useKeyOnly)(u,"clearing"),(0,d.useKeyOnly)(f,"compact"),(0,d.useKeyOnly)(y,"disabled"),(0,d.useValueAndKey)(m,"floated"),(0,d.useKeyOnly)(v,"inverted"),(0,d.useKeyOnly)(h,"loading"),(0,d.useKeyOrValueAndKey)(g,"padded"),(0,d.useKeyOnly)(b,"piled"),(0,d.useKeyOnly)(P,"raised"),(0,d.useKeyOnly)(T,"secondary"),(0,d.useKeyOnly)(_,"stacked"),(0,d.useKeyOnly)(E,"tertiary"),(0,d.useTextAlignProp)(j),(0,d.useKeyOnly)(w,"vertical"),s,"segment"),S=(0,d.getUnhandledProps)(o,e),x=(0,d.getElementType)(o,e);return p["default"].createElement(x,l({},S,{className:M}),n)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=r(/*! ./SegmentGroup */165),y=n(f);o.Group=y["default"],o._meta={name:"Segment",type:d.META.TYPES.ELEMENT,props:{attached:["top","bottom"],color:d.SUI.COLORS,floated:d.SUI.FLOATS,padded:["very"],size:(0,s["default"])(d.SUI.SIZES,"medium"),textAlign:d.SUI.TEXT_ALIGNMENTS}},o.propTypes={as:d.customPropTypes.as,attached:c.PropTypes.oneOfType([c.PropTypes.oneOf(o._meta.props.attached),c.PropTypes.bool]),basic:c.PropTypes.bool,children:c.PropTypes.node,circular:c.PropTypes.bool,className:c.PropTypes.string,clearing:c.PropTypes.bool,color:c.PropTypes.oneOf(o._meta.props.color),compact:c.PropTypes.bool,disabled:c.PropTypes.bool,floated:c.PropTypes.oneOf(o._meta.props.floated),inverted:c.PropTypes.bool,loading:c.PropTypes.bool,padded:c.PropTypes.oneOfType([c.PropTypes.bool,c.PropTypes.oneOf(o._meta.props.padded)]),piled:c.PropTypes.bool,raised:c.PropTypes.bool,secondary:c.PropTypes.bool,size:c.PropTypes.oneOf(o._meta.props.size),stacked:c.PropTypes.bool,tertiary:c.PropTypes.bool,textAlign:c.PropTypes.oneOf(o._meta.props.textAlign),vertical:c.PropTypes.bool},t["default"]=o},/*!***************************************!*\
!*** ./src/elements/Segment/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Segment */293),a=n(o);t["default"]=a["default"]},/*!************************************!*\
!*** ./src/elements/Step/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Step */166),a=n(o);t["default"]=a["default"]},/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(/*! ./addons/Confirm */261);Object.defineProperty(t,"Confirm",{enumerable:!0,get:function(){return n(o)["default"]}});var a=r(/*! ./addons/Portal */70);Object.defineProperty(t,"Portal",{enumerable:!0,get:function(){return n(a)["default"]}});var s=r(/*! ./addons/Radio */71);Object.defineProperty(t,"Radio",{enumerable:!0,get:function(){return n(s)["default"]}});var l=r(/*! ./addons/Select */128);Object.defineProperty(t,"Select",{enumerable:!0,get:function(){return n(l)["default"]}});var u=r(/*! ./addons/TextArea */129);Object.defineProperty(t,"TextArea",{enumerable:!0,get:function(){return n(u)["default"]}});var i=r(/*! ./collections/Breadcrumb */267);Object.defineProperty(t,"Breadcrumb",{enumerable:!0,get:function(){return n(i)["default"]}});var c=r(/*! ./collections/Breadcrumb/BreadcrumbDivider */130);Object.defineProperty(t,"BreadcrumbDivider",{enumerable:!0,get:function(){return n(c)["default"]}});var p=r(/*! ./collections/Breadcrumb/BreadcrumbSection */131);Object.defineProperty(t,"BreadcrumbSection",{enumerable:!0,get:function(){return n(p)["default"]}});var d=r(/*! ./collections/Form */269);Object.defineProperty(t,"Form",{enumerable:!0,get:function(){return n(d)["default"]}});var f=r(/*! ./collections/Form/FormButton */132);Object.defineProperty(t,"FormButton",{enumerable:!0,get:function(){return n(f)["default"]}});var y=r(/*! ./collections/Form/FormCheckbox */133);Object.defineProperty(t,"FormCheckbox",{enumerable:!0,get:function(){return n(y)["default"]}});var m=r(/*! ./collections/Form/FormDropdown */134);Object.defineProperty(t,"FormDropdown",{enumerable:!0,get:function(){return n(m)["default"]}});var v=r(/*! ./collections/Form/FormField */16);Object.defineProperty(t,"FormField",{enumerable:!0,get:function(){return n(v)["default"]}});var h=r(/*! ./collections/Form/FormGroup */135);Object.defineProperty(t,"FormGroup",{enumerable:!0,get:function(){return n(h)["default"]}});var g=r(/*! ./collections/Form/FormInput */136);Object.defineProperty(t,"FormInput",{enumerable:!0,get:function(){return n(g)["default"]}});var b=r(/*! ./collections/Form/FormRadio */137);Object.defineProperty(t,"FormRadio",{enumerable:!0,get:function(){return n(b)["default"]}});var P=r(/*! ./collections/Form/FormSelect */138);Object.defineProperty(t,"FormSelect",{enumerable:!0,get:function(){return n(P)["default"]}});var T=r(/*! ./collections/Form/FormTextArea */139);Object.defineProperty(t,"FormTextArea",{enumerable:!0,get:function(){return n(T)["default"]}});var O=r(/*! ./collections/Grid */271);Object.defineProperty(t,"Grid",{enumerable:!0,get:function(){return n(O)["default"]}});var _=r(/*! ./collections/Grid/GridColumn */140);Object.defineProperty(t,"GridColumn",{enumerable:!0,get:function(){return n(_)["default"]}});var E=r(/*! ./collections/Grid/GridRow */141);Object.defineProperty(t,"GridRow",{enumerable:!0,get:function(){return n(E)["default"]}});var j=r(/*! ./collections/Menu */273);Object.defineProperty(t,"Menu",{enumerable:!0,get:function(){return n(j)["default"]}});var w=r(/*! ./collections/Menu/MenuHeader */142);Object.defineProperty(t,"MenuHeader",{enumerable:!0,get:function(){return n(w)["default"]}});var M=r(/*! ./collections/Menu/MenuItem */143);Object.defineProperty(t,"MenuItem",{enumerable:!0,get:function(){return n(M)["default"]}});var S=r(/*! ./collections/Menu/MenuMenu */144);Object.defineProperty(t,"MenuMenu",{enumerable:!0,get:function(){return n(S)["default"]}});var x=r(/*! ./collections/Message */275);Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return n(x)["default"]}});var A=r(/*! ./collections/Message/MessageContent */145);Object.defineProperty(t,"MessageContent",{enumerable:!0,get:function(){return n(A)["default"]}});var N=r(/*! ./collections/Message/MessageHeader */146);Object.defineProperty(t,"MessageHeader",{enumerable:!0,get:function(){return n(N)["default"]}});var k=r(/*! ./collections/Message/MessageItem */72);Object.defineProperty(t,"MessageItem",{enumerable:!0,get:function(){return n(k)["default"]}});var C=r(/*! ./collections/Message/MessageList */147);Object.defineProperty(t,"MessageList",{enumerable:!0,get:function(){return n(C)["default"]}});var I=r(/*! ./collections/Table */277);Object.defineProperty(t,"Table",{enumerable:!0,get:function(){return n(I)["default"]}});var K=r(/*! ./collections/Table/TableBody */148);Object.defineProperty(t,"TableBody",{enumerable:!0,get:function(){return n(K)["default"]}});var L=r(/*! ./collections/Table/TableCell */42);Object.defineProperty(t,"TableCell",{enumerable:!0,get:function(){return n(L)["default"]}});var U=r(/*! ./collections/Table/TableFooter */149);Object.defineProperty(t,"TableFooter",{enumerable:!0,get:function(){return n(U)["default"]}});var D=r(/*! ./collections/Table/TableHeader */73);Object.defineProperty(t,"TableHeader",{enumerable:!0,get:function(){return n(D)["default"]}});var R=r(/*! ./collections/Table/TableHeaderCell */150);Object.defineProperty(t,"TableHeaderCell",{enumerable:!0,get:function(){return n(R)["default"]}});var z=r(/*! ./collections/Table/TableRow */151);Object.defineProperty(t,"TableRow",{enumerable:!0,get:function(){return n(z)["default"]}});var W=r(/*! ./elements/Button/Button */152);Object.defineProperty(t,"Button",{enumerable:!0,get:function(){return n(W)["default"]}});var F=r(/*! ./elements/Button/ButtonContent */153);Object.defineProperty(t,"ButtonContent",{enumerable:!0,get:function(){return n(F)["default"]}});var V=r(/*! ./elements/Button/ButtonGroup */154);Object.defineProperty(t,"ButtonGroup",{enumerable:!0,get:function(){return n(V)["default"]}});var B=r(/*! ./elements/Button/ButtonOr */155);Object.defineProperty(t,"ButtonOr",{enumerable:!0,get:function(){return n(B)["default"]}});var Y=r(/*! ./elements/Container */279);Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return n(Y)["default"]}});var q=r(/*! ./elements/Divider */281);Object.defineProperty(t,"Divider",{enumerable:!0,get:function(){return n(q)["default"]}});var H=r(/*! ./elements/Flag */283);Object.defineProperty(t,"Flag",{enumerable:!0,get:function(){return n(H)["default"]}});var G=r(/*! ./elements/Header */285);Object.defineProperty(t,"Header",{enumerable:!0,get:function(){return n(G)["default"]}});var Z=r(/*! ./elements/Header/HeaderContent */156);Object.defineProperty(t,"HeaderContent",{enumerable:!0,get:function(){return n(Z)["default"]}});var $=r(/*! ./elements/Header/HeaderSubheader */157);Object.defineProperty(t,"HeaderSubheader",{enumerable:!0,get:function(){return n($)["default"]}});var X=r(/*! ./elements/Icon */10);Object.defineProperty(t,"Icon",{enumerable:!0,get:function(){return n(X)["default"]}});var Q=r(/*! ./elements/Icon/IconGroup */158);Object.defineProperty(t,"IconGroup",{enumerable:!0,get:function(){return n(Q)["default"]}});var J=r(/*! ./elements/Image */28);Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return n(J)["default"]}});var ee=r(/*! ./elements/Image/ImageGroup */160);Object.defineProperty(t,"ImageGroup",{enumerable:!0,get:function(){return n(ee)["default"]}});var te=r(/*! ./elements/Input */75);Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return n(te)["default"]}});var re=r(/*! ./elements/Label */77);Object.defineProperty(t,"Label",{enumerable:!0,get:function(){return n(re)["default"]}});var ne=r(/*! ./elements/Label/LabelDetail */161);Object.defineProperty(t,"LabelDetail",{enumerable:!0,get:function(){return n(ne)["default"]}});var oe=r(/*! ./elements/Label/LabelGroup */162);Object.defineProperty(t,"LabelGroup",{enumerable:!0,get:function(){return n(oe)["default"]}});var ae=r(/*! ./elements/List */288);Object.defineProperty(t,"List",{enumerable:!0,get:function(){return n(ae)["default"]}});var se=r(/*! ./elements/List/ListContent */78);Object.defineProperty(t,"ListContent",{enumerable:!0,get:function(){return n(se)["default"]}});var le=r(/*! ./elements/List/ListDescription */44);Object.defineProperty(t,"ListDescription",{enumerable:!0,get:function(){return n(le)["default"]}});var ue=r(/*! ./elements/List/ListHeader */45);Object.defineProperty(t,"ListHeader",{enumerable:!0,get:function(){return n(ue)["default"]}});var ie=r(/*! ./elements/List/ListIcon */79);Object.defineProperty(t,"ListIcon",{enumerable:!0,get:function(){return n(ie)["default"]}});var ce=r(/*! ./elements/List/ListItem */163);Object.defineProperty(t,"ListItem",{enumerable:!0,get:function(){return n(ce)["default"]}});var pe=r(/*! ./elements/List/ListList */164);Object.defineProperty(t,"ListList",{enumerable:!0,get:function(){return n(pe)["default"]}});var de=r(/*! ./elements/Loader */290);Object.defineProperty(t,"Loader",{enumerable:!0,get:function(){return n(de)["default"]}});var fe=r(/*! ./elements/Rail */292);Object.defineProperty(t,"Rail",{enumerable:!0,get:function(){return n(fe)["default"]}});var ye=r(/*! ./elements/Segment */294);Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n(ye)["default"]}});var me=r(/*! ./elements/Segment/SegmentGroup */165);Object.defineProperty(t,"SegmentGroup",{enumerable:!0,get:function(){return n(me)["default"]}});var ve=r(/*! ./elements/Step */295);Object.defineProperty(t,"Step",{enumerable:!0,get:function(){return n(ve)["default"]}});var he=r(/*! ./elements/Step/StepContent */167);Object.defineProperty(t,"StepContent",{enumerable:!0,get:function(){return n(he)["default"]}});var ge=r(/*! ./elements/Step/StepDescription */80);Object.defineProperty(t,"StepDescription",{enumerable:!0,get:function(){return n(ge)["default"]}});var be=r(/*! ./elements/Step/StepGroup */168);Object.defineProperty(t,"StepGroup",{enumerable:!0,get:function(){return n(be)["default"]}});var Pe=r(/*! ./elements/Step/StepTitle */81);Object.defineProperty(t,"StepTitle",{enumerable:!0,get:function(){return n(Pe)["default"]}});var Te=r(/*! ./modules/Accordion/Accordion */309);Object.defineProperty(t,"Accordion",{enumerable:!0,get:function(){return n(Te)["default"]}});var Oe=r(/*! ./modules/Accordion/AccordionContent */169);Object.defineProperty(t,"AccordionContent",{enumerable:!0,get:function(){return n(Oe)["default"]}});var _e=r(/*! ./modules/Accordion/AccordionTitle */170);Object.defineProperty(t,"AccordionTitle",{enumerable:!0,get:function(){return n(_e)["default"]}});var Ee=r(/*! ./modules/Checkbox */46);Object.defineProperty(t,"Checkbox",{enumerable:!0,get:function(){return n(Ee)["default"]}});var je=r(/*! ./modules/Dropdown */83);Object.defineProperty(t,"Dropdown",{enumerable:!0,get:function(){return n(je)["default"]}});var we=r(/*! ./modules/Dropdown/DropdownDivider */171);Object.defineProperty(t,"DropdownDivider",{enumerable:!0,get:function(){return n(we)["default"]}});var Me=r(/*! ./modules/Dropdown/DropdownHeader */172);Object.defineProperty(t,"DropdownHeader",{enumerable:!0,get:function(){return n(Me)["default"]}});var Se=r(/*! ./modules/Dropdown/DropdownItem */173);Object.defineProperty(t,"DropdownItem",{enumerable:!0,get:function(){return n(Se)["default"]}});var xe=r(/*! ./modules/Dropdown/DropdownMenu */174);Object.defineProperty(t,"DropdownMenu",{enumerable:!0,get:function(){return n(xe)["default"]}});var Ae=r(/*! ./modules/Modal */179);Object.defineProperty(t,"Modal",{enumerable:!0,get:function(){return n(Ae)["default"]}});var Ne=r(/*! ./modules/Modal/ModalActions */175);Object.defineProperty(t,"ModalActions",{enumerable:!0,get:function(){return n(Ne)["default"]}});var ke=r(/*! ./modules/Modal/ModalContent */176);Object.defineProperty(t,"ModalContent",{enumerable:!0,get:function(){return n(ke)["default"]}});var Ce=r(/*! ./modules/Modal/ModalDescription */177);Object.defineProperty(t,"ModalDescription",{enumerable:!0,get:function(){return n(Ce)["default"]}});var Ie=r(/*! ./modules/Modal/ModalHeader */178);Object.defineProperty(t,"ModalHeader",{enumerable:!0,get:function(){return n(Ie)["default"]}});var Ke=r(/*! ./modules/Popup */314);Object.defineProperty(t,"Popup",{enumerable:!0,get:function(){return n(Ke)["default"]}});var Le=r(/*! ./modules/Popup/PopupContent */180);Object.defineProperty(t,"PopupContent",{enumerable:!0,get:function(){return n(Le)["default"]}});var Ue=r(/*! ./modules/Popup/PopupHeader */181);Object.defineProperty(t,"PopupHeader",{enumerable:!0,get:function(){return n(Ue)["default"]}});var De=r(/*! ./modules/Progress */316);Object.defineProperty(t,"Progress",{enumerable:!0,get:function(){return n(De)["default"]}});var Re=r(/*! ./modules/Rating */319);Object.defineProperty(t,"Rating",{enumerable:!0,get:function(){return n(Re)["default"]}});var ze=r(/*! ./modules/Search */321);Object.defineProperty(t,"Search",{enumerable:!0,get:function(){return n(ze)["default"]}});var We=r(/*! ./modules/Search/SearchCategory */182);Object.defineProperty(t,"SearchCategory",{enumerable:!0,get:function(){return n(We)["default"]}});var Fe=r(/*! ./modules/Search/SearchResult */183);Object.defineProperty(t,"SearchResult",{enumerable:!0,get:function(){return n(Fe)["default"]}});var Ve=r(/*! ./modules/Search/SearchResults */184);Object.defineProperty(t,"SearchResults",{enumerable:!0,get:function(){return n(Ve)["default"]}});var Be=r(/*! ./views/Card/Card */185);Object.defineProperty(t,"Card",{enumerable:!0,get:function(){return n(Be)["default"]}});var Ye=r(/*! ./views/Card/CardContent */186);Object.defineProperty(t,"CardContent",{enumerable:!0,get:function(){return n(Ye)["default"]}});var qe=r(/*! ./views/Card/CardDescription */84);Object.defineProperty(t,"CardDescription",{enumerable:!0,get:function(){return n(qe)["default"]}});var He=r(/*! ./views/Card/CardGroup */187);Object.defineProperty(t,"CardGroup",{enumerable:!0,get:function(){return n(He)["default"]}});var Ge=r(/*! ./views/Card/CardHeader */85);Object.defineProperty(t,"CardHeader",{enumerable:!0,get:function(){return n(Ge)["default"]}});var Ze=r(/*! ./views/Card/CardMeta */86);Object.defineProperty(t,"CardMeta",{enumerable:!0,get:function(){return n(Ze)["default"]}});var $e=r(/*! ./views/Comment */323);Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return n($e)["default"]}});var Xe=r(/*! ./views/Comment/CommentAction */188);Object.defineProperty(t,"CommentAction",{enumerable:!0,get:function(){return n(Xe)["default"]}});var Qe=r(/*! ./views/Comment/CommentActions */189);Object.defineProperty(t,"CommentActions",{enumerable:!0,get:function(){return n(Qe)["default"]}});var Je=r(/*! ./views/Comment/CommentAuthor */190);Object.defineProperty(t,"CommentAuthor",{enumerable:!0,get:function(){return n(Je)["default"]}});var et=r(/*! ./views/Comment/CommentAvatar */191);Object.defineProperty(t,"CommentAvatar",{enumerable:!0,get:function(){return n(et)["default"]}});var tt=r(/*! ./views/Comment/CommentContent */192);Object.defineProperty(t,"CommentContent",{enumerable:!0,get:function(){return n(tt)["default"]}});var rt=r(/*! ./views/Comment/CommentGroup */193);Object.defineProperty(t,"CommentGroup",{enumerable:!0,get:function(){return n(rt)["default"]}});var nt=r(/*! ./views/Comment/CommentMetadata */194);Object.defineProperty(t,"CommentMetadata",{enumerable:!0,get:function(){return n(nt)["default"]}});var ot=r(/*! ./views/Comment/CommentText */195);Object.defineProperty(t,"CommentText",{enumerable:!0,get:function(){return n(ot)["default"]}});var at=r(/*! ./views/Feed */325);Object.defineProperty(t,"Feed",{enumerable:!0,get:function(){return n(at)["default"]}});var st=r(/*! ./views/Feed/FeedContent */87);Object.defineProperty(t,"FeedContent",{enumerable:!0,get:function(){return n(st)["default"]}});var lt=r(/*! ./views/Feed/FeedDate */47);Object.defineProperty(t,"FeedDate",{enumerable:!0,get:function(){return n(lt)["default"]}});var ut=r(/*! ./views/Feed/FeedEvent */196);Object.defineProperty(t,"FeedEvent",{enumerable:!0,get:function(){return n(ut)["default"]}});var it=r(/*! ./views/Feed/FeedExtra */88);Object.defineProperty(t,"FeedExtra",{enumerable:!0,get:function(){return n(it)["default"]}});var ct=r(/*! ./views/Feed/FeedLabel */89);Object.defineProperty(t,"FeedLabel",{enumerable:!0,get:function(){return n(ct)["default"]}});var pt=r(/*! ./views/Feed/FeedLike */90);Object.defineProperty(t,"FeedLike",{enumerable:!0,get:function(){return n(pt)["default"]}});var dt=r(/*! ./views/Feed/FeedMeta */91);Object.defineProperty(t,"FeedMeta",{enumerable:!0,get:function(){return n(dt)["default"]}});var ft=r(/*! ./views/Feed/FeedSummary */92);Object.defineProperty(t,"FeedSummary",{enumerable:!0,get:function(){return n(ft)["default"]}});var yt=r(/*! ./views/Feed/FeedUser */93);Object.defineProperty(t,"FeedUser",{enumerable:!0,get:function(){return n(yt)["default"]}});var mt=r(/*! ./views/Item */326);Object.defineProperty(t,"Item",{enumerable:!0,get:function(){return n(mt)["default"]}});var vt=r(/*! ./views/Item/ItemContent */198);Object.defineProperty(t,"ItemContent",{enumerable:!0,get:function(){return n(vt)["default"]}});var ht=r(/*! ./views/Item/ItemDescription */94);Object.defineProperty(t,"ItemDescription",{enumerable:!0,get:function(){return n(ht)["default"]}});var gt=r(/*! ./views/Item/ItemExtra */95);Object.defineProperty(t,"ItemExtra",{enumerable:!0,get:function(){return n(gt)["default"]}});var bt=r(/*! ./views/Item/ItemGroup */199);Object.defineProperty(t,"ItemGroup",{enumerable:!0,get:function(){return n(bt)["default"]}});var Pt=r(/*! ./views/Item/ItemHeader */96);Object.defineProperty(t,"ItemHeader",{enumerable:!0,get:function(){return n(Pt)["default"]}});var Tt=r(/*! ./views/Item/ItemImage */200);Object.defineProperty(t,"ItemImage",{enumerable:!0,get:function(){return n(Tt)["default"]}});var Ot=r(/*! ./views/Item/ItemMeta */97);Object.defineProperty(t,"ItemMeta",{enumerable:!0,get:function(){return n(Ot)["default"]}});var _t=r(/*! ./views/Statistic */327);Object.defineProperty(t,"Statistic",{enumerable:!0,get:function(){return n(_t)["default"]}});var Et=r(/*! ./views/Statistic/StatisticGroup */202);Object.defineProperty(t,"StatisticGroup",{enumerable:!0,get:function(){return n(Et)["default"]}});var jt=r(/*! ./views/Statistic/StatisticLabel */203);Object.defineProperty(t,"StatisticLabel",{enumerable:!0,get:function(){return n(jt)["default"]}});var wt=r(/*! ./views/Statistic/StatisticValue */204);Object.defineProperty(t,"StatisticValue",{enumerable:!0,get:function(){return n(wt)["default"]}})},/*!********************************************!*\
!*** ./src/lib/AutoControlledComponent.js ***!
\********************************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/omit */40),u=n(l),i=r(/*! lodash/difference */445),c=n(i),p=r(/*! lodash/pick */41),d=n(p),f=r(/*! lodash/filter */121),y=n(f),m=r(/*! lodash/isEmpty */124),v=n(m),h=r(/*! lodash/keys */8),g=n(h),b=r(/*! lodash/intersection */470),P=n(b),T=r(/*! lodash/each */64),O=n(T),_=r(/*! lodash/has */23),E=n(_),j=r(/*! lodash/transform */257),w=n(j),M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),x=function C(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:C(o,t,r)}if("value"in n)return n.value;var a=n.get;if(void 0!==a)return a.call(r)},A=r(/*! react */1),N=function(e){return"default"+(e[0].toUpperCase()+e.slice(1))},k=function(t){function r(){var t,n,s,l;o(this,r);for(var i=arguments.length,p=Array(i),f=0;f<i;f++)p[f]=arguments[f];return n=s=a(this,(t=r.__proto__||Object.getPrototypeOf(r)).call.apply(t,[this].concat(p))),s.trySetState=function(t,r){var n=s.constructor.autoControlledProps;if("production"!==e.env.NODE_ENV){var o=s.constructor.name,a=(0,c["default"])((0,g["default"])(t),n);(0,v["default"])(a)||console.error([o+' called trySetState() with controlled props: "'+a+'".',"State will not be set.","Only props in static autoControlledProps will be set on state."].join(" "))}var l=(0,u["default"])((0,d["default"])(t,n),(0,g["default"])(s.props));r&&(l=M({},l,r)),(0,v["default"])(l)||s.setState(l)},l=n,a(s,l)}return s(r,t),S(r,[{key:"componentWillMount",value:function(){var t=this;x(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this)&&x(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this).call(this);var n=this.constructor.autoControlledProps;this.state=(0,w["default"])(n,function(r,n){var o=N(n);if((0,E["default"])(t.props,o)?r[n]=t.props[o]:(0,E["default"])(t.props,n)?r[n]=t.props[n]:"checked"===n?r[n]=!1:"value"===n&&(r[n]=t.props.multiple?[]:""),"production"!==e.env.NODE_ENV){var a=t.constructor.name;o in t.props&&n in t.props&&console.error(a+' prop "'+n+'" is auto controlled. Specify either '+o+" or "+n+", but not both.")}},{}),"production"!==e.env.NODE_ENV&&!function(){var e=t.constructor,r=e.defaultProps,o=e.name,a=e.propTypes;n||console.error("Auto controlled "+o+" must specify a static autoControlledProps array."),(0,O["default"])(n,function(e){var t=N(e);(0,E["default"])(a,t)||console.error(o+' is missing "'+t+'" propTypes validation for auto controlled prop "'+e+'".'),(0,E["default"])(a,e)||console.error(o+' is missing propTypes validation for auto controlled prop "'+e+'".')});var s=(0,P["default"])(n,(0,g["default"])(r));(0,v["default"])(s)||console.error(["Do not set defaultProps for autoControlledProps,","use trySetState() in constructor() or componentWillMount() instead.","See "+o+' props: "'+s+'".'].join(" "));var l=(0,y["default"])(n,function(e){return e.startsWith("default")});(0,v["default"])(l)||console.error(["Do not add default props to autoControlledProps.","Default props are automatically handled.","See "+o+' autoControlledProps: "'+l+'".'].join(" "))}()}},{key:"componentWillReceiveProps",value:function(e){x(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillReceiveProps",this)&&x(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillReceiveProps",this).call(this,e);var t=(0,d["default"])(e,this.constructor.autoControlledProps);(0,v["default"])(t)||this.setState(t)}}]),r}(A.Component);t["default"]=k}).call(t,r(/*! ./~/node-libs-browser/~/process/browser.js */69))},/*!*************************!*\
!*** ./src/lib/META.js ***!
\*************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrivate=t.isChild=t.isParent=t.isModule=t.isView=t.isElement=t.isCollection=t.isAddon=t.isType=t.isMeta=t.TYPES=void 0;var o=r(/*! lodash/fp/startsWith */466),a=n(o),s=r(/*! lodash/fp/has */457),l=n(s),u=r(/*! lodash/fp/eq */455),i=n(u),c=r(/*! lodash/fp/flow */245),p=n(c),d=r(/*! lodash/fp/curry */454),f=n(d),y=r(/*! lodash/fp/get */456),m=n(y),v=r(/*! lodash/fp/includes */458),h=n(v),g=r(/*! lodash/fp/values */467),b=n(g),P=t.TYPES={ADDON:"addon",COLLECTION:"collection",ELEMENT:"element",VIEW:"view",MODULE:"module"},T=(0,b["default"])(P),O=t.isMeta=function(e){return(0,h["default"])((0,m["default"])("type",e),T)},_=function(e){return O(e)?e:O((0,m["default"])("_meta",e))?e._meta:O((0,m["default"])("constructor._meta",e))?e.constructor._meta:void 0},E=(0,f["default"])(function(e,t,r){return(0,p["default"])(_,(0,m["default"])(e),(0,i["default"])(t))(r)}),j=t.isType=E("type");t.isAddon=j(P.ADDON),t.isCollection=j(P.COLLECTION),t.isElement=j(P.ELEMENT),t.isView=j(P.VIEW),t.isModule=j(P.MODULE),t.isParent=(0,p["default"])(_,(0,l["default"])("parent"),(0,i["default"])(!1)),t.isChild=(0,p["default"])(_,(0,l["default"])("parent")),t.isPrivate=(0,p["default"])(_,(0,m["default"])("name"),(0,a["default"])("_"))},/*!************************!*\
!*** ./src/lib/SUI.js ***!
\************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.ICONS=t.WIDTHS=t.VERTICAL_ALIGNMENTS=t.TEXT_ALIGNMENTS=t.SIZES=t.FLOATS=t.COLORS=void 0;var a=r(/*! lodash/values */127),s=n(a),l=r(/*! lodash/keys */8),u=n(l),i=r(/*! ./numberToWord */82);t.COLORS=["red","orange","yellow","olive","green","teal","blue","violet","purple","pink","brown","grey","black"],t.FLOATS=["left","right"],t.SIZES=["mini","tiny","small","medium","large","big","huge","massive"],t.TEXT_ALIGNMENTS=["left","center","right","justified"],t.VERTICAL_ALIGNMENTS=["bottom","middle","top"],t.WIDTHS=[].concat(o((0,u["default"])(i.numberToWordMap)),o((0,u["default"])(i.numberToWordMap).map(Number)),o((0,s["default"])(i.numberToWordMap))),t.ICONS=["add to calendar","alarm outline","alarm mute outline","alarm mute","alarm","at","browser","bug","calendar outline","calendar","checked calendar","cloud","code","comment outline","comment","comments outline","comments","copyright","creative commons","dashboard","delete calendar","external square","external","eyedropper","feed","find","hand pointer","hashtag","heartbeat","history","home","hourglass empty","hourglass end","hourglass full","hourglass half","hourglass start","idea","image","inbox","industry","lab","mail outline","mail square","mail","mouse pointer","options","paint brush","payment","percent","privacy","protect","registered","remove from calendar","search","setting","settings","shop","shopping bag","shopping basket","signal","sitemap","tag","tags","tasks","terminal","text telephone","ticket","trademark","trophy","wifi","add to cart","add user","adjust","archive","ban","bookmark","call","call square","clone","cloud download","cloud upload","talk","talk outline","compress","configure","download","edit","erase","exchange","expand","external share","filter","hide","in cart","lock","mail forward","object group","object ungroup","pin","print","random","recycle","refresh","remove bookmark","remove user","repeat","reply all","reply","retweet","send","send outline","share alternate","share alternate square","share","share square","sign in","sign out","theme","translate","undo","unhide","unlock alternate","unlock","upload","wait","wizard","write","write square","announcement","birthday","help circle","help","info circle","info","warning circle","warning","warning sign","child","doctor","handicap","spy","student","user","users","female","gay","genderless","heterosexual","intergender","lesbian","male","man","neuter","non binary transgender","other gender horizontal","other gender","other gender vertical","transgender","woman","block layout","crop","grid layout","list layout","maximize","resize horizontal","resize vertical","zoom","zoom out","anchor","bar","bomb","book","bullseye","calculator","cocktail","diamond","fax","fire extinguisher","fire","flag checkered","flag","flag outline","gift","hand lizard","hand peace","hand paper","hand rock","hand scissors","hand spock","law","leaf","legal","lemon","life ring","lightning","magnet","money","moon","plane","puzzle","road","rocket","shipping","soccer","sticky note","sticky note outline","suitcase","sun","travel","treatment","umbrella","world","asterisk","certificate","circle","circle notched","circle thin","crosshairs","cube","cubes","ellipsis horizontal","ellipsis vertical","quote left","quote right","spinner","square","square outline","add circle","add square","check circle","check circle outline","check square","checkmark box","checkmark","minus circle","minus","minus square","minus square outline","move","plus","plus square outline","radio","remove circle","remove circle outline","remove","selected radio","toggle off","toggle on","area chart","bar chart","camera retro","film","line chart","newspaper","photo","pie chart","sound","angle double down","angle double left","angle double right","angle double up","angle down","angle left","angle right","angle up","arrow circle down","arrow circle left","arrow circle outline down","arrow circle outline left","arrow circle outline right","arrow circle outline up","arrow circle right","arrow circle up","arrow down","arrow left","arrow right","arrow up","caret down","caret left","caret right","caret up","chevron circle down","chevron circle left","chevron circle right","chevron circle up","chevron down","chevron left","chevron right","chevron up","long arrow down","long arrow left","long arrow right","long arrow up","pointing down","pointing left","pointing right","pointing up","toggle down","toggle left","toggle right","toggle up","mobile","tablet","battery empty","battery full","battery low","battery medium","desktop","disk outline","game","high battery","keyboard","laptop","plug","power","file archive outline","file audio outline","file code outline","file excel outline","file","file image outline","file outline","file pdf outline","file powerpoint outline","file text","file text outline","file video outline","file word outline","folder","folder open","folder open outline","folder outline","level down","level up","trash","trash outline","barcode","bluetooth alternative","bluetooth","css3","database","fork","html5","openid","qrcode","rss","rss square","server","usb","empty heart","empty star","frown","heart","meh","smile","star half empty","star half","star","thumbs down","thumbs outline down","thumbs outline up","thumbs up","backward","closed captioning","eject","fast backward","fast forward","forward","music","mute","pause circle","pause circle outline","pause","play","record","step backward","step forward","stop circle","stop circle outline","stop","unmute","video play","video play outline","volume down","volume off","volume up","bicycle","building","building outline","bus","car","coffee","compass","emergency","first aid","food","h","hospital","hotel","location arrow","map","map outline","map pin","map signs","marker","military","motorcycle","paw","ship","space shuttle","spoon","street view","subway","taxi","train","television","tree","university","columns","sort alphabet ascending","sort alphabet descending","sort ascending","sort content ascending","sort content descending","sort descending","sort","sort numeric ascending","sort numeric descending","table","align center","align justify","align left","align right","attach","bold","content","copy","cut","font","header","indent","italic","linkify","list","ordered list","outdent","paragraph","paste","save","strikethrough","subscript","superscript","text cursor","text height","text width","underline","unlinkify","unordered list","bitcoin","dollar","euro","lira","pound","ruble","rupee","shekel","won","yen","american express","credit card alternative","diners club","discover","google wallet","japan credit bureau","mastercard","paypal card","paypal","stripe","visa","wheelchair","asl interpreting","assistive listening systems","audio description","blind","braille","deafness","low vision","sign language","universal access","volume control phone","500px","adn","amazon","android","angellist","apple","behance","behance square","bitbucket","bitbucket square","black tie","buysellads","chrome","codepen","codiepie","connectdevelop","contao","dashcube","delicious","deviantart","digg","dribbble","dropbox","drupal","empire","envira gallery","expeditedssl","facebook","facebook f","facebook square","firefox","first order","flickr","font awesome","fonticons","fort awesome","forumbee","foursquare","gg","gg circle","git","git square","github","github alternate","github square","gitlab","gittip","glide","glide g","google","google plus","google plus circle","google plus square","hacker news","houzz","instagram","internet explorer","ioxhost","joomla","jsfiddle","lastfm","lastfm square","leanpub","linkedin","linkedin square","linux","maxcdn","meanpath","medium","microsoft edge","mixcloud","modx","odnoklassniki","odnoklassniki square","opencart","opera","optinmonster","pagelines","pied piper","pied piper alternate","pied piper hat","pinterest","pinterest square","pocket","product hunt","qq","rebel","reddit","reddit alien","reddit square","renren","safari","scribd","sellsy","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","snapchat","snapchat ghost","snapchat square","soundcloud","spotify","stack exchange","stack overflow","steam","steam square","stumbleupon","stumbleupon circle","tencent weibo","themeisle","trello","tripadvisor","tumblr","tumblr square","twitch","twitter","twitter square","viacoin","viadeo","viadeo square","vimeo","vimeo square","vine","vk","wechat","weibo","whatsapp","wikipedia","windows","wordpress","wpbeginner","wpforms","xing","xing square","y combinator","yahoo","yelp","yoast","youtube","youtube play","youtube square"]},/*!**********************************!*\
!*** ./src/lib/childrenUtils.js ***!
\**********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.findByType=t.someByType=void 0;var o=r(/*! lodash/find */122),a=n(o),s=r(/*! lodash/some */253),l=n(s),u=r(/*! react */1);t.someByType=function(e,t){return(0,l["default"])(u.Children.toArray(e),{type:t})},t.findByType=function(e,t){return(0,a["default"])(u.Children.toArray(e),{type:t})}},/*!**************************************!*\
!*** ./src/lib/classNameBuilders.js ***!
\**************************************/
function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useVerticalAlignProp=t.useTextAlignProp=t.useWidthProp=t.useKeyOrValueAndKey=t.useValueAndKey=t.useKeyOnly=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(/*! ./numberToWord */82),a=(t.useKeyOnly=function(e,t){return e&&t},t.useValueAndKey=function(e,t){return e&&e!==!0&&e+" "+t});t.useKeyOrValueAndKey=function(e,t){return e&&(e===!0?t:e+" "+t)},t.useWidthProp=function(e){var t=arguments.length<=1||void 0===arguments[1]?"":arguments[1],r=!(arguments.length<=2||void 0===arguments[2])&&arguments[2];if(r&&"equal"===e)return"equal width";var a="undefined"==typeof e?"undefined":n(e);return"string"!==a&&"number"!==a||!t?(0,o.numberToWord)(e):(0,o.numberToWord)(e)+" "+t},t.useTextAlignProp=function(e){return"justified"===e?"justified":a(e,"aligned")},t.useVerticalAlignProp=function(e){return a(e,"aligned")}},/*!************************************!*\
!*** ./src/lib/customPropTypes.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Object.defineProperty(t,"__esModule",{value:!0}),t.deprecate=t.collectionShorthand=t.itemShorthand=t.contentShorthand=t.demand=t.givenProps=t.some=t.every=t.disallow=t.as=void 0;var s=r(/*! lodash/fp/isObject */461),l=n(s),u=r(/*! lodash/fp/pick */465),i=n(u),c=r(/*! lodash/fp/keys */463),p=n(c),d=r(/*! lodash/fp/isPlainObject */462),f=n(d),y=r(/*! lodash/fp/isFunction */459),m=n(y),v=r(/*! lodash/fp/compact */453),h=n(v),g=r(/*! lodash/fp/map */464),b=n(g),P=r(/*! lodash/fp/flow */245),T=n(P),O=r(/*! lodash/fp/isNil */460),_=n(O),E=a([" See `","` prop in `","`."],[" See \\`","\\` prop in \\`","\\`."]),j=r(/*! react */1),w=function(){var e;return(e=Object.prototype.toString).call.apply(e,arguments)},M=(t.as=function(){return j.PropTypes.oneOfType([j.PropTypes.string,j.PropTypes.func]).apply(void 0,arguments)},t.disallow=function(e){return function(t,r,n){if(!Array.isArray(e))throw new Error(["Invalid argument supplied to disallow, expected an instance of array."(E,r,n)].join(""));if(!(0,_["default"])(t[r])&&t[r]!==!1){var a=e.reduce(function(e,r){return(0,_["default"])(t[r])||t[r]===!1?e:[].concat(o(e),[r])},[]);return a.length>0?new Error(["Prop `"+r+"` in `"+n+"` conflicts with props: `"+a.join("`, `")+"`.","They cannot be defined together, choose one or the other."].join(" ")):void 0}}}),S=t.every=function(e){return function(t,r,n){for(var o=arguments.length,a=Array(o>3?o-3:0),s=3;s<o;s++)a[s-3]=arguments[s];if(!Array.isArray(e))throw new Error(["Invalid argument supplied to every, expected an instance of array.","See `"+r+"` prop in `"+n+"`."].join(" "));var l=(0,T["default"])((0,b["default"])(function(e){if("function"!=typeof e)throw new Error('every() argument "validators" should contain functions, found: '+w(e)+".");return e.apply(void 0,[t,r,n].concat(a))}),h["default"])(e);return l[0]}},x=(t.some=function(e){return function(t,r,n){for(var o=arguments.length,a=Array(o>3?o-3:0),s=3;s<o;s++)a[s-3]=arguments[s];if(!Array.isArray(e))throw new Error(["Invalid argument supplied to some, expected an instance of array.","See `"+r+"` prop in `"+n+"`."].join(" "));var l=(0,h["default"])((0,b["default"])(e,function(e){if(!(0,m["default"])(e))throw new Error('some() argument "validators" should contain functions, found: '+w(e)+".");return e.apply(void 0,[t,r,n].concat(a))}));if(l.length===e.length){var u=new Error("One of these validators must pass:");return u.message+="\n"+(0,b["default"])(l,function(e,t){return"["+(t+1)+"]: "+e.message}).join("\n"),u}}},t.givenProps=function(e,t){return function(r,n,o){for(var a=arguments.length,s=Array(a>3?a-3:0),u=3;u<a;u++)s[u-3]=arguments[u];if(!(0,f["default"])(e))throw new Error(["Invalid argument supplied to givenProps, expected an object.","See `"+n+"` prop in `"+o+"`."].join(" "));if("function"!=typeof t)throw new Error(["Invalid argument supplied to givenProps, expected a function.","See `"+n+"` prop in `"+o+"`."].join(" "));var c=(0,p["default"])(e).every(function(t){var a=e[t];return"function"==typeof a?!a.apply(void 0,[r,t,o].concat(s)):a===r[n]});if(c){var d=t.apply(void 0,[r,n,o].concat(s));if(d){var y="{ "+(0,p["default"])((0,i["default"])((0,p["default"])(e),r)).map(function(e){var t=r[e],n=t;return"string"==typeof t?n='"'+t+'"':Array.isArray(t)?n="["+t.join(", ")+"]":(0,l["default"])(t)&&(n="{...}"),e+": "+n}).join(", ")+" }";return d.message="Given props "+y+": "+d.message,d}}}},t.demand=function(e){return function(t,r,n){if(!Array.isArray(e))throw new Error(["Invalid `requiredProps` argument supplied to require, expected an instance of array."(E,r,n)].join(""));if(void 0!==t[r]){var o=e.filter(function(e){return void 0===t[e]});return o.length>0?new Error("`"+r+"` prop in `"+n+"` requires props: `"+o.join("`, `")+"`."):void 0}}},t.contentShorthand=function(){return S([M(["children"]),j.PropTypes.node]).apply(void 0,arguments)},t.itemShorthand=function(){return S([M(["children"]),j.PropTypes.oneOfType([j.PropTypes.node,j.PropTypes.object])]).apply(void 0,arguments)});t.collectionShorthand=function(){return S([M(["children"]),j.PropTypes.arrayOf(x)]).apply(void 0,arguments)},t.deprecate=function(e,t){return function(r,n,o){for(var a=arguments.length,s=Array(a>3?a-3:0),l=3;l<a;l++)s[l-3]=arguments[l];if("string"!=typeof e)throw new Error(["Invalid `help` argument supplied to deprecate, expected a string.","See `"+n+"` prop in `"+o+"`."].join(" "));if(void 0!==r[n]){var u=new Error("The `"+n+"` prop in `"+o+"` is deprecated.");if(e&&(u.message+=" "+e),t){if("function"!=typeof t)throw new Error(["Invalid argument supplied to deprecate, expected a function.","See `"+n+"` prop in `"+o+"`."].join(" "));var i=t.apply(void 0,[r,n,o].concat(s));i&&(u.message=u.message+" "+i.message)}return u}}}},/*!**************************!*\
!*** ./src/lib/debug.js ***!
\**************************/
function(e,t,r){(function(e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=void 0,o=function(){};n="production"!==e.env.NODE_ENV&&"test"!==e.env.NODE_ENV?r(/*! debug */328):function(){return o};var a=t.makeDebugger=function(e){return n("semanticUIReact:"+e)};t.debug=a("log")}).call(t,r(/*! ./~/node-libs-browser/~/process/browser.js */69))},/*!******************************!*\
!*** ./src/lib/factories.js ***!
\******************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];if("function"!=typeof e&&"string"!=typeof e)throw new Error("createShorthandFactory() Component must be a string or function.");if(null===r)return null;var o=void 0,a={};(0,E.isValidElement)(r)?(o="element",a=r.props):(0,v["default"])(r)?(o="props",a=r):((0,y["default"])(r)||(0,d["default"])(r)||(0,c["default"])(r))&&(o="literal",a=t(r)),n=(0,g["default"])(n)?n(a):n;var s=w(n,a);return"element"===o?(0,E.cloneElement)(r,s):"props"===o||"literal"===o?j["default"].createElement(e,s):null}function s(e,t){if("function"!=typeof e&&"string"!=typeof e)throw new Error("createShorthandFactory() Component must be a string or function.");return(0,u["default"])(a,e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createHTMLInput=t.createHTMLImage=void 0;var l=r(/*! lodash/partial */479),u=n(l),i=r(/*! lodash/isArray */4),c=n(i),p=r(/*! lodash/isNumber */248),d=n(p),f=r(/*! lodash/isString */249),y=n(f),m=r(/*! lodash/isPlainObject */126),v=n(m),h=r(/*! lodash/isFunction */24),g=n(h),b=r(/*! lodash/has */23),P=n(b),T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.createShorthand=a,t.createShorthandFactory=s;var O=r(/*! classnames */3),_=n(O),E=r(/*! react */1),j=n(E),w=function(e,t){var r=T({},e,t),n=r.childKey,a=o(r,["childKey"]);return((0,P["default"])(t,"className")||(0,P["default"])(e.className))&&(a.className=(0,_["default"])(e.className,t.className)),!a.key&&n&&(a.key=(0,g["default"])(n)?n(a):n),a};t.createHTMLImage=s("img",function(e){return{src:e}}),t.createHTMLInput=s("input",function(e){return{type:e}})},/*!***********************************!*\
!*** ./src/lib/getElementType.js ***!
\***********************************/
function(e,t){"use strict";function r(e,t,r){var n=e.defaultProps,o=void 0===n?{}:n;if(t.as&&t.as!==o.as)return t.as;if(r){var a=r();if(a)return a}return t.href?"a":o.as||"div"}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},/*!**************************************!*\
!*** ./src/lib/getUnhandledProps.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(/*! lodash/omit */40),a=n(o),s=r(/*! lodash/keys */8),l=n(s),u=r(/*! lodash/union */258),i=n(u),c=function(e,t){var r=(0,i["default"])(e.autoControlledProps,(0,l["default"])(e.defaultProps),(0,l["default"])(e.propTypes));return(0,a["default"])(t,r)};t["default"]=c},/*!********************************!*\
!*** ./src/lib/keyboardKey.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(/*! lodash/isObject */13),a=n(o),s=r(/*! lodash/times */255),l=n(s),u={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};(0,l["default"])(24,function(e){return u[112+e]="F"+(e+1)}),(0,l["default"])(26,function(e){var t=e+65;u[t]=[String.fromCharCode(t+32),String.fromCharCode(t)]});var i={codes:u,getCode:function(e){return(0,a["default"])(e)?e.keyCode||e.which||this[e.key]:this[e]},getName:function(e){var t=(0,a["default"])(e),r=u[t?e.keyCode||e.which:e];return Array.isArray(r)&&(r=t?r[e.shiftKey?1:0]:r[0]),r},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};i.Spacebar=i[" "],i.Digit0=i[0],i.Digit1=i[1],i.Digit2=i[2],i.Digit3=i[3],i.Digit4=i[4],i.Digit5=i[5],i.Digit6=i[6],i.Digit7=i[7],i.Digit8=i[8],i.Digit9=i[9],i.Tilde=i["~"],i.GraveAccent=i["`"],i.ExclamationPoint=i["!"],i.AtSign=i["@"],i.PoundSign=i["#"],i.PercentSign=i["%"],i.Caret=i["^"],i.Ampersand=i["&"],i.PlusSign=i["+"],i.MinusSign=i["-"],i.EqualsSign=i["="],i.DivisionSign=i["/"],i.MultiplicationSign=i["*"],i.Comma=i[","],i.Decimal=i["."],i.Colon=i[":"],i.Semicolon=i[";"],i.Pipe=i["|"],i.BackSlash=i["\\"],i.QuestionMark=i["?"],i.SingleQuote=i['"'],i.DoubleQuote=i['"'],i.LeftCurlyBrace=i["{"],i.RightCurlyBrace=i["}"],i.LeftParenthesis=i["("],i.RightParenthesis=i[")"],i.LeftAngleBracket=i["<"],i.RightAngleBracket=i[">"],i.LeftSquareBracket=i["["],i.RightSquareBracket=i["]"],t["default"]=i},/*!*******************************!*\
!*** ./src/lib/objectDiff.js ***!
\*******************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.objectDiff=void 0;var o=r(/*! lodash/isEqual */67),a=n(o),s=r(/*! lodash/has */23),l=n(s),u=r(/*! lodash/transform */257),i=n(u);t.objectDiff=function(e,t){return(0,i["default"])(e,function(e,r,n){(0,l["default"])(t,n)?(0,a["default"])(r,t[n])||(e[n]=t[n]):e[n]="[DELETED]"},{})}},/*!********************************************!*\
!*** ./src/modules/Accordion/Accordion.js ***!
\********************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/keys */8),u=n(l),i=r(/*! lodash/omit */40),c=n(i),p=r(/*! lodash/each */64),d=n(p),f=r(/*! lodash/has */23),y=n(f),m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=function A(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:A(o,t,r)}if("value"in n)return n.value;var a=n.get;if(void 0!==a)return a.call(r)},g=r(/*! classnames */3),b=n(g),P=r(/*! react */1),T=n(P),O=r(/*! ../../lib */2),_=r(/*! ../../elements/Icon */10),E=n(_),j=r(/*! ./AccordionContent */169),w=n(j),M=r(/*! ./AccordionTitle */170),S=n(M),x=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.handleTitleClick=function(e,t){var r=n.props.onTitleClick,o=n.state.activeIndex;n.trySetState({activeIndex:t===o?-1:t}),r&&r(e,t)},n.renderChildren=function(){var e=n.props.children,t=n.state.activeIndex;return P.Children.map(e,function(e,r){var o=e.type===S["default"],a=e.type===w["default"];if(o){var s=(0,y["default"])(e,"props.active")?e.props.active:t===r,l=function(t){n.handleTitleClick(t,r),e.props.onClick&&e.props.onClick(t,r)};return(0,P.cloneElement)(e,m({},e.props,{active:s,onClick:l}))}if(a){var u=(0,y["default"])(e,"props.active")?e.props.active:t===r-1;return(0,P.cloneElement)(e,m({},e.props,{active:u}))}return e})},n.renderPanels=function(){var e=n.props.panels,t=n.state.activeIndex,r=[];return(0,d["default"])(e,function(e,o){var a=(0,y["default"])(e,"active")?e.active:t===o,s=function(t){n.handleTitleClick(t,o),e.onClick&&e.onClick(t,o)};r.push(T["default"].createElement(S["default"],{key:e.title+"-title",active:a,onClick:s},T["default"].createElement(E["default"],{name:"dropdown"}),e.title)),r.push(T["default"].createElement(w["default"],{key:e.title+"-content",active:a},e.content))}),r},s=r,a(n,s)}return s(t,e),v(t,[{key:"componentWillMount",value:function(){h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillMount",this).call(this),this.trySetState({activeIndex:-1})}},{key:"render",value:function(){var e=this.props,r=e.className,n=e.fluid,o=e.inverted,a=e.panels,s=e.styled,l=(0,b["default"])("ui",(0,O.useKeyOnly)(n,"fluid"),(0,O.useKeyOnly)(o,"inverted"),(0,O.useKeyOnly)(s,"styled"),"accordion",r),i=(0,c["default"])(this.props,(0,u["default"])(t.propTypes)),p=(0,O.getElementType)(t,this.props);return T["default"].createElement(p,m({},i,{className:l}),a?this.renderPanels():this.renderChildren())}}]),t}(O.AutoControlledComponent);x.autoControlledProps=["activeIndex"],x.propTypes={as:O.customPropTypes.as,activeIndex:P.PropTypes.number,children:P.PropTypes.node,className:P.PropTypes.string,defaultActiveIndex:P.PropTypes.number,fluid:P.PropTypes.bool,inverted:P.PropTypes.bool,onTitleClick:P.PropTypes.func,panels:O.customPropTypes.every([O.customPropTypes.disallow(["children"]),P.PropTypes.arrayOf(P.PropTypes.shape({active:P.PropTypes.bool,title:P.PropTypes.string,content:P.PropTypes.string,onClick:P.PropTypes.func}))]),styled:P.PropTypes.bool},x._meta={name:"Accordion",type:O.META.TYPES.MODULE},x.Content=w["default"],x.Title=S["default"],t["default"]=x},/*!******************************************!*\
!*** ./src/modules/Checkbox/Checkbox.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(/*! react */1),c=n(i),p=r(/*! classnames */3),d=n(p),f=r(/*! ../../lib */2),y=(0,f.makeDebugger)("checkbox"),m={name:"Checkbox",type:f.META.TYPES.MODULE,props:{type:["checkbox","radio"]}},v=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.canToggle=function(){var e=n.props,t=e.disabled,r=e.radio,o=e.readOnly,a=n.state.checked;return!(t||o||r&&a)},n.handleClick=function(e){y("handleClick()");var t=n.props,r=t.onChange,o=t.onClick,a=t.name,s=t.value,l=n.state.checked;y(" name: "+a),y(" value: "+s),y(" checked: "+l),n.canToggle()&&(o&&o(e,{name:a,value:s,checked:!!l}),r&&r(e,{name:a,value:s,checked:!l}),n.trySetState({checked:!l}))},s=r,a(n,s)}return s(t,e),u(t,[{key:"render",value:function(){var e=this.props,r=e.className,n=e.label,o=e.name,a=e.radio,s=e.slider,u=e.toggle,i=e.type,p=e.value,y=e.disabled,m=e.readOnly,v=this.state.checked,h=(0,d["default"])("ui",(0,f.useKeyOnly)(v,"checked"),(0,f.useKeyOnly)(!n,"fitted"),(0,f.useKeyOnly)(a,"radio"),(0,f.useKeyOnly)(s,"slider"),(0,f.useKeyOnly)(u,"toggle"),(0,f.useKeyOnly)(y,"disabled"),(0,f.useKeyOnly)(m,"read-only"),"checkbox",r),g=(0,f.getUnhandledProps)(t,this.props),b=(0,f.getElementType)(t,this.props);return c["default"].createElement(b,l({},g,{className:h,onClick:this.handleClick,onChange:this.handleClick}),c["default"].createElement("input",{type:i,name:o,checked:v,className:"hidden",readOnly:!0,tabIndex:0,value:p}),c["default"].createElement("label",null,n))}}]),t}(f.AutoControlledComponent);v.propTypes={as:f.customPropTypes.as,className:i.PropTypes.string,checked:i.PropTypes.bool,defaultChecked:i.PropTypes.bool,slider:f.customPropTypes.every([i.PropTypes.bool,f.customPropTypes.disallow(["radio","toggle"])]),radio:f.customPropTypes.every([i.PropTypes.bool,f.customPropTypes.disallow(["slider","toggle"])]),toggle:f.customPropTypes.every([i.PropTypes.bool,f.customPropTypes.disallow(["radio","slider"])]),disabled:i.PropTypes.bool,fitted:i.PropTypes.bool,label:i.PropTypes.string,type:i.PropTypes.oneOf(m.props.type),name:i.PropTypes.string,onChange:i.PropTypes.func,onClick:i.PropTypes.func,readOnly:i.PropTypes.bool,value:i.PropTypes.string},v.defaultProps={type:"checkbox"},v.autoControlledProps=["checked"],v._meta=m,t["default"]=v},/*!******************************************!*\
!*** ./src/modules/Dropdown/Dropdown.js ***!
\******************************************/
function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/compact */241),u=n(l),i=r(/*! lodash/map */9),c=n(i),p=r(/*! lodash/every */243),d=n(p),f=r(/*! lodash/without */6),y=n(f),m=r(/*! lodash/findIndex */244),v=n(m),h=r(/*! lodash/find */122),g=n(h),b=r(/*! lodash/reduce */252),P=n(b),T=r(/*! lodash/escapeRegExp */447),O=n(T),_=r(/*! lodash/isFunction */24),E=n(_),j=r(/*! lodash/filter */121),w=n(j),M=r(/*! lodash/dropRight */446),S=n(M),x=r(/*! lodash/isEmpty */124),A=n(x),N=r(/*! lodash/union */258),k=n(N),C=r(/*! lodash/some */253),I=n(C),K=r(/*! lodash/get */37),L=n(K),U=r(/*! lodash/includes */65),D=n(U),R=r(/*! lodash/has */23),z=n(R),W=r(/*! lodash/isEqual */67),F=n(W),V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},B=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Y=function de(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:de(o,t,r)}if("value"in n)return n.value;var a=n.get;if(void 0!==a)return a.call(r)},q=r(/*! classnames */3),H=n(q),G=r(/*! react */1),Z=n(G),$=r(/*! ../../lib */2),X=r(/*! ../../elements/Icon */10),Q=n(X),J=r(/*! ../../elements/Label */77),ee=n(J),te=r(/*! ./DropdownDivider */171),re=n(te),ne=r(/*! ./DropdownItem */173),oe=n(ne),ae=r(/*! ./DropdownHeader */172),se=n(ae),le=r(/*! ./DropdownMenu */174),ue=n(le),ie=(0,$.makeDebugger)("dropdown"),ce={name:"Dropdown",type:$.META.TYPES.MODULE,props:{pointing:["left","right","top","top left","top right","bottom","bottom left","bottom right"],additionPosition:["top","bottom"]}},pe=function(t){function r(){var e,t,n,s;o(this,r);for(var l=arguments.length,i=Array(l),p=0;p<l;p++)i[p]=arguments[p];return t=n=a(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(i))),n.handleChange=function(e,t){ie("handleChange()"),ie(t);var r=n.props,o=r.name,a=r.onChange;a&&a(e,{name:o,value:t})},n.closeOnEscape=function(e){$.keyboardKey.getCode(e)===$.keyboardKey.Escape&&(e.preventDefault(),n.close())},n.moveSelectionOnKeyDown=function(e){switch(ie("moveSelectionOnKeyDown()"),ie($.keyboardKey.getName(e)),$.keyboardKey.getCode(e)){case $.keyboardKey.ArrowDown:e.preventDefault(),n.moveSelectionBy(1);break;case $.keyboardKey.ArrowUp:e.preventDefault(),n.moveSelectionBy(-1)}},n.openOnSpace=function(e){ie("openOnSpace()"),$.keyboardKey.getCode(e)===$.keyboardKey.Spacebar&&(n.state.open||(e.preventDefault(),n.trySetState({open:!0})))},n.openOnArrow=function(e){var t=$.keyboardKey.getCode(e);ie("openOnArrow()"),(0,D["default"])([$.keyboardKey.ArrowDown,$.keyboardKey.ArrowUp],t)&&(n.state.open||(e.preventDefault(),n.trySetState({open:!0})))},n.selectHighlightedItem=function(e){var t=n.state.open,r=n.props,o=r.multiple,a=r.name,s=r.onAddItem,l=r.options,u=(0,L["default"])(n.getSelectedItem(),"value");if(u&&t)if(s&&!(0,I["default"])(l,{text:u})&&s(e,{name:a,value:u}),o){var i=(0,k["default"])(n.state.value,[u]);n.setValue(i),n.handleChange(e,i)}else n.setValue(u),n.handleChange(e,u),n.close()},n.selectItemOnEnter=function(e){ie("selectItemOnEnter()"),ie($.keyboardKey.getName(e)),$.keyboardKey.getCode(e)===$.keyboardKey.Enter&&(e.preventDefault(),n.selectHighlightedItem(e))},n.removeItemOnBackspace=function(e){if(ie("removeItemOnBackspace()"),ie($.keyboardKey.getName(e)),$.keyboardKey.getCode(e)===$.keyboardKey.Backspace){var t=n.props,r=t.multiple,o=t.search,a=n.state,s=a.searchQuery,l=a.value;if(!s&&o&&r&&!(0,A["default"])(l)){e.preventDefault();var u=(0,S["default"])(l);n.setValue(u),n.handleChange(e,u)}}},n.closeOnDocumentClick=function(e){ie("closeOnDocumentClick()"),ie(e),n.close()},n.handleMouseDown=function(e){ie("handleMouseDown()");var t=n.props.onMouseDown;t&&t(e),n.isMouseDown=!0,document.addEventListener("mouseup",n.handleDocumentMouseUp)},n.handleDocumentMouseUp=function(){ie("handleDocumentMouseUp()"),n.isMouseDown=!1,document.removeEventListener("mouseup",n.handleDocumentMouseUp)},n.handleClick=function(e){ie("handleClick()",e);var t=n.props.onClick;t&&t(e),e.stopPropagation(),n.toggle()},n.handleItemClick=function(e,t){ie("handleItemClick()"),ie(t);var r=n.props,o=r.multiple,a=r.name,s=r.onAddItem,l=r.options,u=n.getItemByValue(t)||{};if(e.stopPropagation(),(o||u.disabled)&&e.nativeEvent.stopImmediatePropagation(),!u.disabled)if(s&&!(0,I["default"])(l,{text:t})&&s(e,{name:a,value:t}),o){var i=(0,k["default"])(n.state.value,[t]);n.setValue(i),n.handleChange(e,i)}else n.setValue(t),n.handleChange(e,t),n.close()},n.handleFocus=function(e){ie("handleFocus()");var t=n.props.onFocus;t&&t(e),n.setState({focus:!0})},n.handleBlur=function(e){ie("handleBlur()");var t=n.props,r=t.multiple,o=t.onBlur,a=t.selectOnBlur;n.isMouseDown||(o&&o(e),a&&!r&&n.selectHighlightedItem(e),n.setState({focus:!1}))},n.handleSearchChange=function(e){ie("handleSearchChange()"),ie(e.target.value),e.stopPropagation();var t=n.props,r=t.search,o=t.onSearchChange,a=n.state.open,s=e.target.value;o&&o(e,s),r&&s&&!a&&n.open(),n.setState({selectedIndex:n.getEnabledIndices()[0],searchQuery:s})},n.getMenuOptions=function(){var e=arguments.length<=0||void 0===arguments[0]?n.state.value:arguments[0],t=n.props,r=t.multiple,o=t.search,a=t.allowAdditions,s=t.additionPosition,l=t.additionLabel,u=t.options,i=n.state.searchQuery,c=u;if(r&&(c=(0,w["default"])(c,function(t){return!(0,D["default"])(e,t.value)})),o&&i&&((0,E["default"])(o)?c=o(c,i):!function(){var e=new RegExp((0,O["default"])(i),"i");c=(0,w["default"])(c,function(t){return e.test(t.text)})}()),a&&o&&i&&!(0,I["default"])(c,{text:i})){var p={text:l?l+" "+i:i,value:i};"top"===s?c.unshift(p):c.push(p)}return c},n.getSelectedItem=function(){var e=n.state.selectedIndex,t=n.getMenuOptions();return(0,L["default"])(t,"["+e+"]")},n.getEnabledIndices=function(e){var t=e||n.getMenuOptions();return(0,P["default"])(t,function(e,t,r){return t.disabled||e.push(r),e},[])},n.getItemByValue=function(e){var t=n.props.options;return(0,g["default"])(t,{value:e})},n.getMenuItemIndexByValue=function(e){var t=n.getMenuOptions();return(0,v["default"])(t,["value",e])},n.setValue=function(e){ie("setValue()"),ie("value",e);var t=n.props.multiple,r=n.state.selectedIndex,o=n.getMenuOptions(e),a=n.getEnabledIndices(o),s={searchQuery:""};if(r)if(t)r>=o.length-1&&(s.selectedIndex=a[a.length-1]);else{var l=n.getMenuItemIndexByValue(e);s.selectedIndex=(0,D["default"])(a,l)?l:void 0}else{var u=a[0];s.selectedIndex=t?u:n.getMenuItemIndexByValue(e||(0,L["default"])(o,"["+u+"].value"))}n.trySetState({value:e},s)},n.handleLabelRemove=function(e,t){ie("handleLabelRemove()"),e.stopPropagation();var r=n.state.value,o=(0,y["default"])(r,t.value);ie("label props:",t),ie("current value:",r),ie("remove value:",t.value),ie("new value:",o),n.setValue(o),n.handleChange(e,o)},n.moveSelectionBy=function(e){var t=arguments.length<=1||void 0===arguments[1]?n.state.selectedIndex:arguments[1];ie("moveSelectionBy()"),ie("offset: "+e);var r=n.getMenuOptions(),o=r.length-1;if(!(0,d["default"])(r,"disabled")){var a=t+e;if(a>o?a=0:a<0&&(a=o),r[a].disabled)return n.moveSelectionBy(e,a);n.setState({selectedIndex:a}),n.scrollSelectedItemIntoView()}},n.scrollSelectedItemIntoView=function(){ie("scrollSelectedItemIntoView()");var e=document.querySelector(".ui.dropdown.active.visible .menu.visible"),t=e.querySelector(".item.selected");ie("menu: "+e),ie("item: "+t);var r=t.offsetTop<e.scrollTop,n=t.offsetTop+t.clientHeight>e.scrollTop+e.clientHeight;(r||n)&&(e.scrollTop=t.offsetTop)},n.open=function(){ie("open()");var e=n.props.search;e&&n._search.focus(),n.trySetState({open:!0})},n.close=function(){ie("close()"),n.trySetState({open:!1})},n.handleClose=function(){ie("handleClose()"),n._dropdown.blur(),n.setState({focus:!1})},n.toggle=function(){return n.state.open?n.close():n.open()},n.renderText=function(){var e=n.props,t=e.multiple,r=e.placeholder,o=e.search,a=e.text,s=n.state,l=s.searchQuery,u=s.value,i=s.open,c=t?!(0,A["default"])(u):!!u,p=(0,H["default"])(r&&!c&&"default","text",o&&l&&"filtered"),d=r;return l?d=null:a?d=a:i&&!t?d=(0,L["default"])(n.getSelectedItem(),"text"):c&&(d=(0,L["default"])(n.getItemByValue(u),"text")),Z["default"].createElement("div",{className:p},d)},n.renderHiddenInput=function(){ie("renderHiddenInput()");var e=n.state.value,t=n.props,r=t.multiple,o=t.name,a=t.options,s=t.selection;return ie("name: "+o),ie("selection: "+s),ie("value: "+e),s?Z["default"].createElement("select",{type:"hidden",name:o,value:e,multiple:r},(0,c["default"])(a,function(e){return Z["default"].createElement("option",{key:e.value,value:e.value},e.text)})):null},n.renderSearchInput=function(){var e=n.props,t=e.search,r=e.name,o=n.state.searchQuery;if(!t)return null;var a=void 0;return n._sizer&&o&&(n._sizer.style.display="inline",n._sizer.textContent=o,a=Math.ceil(n._sizer.getBoundingClientRect().width),n._sizer.style.removeProperty("display")),Z["default"].createElement("input",{value:o,onChange:n.handleSearchChange,className:"search",name:[r,"search"].join("-"),autoComplete:"off",tabIndex:"0",style:{width:a},ref:function(e){return n._search=e}})},n.renderSearchSizer=function(){var e=n.props,t=e.search,r=e.multiple;return t&&r?Z["default"].createElement("span",{className:"sizer",ref:function(e){return n._sizer=e}}):null},n.renderLabels=function(){ie("renderLabels()");var e=n.props.multiple,t=n.state.value;if(e&&!(0,A["default"])(t)){var r=(0,c["default"])(t,n.getItemByValue);return ie("selectedItems",r),(0,c["default"])((0,u["default"])(r),function(e){return Z["default"].createElement(ee["default"],{key:e.value,as:"a",content:e.text,value:e.value,onRemove:n.handleLabelRemove})})}},n.renderOptions=function(){var e=n.props,t=e.multiple,r=e.search,o=e.noResultsMessage,a=n.state,s=a.selectedIndex,l=a.value,u=n.getMenuOptions();if(r&&(0,A["default"])(u))return Z["default"].createElement("div",{className:"message"},o);var i=t?function(e){return(0,D["default"])(l,e)}:function(e){return e===l};return(0,c["default"])(u,function(e,t){return Z["default"].createElement(oe["default"],V({key:e.value+"-"+t,active:i(e.value),onClick:n.handleItemClick,selected:s===t},e,{style:V({},e.style,{pointerEvents:"all"})}))})},n.renderMenu=function(){var e=n.props,t=e.children,r=e.header,o=n.state.open,a=o?"visible":"";if(t){var s=G.Children.only(t),l=(0,H["default"])(a,s.props.className);return(0,G.cloneElement)(s,{className:l})}return Z["default"].createElement(ue["default"],{className:a},(0,$.createShorthand)(se["default"],function(e){return{content:e}},r),n.renderOptions())},s=t,a(n,s)}return s(r,t),B(r,[{key:"componentWillMount",value:function(){Y(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this)&&Y(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillMount",this).call(this),ie("componentWillMount()");var e=this.state,t=e.open,n=e.value;this.setValue(n),t&&this.open()}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,F["default"])(e,this.props)||!(0,F["default"])(t,this.state)}},{key:"componentWillReceiveProps",value:function(t){if(Y(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"componentWillReceiveProps",this).call(this,t),ie("componentWillReceiveProps()"),ie("to props:",(0,$.objectDiff)(this.props,t)),"production"!==e.env.NODE_ENV){var n=Array.isArray(t.value),o=(0,z["default"])(t,"value");o&&t.multiple&&!n?console.error("Dropdown `value` must be an array when `multiple` is set."+(" Received type: `"+Object.prototype.toString.call(t.value)+"`.")):o&&!t.multiple&&n&&console.error("Dropdown `value` must not be an array when `multiple` is not set. Either set `multiple={true}` or use a string or number value.")}(0,F["default"])(t.value,this.props.value)||(ie("value changed, setting",t.value),this.setValue(t.value))}},{key:"componentDidUpdate",value:function(e,t){ie("componentDidUpdate()"),ie("to state:",(0,$.objectDiff)(t,this.state)),!t.focus&&this.state.focus?(ie("dropdown focused"),this.isMouseDown||(ie("mouse is not down, opening"),this.open()),this.state.open?(document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter),document.addEventListener("keydown",this.removeItemOnBackspace)):(document.addEventListener("keydown",this.openOnArrow),document.addEventListener("keydown",this.openOnSpace))):t.focus&&!this.state.focus&&(ie("dropdown blurred"),this.isMouseDown||(ie("mouse is not down, closing"),this.close()),document.removeEventListener("keydown",this.openOnArrow),document.removeEventListener("keydown",this.openOnSpace),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.removeItemOnBackspace)),!t.open&&this.state.open?(ie("dropdown opened"),document.addEventListener("keydown",this.closeOnEscape),document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter),document.addEventListener("keydown",this.removeItemOnBackspace),document.addEventListener("click",this.closeOnDocumentClick),document.removeEventListener("keydown",this.openOnArrow),document.removeEventListener("keydown",this.openOnSpace)):t.open&&!this.state.open&&(ie("dropdown closed"),this.handleClose(),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.removeItemOnBackspace),document.removeEventListener("click",this.closeOnDocumentClick))}},{key:"componentWillUnmount",value:function(){ie("componentWillUnmount()"),document.removeEventListener("keydown",this.openOnArrow),document.removeEventListener("keydown",this.openOnSpace),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.removeItemOnBackspace),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("click",this.closeOnDocumentClick)}},{key:"render",value:function(){var e=this;ie("render()"),ie("props",this.props),ie("state",this.state);var t=this.state.open,n=this.props,o=n.basic,a=n.button,s=n.className,l=n.compact,u=n.fluid,i=n.floating,c=n.icon,p=n.inline,d=n.labeled,f=n.multiple,y=n.pointing,m=n.search,v=n.selection,h=n.simple,g=n.loading,b=n.error,P=n.disabled,T=n.scrolling,O=n.trigger,_=(0,H["default"])("ui",(0,$.useKeyOnly)(t,"active visible"),(0,$.useKeyOnly)(P,"disabled"),(0,$.useKeyOnly)(b,"error"),(0,$.useKeyOnly)(g,"loading"),(0,$.useKeyOnly)(o,"basic"),(0,$.useKeyOnly)(a,"button"),(0,$.useKeyOnly)(l,"compact"),(0,$.useKeyOnly)(u,"fluid"),(0,$.useKeyOnly)(i,"floating"),(0,$.useKeyOnly)(p,"inline"),(0,$.useKeyOnly)(d,"labeled"),(0,$.useKeyOnly)(f,"multiple"),(0,$.useKeyOnly)(m,"search"),(0,$.useKeyOnly)(v,"selection"),(0,$.useKeyOnly)(h,"simple"),(0,$.useKeyOnly)(T,"scrolling"),(0,$.useKeyOrValueAndKey)(y,"pointing"),s,"dropdown"),E=(0,$.getUnhandledProps)(r,this.props),j=(0,$.getElementType)(r,this.props);return Z["default"].createElement(j,V({},E,{className:_,onBlur:this.handleBlur,onClick:this.handleClick,onMouseDown:this.handleMouseDown,onFocus:this.handleFocus,onChange:this.handleChange,tabIndex:m?void 0:0,ref:function(t){return e._dropdown=t}}),this.renderHiddenInput(),this.renderLabels(),this.renderSearchInput(),this.renderSearchSizer(),O||this.renderText(),Q["default"].create(c),this.renderMenu())}}]),r}($.AutoControlledComponent);pe.propTypes={as:$.customPropTypes.as,icon:G.PropTypes.oneOfType([G.PropTypes.element,G.PropTypes.string]),options:$.customPropTypes.every([$.customPropTypes.disallow(["children"]),G.PropTypes.arrayOf(G.PropTypes.shape(oe["default"].propTypes))]),open:G.PropTypes.bool,defaultOpen:G.PropTypes.bool,children:$.customPropTypes.every([$.customPropTypes.disallow(["options","selection"]),$.customPropTypes.givenProps({children:G.PropTypes.any.isRequired},Z["default"].PropTypes.element.isRequired)]),value:G.PropTypes.oneOfType([G.PropTypes.string,G.PropTypes.number,G.PropTypes.arrayOf(G.PropTypes.oneOfType([G.PropTypes.string,G.PropTypes.number]))]),defaultValue:G.PropTypes.oneOfType([G.PropTypes.string,G.PropTypes.number,G.PropTypes.arrayOf(G.PropTypes.oneOfType([G.PropTypes.string,G.PropTypes.number]))]),placeholder:G.PropTypes.string,name:G.PropTypes.string,trigger:$.customPropTypes.every([$.customPropTypes.disallow(["selection","text"]),G.PropTypes.node]),allowAdditions:$.customPropTypes.every([$.customPropTypes.demand(["options","selection","search"]),G.PropTypes.bool]),additionPosition:G.PropTypes.oneOf(ce.props.additionPosition),additionLabel:G.PropTypes.string,noResultsMessage:G.PropTypes.string,selectOnBlur:G.PropTypes.bool,search:G.PropTypes.oneOfType([G.PropTypes.bool,G.PropTypes.func]),onAddItem:G.PropTypes.func,onBlur:G.PropTypes.func,onChange:G.PropTypes.func,onSearchChange:G.PropTypes.func,onClick:G.PropTypes.func,onFocus:G.PropTypes.func,onMouseDown:G.PropTypes.func,basic:G.PropTypes.bool,button:G.PropTypes.bool,className:G.PropTypes.string,compact:G.PropTypes.bool,fluid:G.PropTypes.bool,floating:G.PropTypes.bool,header:G.PropTypes.node,inline:G.PropTypes.bool,labeled:G.PropTypes.bool,multiple:G.PropTypes.bool,pointing:G.PropTypes.oneOfType([G.PropTypes.bool,G.PropTypes.oneOf(ce.props.pointing)]),text:G.PropTypes.string,selection:$.customPropTypes.every([$.customPropTypes.disallow(["children"]),$.customPropTypes.demand(["options"]),G.PropTypes.bool]),simple:G.PropTypes.bool,loading:G.PropTypes.bool,error:G.PropTypes.bool,disabled:G.PropTypes.bool,scrolling:G.PropTypes.bool},pe.defaultProps={icon:"dropdown",additionLabel:"Add:",noResultsMessage:"No results found.",selectOnBlur:!0},pe.autoControlledProps=["open","value"],pe._meta=ce,pe.Divider=re["default"],pe.Header=se["default"],pe.Item=oe["default"],pe.Menu=ue["default"],t["default"]=pe}).call(t,r(/*! ./~/node-libs-browser/~/process/browser.js */69))},/*!************************************!*\
!*** ./src/modules/Modal/Modal.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/pick */41),u=n(l),i=r(/*! lodash/omit */40),c=n(i),p=r(/*! lodash/keys */8),d=n(p),f=r(/*! lodash/isEqual */67),y=n(f),m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(/*! react */1),g=n(h),b=r(/*! classnames */3),P=n(b),T=r(/*! ./ModalHeader */178),O=n(T),_=r(/*! ./ModalContent */176),E=n(_),j=r(/*! ./ModalActions */175),w=n(j),M=r(/*! ./ModalDescription */177),S=n(M),x=r(/*! ../../addons/Portal */70),A=n(x),N=r(/*! ../../lib */2),k=(0,N.makeDebugger)("modal"),C={name:"Modal",type:N.META.TYPES.MODULE,props:{size:["fullscreen","large","small"],dimmer:["inverted","blurring"]}},I=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.handleMount=function(){k("handleOpen()");var e=n.props.dimmer,t=n.getMountNode();e&&(k("adding dimmer"),t.classList.add("dimmable","dimmed"),"blurring"===e&&(k("adding blurred dimmer"),t.classList.add("blurring")))},n.handleUnmount=function(){k("handleUnmount()");var e=n.getMountNode();e.classList.remove("blurring","dimmable","dimmed","scrollable")},n.getMountNode=function(){return n.props.mountNode||document.body},n.setPosition=function(){if(n._modalNode){var e=n.getMountNode(),t=n._modalNode.getBoundingClientRect(),r=t.height,o=r>=window.innerHeight,a={marginTop:-Math.round(r/2),scrolling:o};!n.state.scrolling&&o?e.classList.add("scrolling"):n.state.scrolling&&!o&&e.classList.remove("scrolling"),(0,y["default"])(a,n.state)||n.setState(a)}requestAnimationFrame(n.setPosition)},s=r,a(n,s)}return s(t,e),v(t,[{key:"componentDidMount",value:function(){k("componentDidMount()"),this.setPosition()}},{key:"componentWillUnmount",value:function(){k("componentWillUnmount()"),this.handleUnmount()}},{key:"render",value:function(){var e=this,r=this.props,n=r.basic,o=r.children,a=r.className,s=r.dimmer,l=r.size,i=this.state,p=i.marginTop,f=i.scrolling,y=(0,P["default"])("ui",l,(0,N.useKeyOnly)(n,"basic"),(0,N.useKeyOnly)(f,"scrolling"),"modal transition visible active",a),v=(0,N.getUnhandledProps)(t,this.props),h=(0,d["default"])(A["default"].propTypes),b=(0,c["default"])(v,h),T=(0,u["default"])(v,h),O=(0,N.getElementType)(t,this.props),_=g["default"].createElement(O,m({},b,{className:y,style:{marginTop:p},ref:function(t){return e._modalNode=t}}),o),E=s?(0,P["default"])("ui","inverted"===s&&"inverted","page modals dimmer transition visible active"):null;return g["default"].createElement(A["default"],m({closeOnRootNodeClick:!0,closeOnDocumentClick:!1},T,{className:E,mountNode:this.getMountNode(),onMount:this.handleMount,onUnmount:this.handleUnmount}),_)}}]),t}(h.Component);I.propTypes={as:N.customPropTypes.as,children:h.PropTypes.node,className:h.PropTypes.string,basic:h.PropTypes.bool,dimmer:h.PropTypes.oneOfType([h.PropTypes.bool,h.PropTypes.oneOf(C.props.dimmer)]),mountNode:h.PropTypes.any,size:h.PropTypes.oneOf(C.props.size)},I.defaultProps={dimmer:!0},I._meta=C,I.Header=O["default"],I.Content=E["default"],I.Description=S["default"],I.Actions=w["default"],t["default"]=I},/*!************************************!*\
!*** ./src/modules/Popup/Popup.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/keys */8),u=n(l),i=r(/*! lodash/pick */41),c=n(i),p=r(/*! lodash/assign */440),d=n(p),f=r(/*! lodash/mapValues */476),y=n(f),m=r(/*! lodash/isNumber */248),v=n(m),h=r(/*! lodash/includes */65),g=n(h),b=r(/*! lodash/without */6),P=n(b),T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},O=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_=r(/*! react */1),E=n(_),j=r(/*! classnames */3),w=n(j),M=r(/*! ../../lib */2),S=r(/*! ../../addons/Portal */70),x=n(S),A=r(/*! ./PopupContent */180),N=n(A),k=r(/*! ./PopupHeader */181),C=n(k),I={name:"Popup",type:M.META.TYPES.MODULE,props:{content:[_.PropTypes.string,_.PropTypes.node],on:["hover","click","focus"],positioning:["top left","top right","bottom right","bottom left","right center","left center","top center","bottom center"],size:(0,P["default"])(M.SUI.SIZES,"medium","big","massive"),wide:[!0,!1,"very"]}},K=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.state={},n.hideOnScroll=function(e){n.setState({closed:!0}),window.removeEventListener("scroll",n.hideOnScroll),setTimeout(function(){return n.setState({closed:!1})},50)},n.onOpen=function(e){n.coords=e.currentTarget.getBoundingClientRect(),n.props.hideOnScroll&&window.addEventListener("scroll",n.hideOnScroll)},n.popupMounted=function(e){n.popupCoords=e?e.getBoundingClientRect():null,n.setPopupStyle()},s=r,a(n,s)}return s(t,e),O(t,[{key:"computePopupStyle",value:function(e){var t={position:"absolute"},r=this.props.offset,n=window,o=n.pageYOffset,a=n.pageXOffset,s=document.documentElement,l=s.clientWidth,u=s.clientHeight;if((0,g["default"])(e,"right"))t.right=Math.round(l-(this.coords.right+a)),t.left="auto";else if((0,g["default"])(e,"left"))t.left=Math.round(this.coords.left+a),t.right="auto";else{var i=(this.coords.width-this.popupCoords.width)/2;t.left=Math.round(this.coords.left+i+a),t.right="auto"}if((0,g["default"])(e,"top"))t.bottom=Math.round(u-(this.coords.top+o)),t.top="auto";else if((0,g["default"])(e,"bottom"))t.top=Math.round(this.coords.bottom+o),t.bottom="auto";else{var c=(this.coords.height+this.popupCoords.height)/2;t.top=Math.round(this.coords.bottom+o-c),t.bottom="auto";var p=this.popupCoords.width+8;(0,g["default"])(e,"right")?t.right-=p:t.left-=p}return r&&((0,v["default"])(t.right)?t.right-=r:t.left-=r),t}},{key:"isStyleInViewport",value:function(e){var t=window,r=t.pageYOffset,n=t.pageXOffset,o=document.documentElement,a=o.clientWidth,s=o.clientHeight,l={top:e.top,left:e.left,width:this.popupCoords.width,height:this.popupCoords.height};return(0,v["default"])(e.right)&&(l.left=a-e.right-l.width),(0,v["default"])(e.bottom)&&(l.top=s-e.bottom-l.height),!(l.top<r)&&(!(l.top+l.height>r+s)&&(!(l.left<n)&&!(l.left+l.width>n+a)))}},{key:"setPopupStyle",value:function(){if(this.coords&&this.popupCoords){for(var e=this.props.positioning,t=this.computePopupStyle(e),r=(0,P["default"])(I.props.positioning,e),n=0;!this.isStyleInViewport(t)&&n<r.length;n++)t=this.computePopupStyle(r[n]),e=r[n];t=(0,y["default"])(t,function(e){return(0,v["default"])(e)?e+"px":e}),this.setState({style:t,positioning:e})}}},{key:"getPortalProps",value:function(){var e={onOpen:this.onOpen},t=this.props,r=t.on,n=t.hoverable;switch(r){case"click":e.openOnTriggerClick=!0,e.closeOnTriggerClick=!0,e.closeOnDocumentClick=!0;break;case"focus":e.openOnTriggerFocus=!0,e.closeOnTriggerBlur=!0;break;default:e.openOnTriggerMouseOver=!0,e.closeOnTriggerMouseLeave=!0,e.mouseLeaveDelay=70,e.mouseOverDelay=50}return n&&(e.closeOnPortalMouseLeave=!0,e.mouseLeaveDelay=300),e}},{key:"render",value:function(){var e=this.props,r=e.basic,n=e.children,o=e.className,a=e.content,s=e.flowing,l=e.header,i=e.inverted,p=e.size,f=e.trigger,y=e.wide,m=this.state,v=m.positioning,h=m.closed,g=(0,d["default"])({},this.state.style,this.props.style),b=(0,w["default"])("ui",v,p,(0,M.useKeyOrValueAndKey)(y,"wide"),(0,M.useKeyOnly)(r,"basic"),(0,M.useKeyOnly)(s,"flowing"),(0,M.useKeyOnly)(i,"inverted"),"popup transition visible",o);if(h)return f;var P=(0,M.getUnhandledProps)(t,this.props),O=(0,M.getElementType)(t,this.props),_=(0,c["default"])(P,(0,u["default"])(x["default"].propTypes)),j=E["default"].createElement(O,T({},P,{className:b,style:g,ref:this.popupMounted}),n,!n&&C["default"].create(l),!n&&N["default"].create(a));return E["default"].createElement(x["default"],T({},_,{trigger:f},this.getPortalProps()),j)}}]),t}(_.Component);K.propTypes={basic:_.PropTypes.bool,children:_.PropTypes.node,className:_.PropTypes.string,content:_.PropTypes.oneOfType(I.props.content),flowing:_.PropTypes.bool,header:_.PropTypes.string,hoverable:_.PropTypes.bool,inverted:_.PropTypes.bool,hideOnScroll:_.PropTypes.bool,offset:_.PropTypes.number,on:_.PropTypes.oneOf(I.props.on),positioning:_.PropTypes.oneOf(I.props.positioning),size:_.PropTypes.oneOf(I.props.size),style:_.PropTypes.object,trigger:_.PropTypes.node,wide:_.PropTypes.oneOf(I.props.wide)},K.defaultProps={positioning:"top left",on:"hover"},K._meta=I,K.Content=N["default"],K.Header=C["default"],t["default"]=K},/*!************************************!*\
!*** ./src/modules/Popup/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Popup */313),a=n(o);t["default"]=a["default"]},/*!******************************************!*\
!*** ./src/modules/Progress/Progress.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.active,r=e.attached,n=e.autoSuccess,a=e.color,s=e.children,l=e.className,i=e.disabled,p=e.error,f=e.indicating,v=e.inverted,g=e.label,T=e.percent,O=e.precision,_=e.progress,E=e.size,j=e.success,w=e.total,M=e.value,S=e.warning,x=n&&(T>=100||M>=w),A=_||g||!(0,y["default"])(O)||!(0,d["default"])([w,M],y["default"]),N=void 0;(0,y["default"])(T)?(0,y["default"])(w)||(0,y["default"])(M)||(N=M/w*100):N=T,N=(0,c["default"])(N,0,100),(0,y["default"])(O)||(N=(0,u["default"])(N,O));var k=void 0;"percent"===g||g===!0||(0,y["default"])(g)?k=N+"%":"ratio"===g&&(k=M+"/"+w);var C=(0,h["default"])("ui",E,a,(0,P.useKeyOnly)(t||f,"active"),(0,P.useKeyOnly)(x||j,"success"),(0,P.useKeyOnly)(S,"warning"),(0,P.useKeyOnly)(p,"error"),(0,P.useKeyOnly)(i,"disabled"),(0,P.useKeyOnly)(f,"indicating"),(0,P.useKeyOnly)(v,"inverted"),(0,P.useValueAndKey)(r,"attached"),l,"progress"),I=(0,P.getUnhandledProps)(o,e),K=(0,P.getElementType)(o,e);return b["default"].createElement(K,m({},I,{className:C}),b["default"].createElement("div",{className:"bar",style:{width:N+"%"}},A&&b["default"].createElement("div",{className:"progress"},k)),s&&b["default"].createElement("div",{className:"label"},s))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(/*! lodash/without */6),s=n(a),l=r(/*! lodash/round */483),u=n(l),i=r(/*! lodash/clamp */441),c=n(i),p=r(/*! lodash/every */243),d=n(p),f=r(/*! lodash/isUndefined */472),y=n(f),m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v=r(/*! classnames */3),h=n(v),g=r(/*! react */1),b=n(g),P=r(/*! ../../lib */2);o._meta={name:"Progress",type:P.META.TYPES.MODULE,props:{attached:["top","bottom"],color:P.SUI.COLORS,label:["ratio","percent"],size:(0,s["default"])(P.SUI.SIZES,"mini","huge","massive")}},o.propTypes={as:P.customPropTypes.as,active:g.PropTypes.bool,attached:g.PropTypes.oneOf(o._meta.props.attached),autoSuccess:g.PropTypes.bool,color:g.PropTypes.oneOf(o._meta.props.color),children:g.PropTypes.node,className:g.PropTypes.string,disabled:g.PropTypes.bool,error:g.PropTypes.bool,indicating:g.PropTypes.bool,inverted:g.PropTypes.bool,label:P.customPropTypes.every([P.customPropTypes.some([P.customPropTypes.demand(["percent"]),P.customPropTypes.demand(["total","value"])]),g.PropTypes.oneOfType([g.PropTypes.bool,g.PropTypes.oneOf(o._meta.props.label)])]),percent:P.customPropTypes.every([P.customPropTypes.disallow(["total","value"]),g.PropTypes.oneOfType([g.PropTypes.string,g.PropTypes.number])]),progress:g.PropTypes.bool,precision:g.PropTypes.number,size:g.PropTypes.oneOf(o._meta.props.size),success:g.PropTypes.bool,total:P.customPropTypes.every([P.customPropTypes.demand(["value"]),P.customPropTypes.disallow(["percent"]),g.PropTypes.oneOfType([g.PropTypes.string,g.PropTypes.number])]),value:P.customPropTypes.every([P.customPropTypes.demand(["total"]),P.customPropTypes.disallow(["percent"]),g.PropTypes.oneOfType([g.PropTypes.string,g.PropTypes.number])]),warning:g.PropTypes.bool},t["default"]=o},/*!***************************************!*\
!*** ./src/modules/Progress/index.js ***!
\***************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Progress */315),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/modules/Rating/Rating.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=r(/*! lodash/times */255),u=n(l),i=r(/*! lodash/invoke */246),c=n(i),p=r(/*! lodash/without */6),d=n(p),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),m=r(/*! classnames */3),v=n(m),h=r(/*! react */1),g=n(h),b=r(/*! ../../lib */2),P=r(/*! ./RatingIcon */318),T=n(P),O={name:"Rating",type:b.META.TYPES.MODULE,props:{clearable:["auto"],icon:["star","heart"],size:(0,d["default"])(b.SUI.SIZES,"medium","big")}},_=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),E.call(n),s=r,a(n,s)}return s(t,e),y(t,[{key:"render",value:function(){var e=this,r=this.props,n=r.className,o=r.disabled,a=r.icon,s=r.maxRating,l=r.size,i=this.state,c=i.rating,p=i.selectedIndex,d=i.isSelecting,y=(0,v["default"])("ui",a,l,(0,b.useKeyOnly)(o,"disabled"),(0,b.useKeyOnly)(d&&!o&&p>=0,"selected"),"rating",n),m=(0,b.getUnhandledProps)(t,this.props),h=(0,b.getElementType)(t,this.props);return g["default"].createElement(h,f({},m,{className:y,onMouseLeave:this.handleMouseLeave}),(0,u["default"])(s,function(t){return g["default"].createElement(T["default"],{active:c>=t+1,index:t,key:t,onClick:e.handleIconClick,onMouseEnter:e.handleIconMouseEnter,selected:p>=t&&d})}))}}]),t}(b.AutoControlledComponent);_.autoControlledProps=["rating"],_.defaultProps={clearable:"auto",maxRating:1},_.propTypes={as:b.customPropTypes.as,className:h.PropTypes.string,clearable:h.PropTypes.oneOfType([h.PropTypes.oneOf(O.props.clearable),h.PropTypes.bool]),defaultRating:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.number]),disabled:h.PropTypes.bool,icon:h.PropTypes.oneOf(O.props.icon),maxRating:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.number]),onRate:h.PropTypes.func,rating:h.PropTypes.oneOfType([h.PropTypes.string,h.PropTypes.number]),size:h.PropTypes.oneOf(O.props.size)},_._meta=O;var E=function(){var e=this;this.handleIconClick=function(t,r){var n=e.props,o=n.clearable,a=n.disabled,s=n.maxRating,l=n.onRate,u=e.state.rating;if(!a){var i=r+1;"auto"===o&&1===s?i=+!u:o===!0&&i===u&&(i=0),e.trySetState({rating:i},{isSelecting:!1}),l&&l(t,{rating:i,maxRating:s})}},this.handleIconMouseEnter=function(t){e.props.disabled||e.setState({selectedIndex:t,isSelecting:!0})},this.handleMouseLeave=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];c["default"].apply(void 0,[e.props,"onMouseLeave"].concat(r)),e.props.disabled||e.setState({selectedIndex:-1,isSelecting:!1})}};t["default"]=_},/*!******************************************!*\
!*** ./src/modules/Rating/RatingIcon.js ***!
\******************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(/*! classnames */3),i=n(u),c=r(/*! react */1),p=n(c),d=r(/*! ../../lib */2),f=function(e){function t(){var e,r,n,s;o(this,t);for(var l=arguments.length,u=Array(l),i=0;i<l;i++)u[i]=arguments[i];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),n.handleClick=function(e){var t=n.props,r=t.onClick,o=t.index;r&&r(e,o)},n.handleMouseEnter=function(){var e=n.props,t=e.onMouseEnter,r=e.index;t&&t(r)},s=r,a(n,s)}return s(t,e),l(t,[{key:"render",value:function(){var e=this.props,t=e.active,r=e.selected,n=(0,i["default"])((0,d.useKeyOnly)(t,"active"),(0,d.useKeyOnly)(r,"selected"),"icon");return p["default"].createElement("i",{className:n,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter})}}]),t}(c.Component);f.propTypes={active:c.PropTypes.bool,index:c.PropTypes.number,onClick:c.PropTypes.func,onMouseEnter:c.PropTypes.func,selected:c.PropTypes.bool},f._meta={name:"RatingIcon",parent:"Rating",type:d.META.TYPES.MODULE},t["default"]=f},/*!*************************************!*\
!*** ./src/modules/Rating/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Rating */317),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/modules/Search/Search.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=r(/*! lodash/isEmpty */124),i=n(u),c=r(/*! lodash/partialRight */480),p=n(c),d=r(/*! lodash/inRange */469),f=n(d),y=r(/*! lodash/map */9),m=n(y),v=r(/*! lodash/get */37),h=n(v),g=r(/*! lodash/reduce */252),b=n(g),P=r(/*! lodash/isEqual */67),T=n(P),O=r(/*! lodash/without */6),_=n(O),E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},j=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),w=function V(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:V(o,t,r)}if("value"in n)return n.value;var a=n.get;if(void 0!==a)return a.call(r)},M=r(/*! classnames */3),S=n(M),x=r(/*! react */1),A=n(x),N=r(/*! ../../lib */2),k=r(/*! ../../elements/Input */75),C=n(k),I=r(/*! ./SearchCategory */182),K=n(I),L=r(/*! ./SearchResult */183),U=n(L),D=r(/*! ./SearchResults */184),R=n(D),z=(0,N.makeDebugger)("search"),W={name:"Search",type:N.META.TYPES.MODULE,props:{size:(0,_["default"])(N.SUI.SIZES,"medium")}},F=function(e){function t(){var e,r,n,l;a(this,t);for(var u=arguments.length,c=Array(u),d=0;d<u;d++)c[d]=arguments[d];return r=n=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),n.handleChange=function(e,t){z("handleChange()"),z(t);var r=n.props.onChange;r&&r(e,t)},n.closeOnEscape=function(e){N.keyboardKey.getCode(e)===N.keyboardKey.Escape&&(e.preventDefault(),n.close())},n.moveSelectionOnKeyDown=function(e){switch(z("moveSelectionOnKeyDown()"),z(N.keyboardKey.getName(e)),N.keyboardKey.getCode(e)){case N.keyboardKey.ArrowDown:e.preventDefault(),n.moveSelectionBy(1);break;case N.keyboardKey.ArrowUp:e.preventDefault(),n.moveSelectionBy(-1)}},n.selectItemOnEnter=function(e){if(z("selectItemOnEnter()"),z(N.keyboardKey.getName(e)),N.keyboardKey.getCode(e)===N.keyboardKey.Enter){e.preventDefault();var t=n.getSelectedResult();t&&(n.setValue(t.title),n.handleChange(e,t),n.close())}},n.closeOnDocumentClick=function(e){z("closeOnDocumentClick()"),z(e),n.close()},n.handleMouseDown=function(e){z("handleMouseDown()");var t=n.props.onMouseDown;t&&t(e),n.isMouseDown=!0,document.addEventListener("mouseup",n.handleDocumentMouseUp)},n.handleDocumentMouseUp=function(){z("handleDocumentMouseUp()"),n.isMouseDown=!1,document.removeEventListener("mouseup",n.handleDocumentMouseUp)},n.handleInputClick=function(e){z("handleInputClick()",e),e.nativeEvent.stopImmediatePropagation(),n.tryOpen()},n.handleItemClick=function(e,t){z("handleItemClick()"),z(t);var r=n.getSelectedResult(t);e.nativeEvent.stopImmediatePropagation(),n.setValue(r.title),n.handleChange(e,r),n.close()},n.handleFocus=function(e){z("handleFocus()");var t=n.props.onFocus;t&&t(e),n.setState({focus:!0})},n.handleBlur=function(e){z("handleBlur()");var t=n.props.onBlur;t&&t(e),n.setState({focus:!1})},n.handleSearchChange=function(e){z("handleSearchChange()"),z(e.target.value),e.stopPropagation();var t=n.props,r=t.onSearchChange,o=t.minCharacters,a=n.state.open,s=e.target.value;r&&r(e,s),s.length<o?n.close():a||n.tryOpen(s),n.setValue(s)},n.getFlattenedResults=function(){var e=n.props,t=e.category,r=e.results;return t?(0,b["default"])(r,function(e,t){return e.concat(t.results)},[]):r},n.getSelectedResult=function(){var e=arguments.length<=0||void 0===arguments[0]?n.state.selectedIndex:arguments[0],t=n.getFlattenedResults();return(0,h["default"])(t,e)},n.setValue=function(e){z("setValue()"),z("value",e);var t=n.props.selectFirstResult;n.trySetState({value:e},{selectedIndex:t?0:-1})},n.moveSelectionBy=function(e){z("moveSelectionBy()"),z("offset: "+e);var t=n.state.selectedIndex,r=n.getFlattenedResults(),o=r.length-1,a=t+e;a>o?a=0:a<0&&(a=o),n.setState({selectedIndex:a}),n.scrollSelectedItemIntoView()},n.scrollSelectedItemIntoView=function(){z("scrollSelectedItemIntoView()");var e=document.querySelector(".ui.search.active.visible .results.visible"),t=e.querySelector(".result.active");z("menu (results): "+e),z("item (result): "+t);var r=t.offsetTop<e.scrollTop,n=t.offsetTop+t.clientHeight>e.scrollTop+e.clientHeight;(r||n)&&(e.scrollTop=t.offsetTop)},n.tryOpen=function(){var e=arguments.length<=0||void 0===arguments[0]?n.state.value:arguments[0];z("open()");var t=n.props.minCharacters;e.length<t||n.open()},n.open=function(){z("open()"),n.trySetState({open:!0})},n.close=function(){z("close()"),n.trySetState({open:!1})},n.renderSearchInput=function(){var e=n.props,t=e.icon,r=e.placeholder,o=n.state.value;return A["default"].createElement(C["default"],{value:o,placeholder:r,onBlur:n.handleBlur,onChange:n.handleSearchChange,onFocus:n.handleFocus,onClick:n.handleInputClick,input:{className:"prompt",tabIndex:"0",autoComplete:"off"},icon:t})},n.renderNoResults=function(){var e=n.props,t=e.noResultsMessage,r=e.noResultsDescription;return A["default"].createElement("div",{className:"message empty"},A["default"].createElement("div",{className:"header"},t),r&&A["default"].createElement("div",{className:"description"},r))},n.renderResult=function(e,t,r){var a=e.childKey,s=o(e,["childKey"]),l=arguments.length<=3||void 0===arguments[3]?0:arguments[3],u=n.props.resultRenderer,i=n.state.selectedIndex,c=t+l;return A["default"].createElement(U["default"],E({key:a||s.title,active:i===c,onClick:n.handleItemClick,onMouseDown:function(e){return e.preventDefault()},renderer:u},s,{id:c}))},n.renderResults=function(){var e=n.props.results;return(0,m["default"])(e,n.renderResult)},n.renderCategories=function(){var e=n.props,t=e.categoryRenderer,r=e.results,a=n.state.selectedIndex,s=0;return(0,m["default"])(r,function(e,r,l){var u=e.childKey,i=o(e,["childKey"]),c=E({key:u||i.name,active:(0,f["default"])(a,s,s+i.results.length),renderer:t},i),d=(0,p["default"])(n.renderResult,s);return s+=i.results.length,A["default"].createElement(K["default"],c,i.results.map(d))})},n.renderMenuContent=function(){var e=n.props,t=e.category,r=e.showNoResults,o=e.results;return(0,i["default"])(o)?r?n.renderNoResults():null:t?n.renderCategories():n.renderResults()},n.renderResultsMenu=function(){var e=n.state.open,t=e?"visible":"",r=n.renderMenuContent();if(r)return A["default"].createElement(R["default"],{className:t},r)},l=r,s(n,l)}return l(t,e),j(t,[{key:"componentWillMount",value:function(){w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillMount",this)&&w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillMount",this).call(this),z("componentWillMount()");var e=this.state,r=e.open,n=e.value;this.setValue(n),r&&this.open()}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,T["default"])(e,this.props)||!(0,T["default"])(t,this.state)}},{key:"componentWillReceiveProps",value:function(e){w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillReceiveProps",this).call(this,e),z("componentWillReceiveProps()"),z("changed props:",(0,N.objectDiff)(e,this.props)),(0,T["default"])(e.value,this.props.value)||(z("value changed, setting",e.value),this.setValue(e.value))}},{key:"componentDidUpdate",value:function(e,t){z("componentDidUpdate()"),z("to state:",(0,N.objectDiff)(t,this.state)),!t.focus&&this.state.focus?(z("search focused"),this.isMouseDown||(z("mouse is not down, opening"),this.tryOpen()),this.state.open&&(document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter))):t.focus&&!this.state.focus&&(z("search blurred"),this.isMouseDown||(z("mouse is not down, closing"),this.close()),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter)),!t.open&&this.state.open?(z("search opened"),this.open(),document.addEventListener("keydown",this.closeOnEscape),document.addEventListener("keydown",this.moveSelectionOnKeyDown),document.addEventListener("keydown",this.selectItemOnEnter),document.addEventListener("click",this.closeOnDocumentClick)):t.open&&!this.state.open&&(z("search closed"),this.close(),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("click",this.closeOnDocumentClick))}},{key:"componentWillUnmount",value:function(){z("componentWillUnmount()"),document.removeEventListener("keydown",this.moveSelectionOnKeyDown),document.removeEventListener("keydown",this.selectItemOnEnter),document.removeEventListener("keydown",this.closeOnEscape),document.removeEventListener("click",this.closeOnDocumentClick)}},{key:"render",value:function(){z("render()"),z("props",this.props),z("state",this.state);var e=this.state,r=e.searchClasses,n=e.focus,o=e.open,a=this.props,s=a.aligned,l=a.category,u=a.className,i=a.fluid,c=a.loading,p=a.size,d=(0,S["default"])("ui",o&&"active visible",p,r,(0,N.useKeyOnly)(c,"loading"),(0,N.useValueAndKey)(s,"aligned"),(0,N.useKeyOnly)(l,"category"),(0,N.useKeyOnly)(n,"focus"),(0,N.useKeyOnly)(i,"fluid"),u,"search"),f=(0,N.getUnhandledProps)(t,this.props),y=(0,N.getElementType)(t,this.props);return A["default"].createElement(y,E({},f,{className:d,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onMouseDown:this.handleMouseDown}),this.renderSearchInput(),this.renderResultsMenu())}}]),t}(N.AutoControlledComponent);F.propTypes={as:N.customPropTypes.as,icon:x.PropTypes.oneOfType([x.PropTypes.element,x.PropTypes.string]),results:x.PropTypes.oneOfType([x.PropTypes.arrayOf(x.PropTypes.shape(U["default"].propTypes)),x.PropTypes.object]),open:x.PropTypes.bool,defaultOpen:x.PropTypes.bool,value:x.PropTypes.string,defaultValue:x.PropTypes.string,placeholder:x.PropTypes.string,minCharacters:x.PropTypes.number,noResultsMessage:x.PropTypes.string,noResultsDescription:x.PropTypes.string,selectFirstResult:x.PropTypes.bool,showNoResults:x.PropTypes.bool,categoryRenderer:x.PropTypes.func,resultRenderer:x.PropTypes.func,onBlur:x.PropTypes.func,onChange:x.PropTypes.func,onSearchChange:x.PropTypes.func,onFocus:x.PropTypes.func,onMouseDown:x.PropTypes.func,aligned:x.PropTypes.string,category:x.PropTypes.bool,className:x.PropTypes.string,fluid:x.PropTypes.bool,size:x.PropTypes.oneOf(W.props.size),loading:x.PropTypes.bool},F.defaultProps={icon:"search",minCharacters:1,noResultsMessage:"No results found.",showNoResults:!0},F.autoControlledProps=["open","value"],F._meta=W,F.Result=U["default"],F.Results=R["default"],F.Category=K["default"],t["default"]=F},/*!*************************************!*\
!*** ./src/modules/Search/index.js ***!
\*************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Search */320),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/views/Comment/Comment.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.className,r=e.children,n=e.collapsed,s=(0,l["default"])((0,c.useKeyOnly)(n,"collapsed"),"comment",t),u=(0,c.getUnhandledProps)(o,e),p=(0,c.getElementType)(o,e);return i["default"].createElement(p,a({},u,{className:s}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(/*! classnames */3),l=n(s),u=r(/*! react */1),i=n(u),c=r(/*! ../../lib */2),p=r(/*! ./CommentAction */188),d=n(p),f=r(/*! ./CommentActions */189),y=n(f),m=r(/*! ./CommentAuthor */190),v=n(m),h=r(/*! ./CommentAvatar */191),g=n(h),b=r(/*! ./CommentContent */192),P=n(b),T=r(/*! ./CommentGroup */193),O=n(T),_=r(/*! ./CommentMetadata */194),E=n(_),j=r(/*! ./CommentText */195),w=n(j);o._meta={name:"Comment",type:c.META.TYPES.VIEW},o.propTypes={as:c.customPropTypes.as,children:u.PropTypes.node,className:u.PropTypes.string,collapsed:u.PropTypes.bool},o.Author=v["default"],o.Action=d["default"],o.Actions=y["default"],o.Avatar=g["default"],o.Content=P["default"],o.Group=O["default"],o.Metadata=E["default"],o.Text=w["default"],t["default"]=o},/*!************************************!*\
!*** ./src/views/Comment/index.js ***!
\************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Comment */322),a=n(o);t["default"]=a["default"]},/*!********************************!*\
!*** ./src/views/Feed/Feed.js ***!
\********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e){var t=e.children,r=e.className,n=e.events,s=e.size,l=(0,d["default"])("ui",r,s,"feed"),u=(0,m.getUnhandledProps)(a,e),p=(0,m.getElementType)(a,e);if(t)return y["default"].createElement(p,c({},u,{className:l}),t);var f=(0,i["default"])(n,function(e){var t=e.childKey,r=e.date,n=e.meta,a=e.summary,s=o(e,["childKey","date","meta","summary"]),l=t||[r,n,a].join("-");return y["default"].createElement(T["default"],c({date:r,key:l,meta:n,summary:a},s))});return y["default"].createElement(p,c({},u,{className:l}),f)}Object.defineProperty(t,"__esModule",{value:!0});var s=r(/*! lodash/without */6),l=n(s),u=r(/*! lodash/map */9),i=n(u),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p=r(/*! classnames */3),d=n(p),f=r(/*! react */1),y=n(f),m=r(/*! ../../lib */2),v=r(/*! ./FeedContent */87),h=n(v),g=r(/*! ./FeedDate */47),b=n(g),P=r(/*! ./FeedEvent */196),T=n(P),O=r(/*! ./FeedExtra */88),_=n(O),E=r(/*! ./FeedLabel */89),j=n(E),w=r(/*! ./FeedLike */90),M=n(w),S=r(/*! ./FeedMeta */91),x=n(S),A=r(/*! ./FeedSummary */92),N=n(A),k=r(/*! ./FeedUser */93),C=n(k);a._meta={name:"Feed",type:m.META.TYPES.VIEW,props:{size:(0,l["default"])(m.SUI.SIZES,"mini","tiny","medium","big","huge","massive")}},a.propTypes={as:m.customPropTypes.as,children:f.PropTypes.node,className:f.PropTypes.string,events:m.customPropTypes.collectionShorthand,size:f.PropTypes.oneOf(a._meta.props.size)},a.Content=h["default"],a.Date=b["default"],a.Event=T["default"],a.Extra=_["default"],a.Label=j["default"],a.Like=M["default"],a.Meta=x["default"],a.Summary=N["default"],a.User=C["default"],t["default"]=a},/*!*********************************!*\
!*** ./src/views/Feed/index.js ***!
\*********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Feed */324),a=n(o);t["default"]=a["default"]},/*!*********************************!*\
!*** ./src/views/Item/index.js ***!
\*********************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Item */197),a=n(o);t["default"]=a["default"]},/*!**************************************!*\
!*** ./src/views/Statistic/index.js ***!
\**************************************/
function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=void 0;var o=r(/*! ./Statistic */201),a=n(o);t["default"]=a["default"]},/*!****************************!*\
!*** ./~/debug/browser.js ***!
\****************************/
function(e,t,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var e=arguments,r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,a=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(a=o))}),e.splice(a,0,n),e}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(r){}}function l(){var e;try{e=t.storage.debug}catch(r){}return e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=r(/*! ./debug */329),t.log=a,t.formatArgs=o,t.save=s,t.load=l,t.useColors=n,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(l())},/*!**************************!*\
!*** ./~/debug/debug.js ***!
\**************************/
function(e,t,r){function n(){return t.colors[c++%t.colors.length]}function o(e){function r(){}function o(){var e=o,r=+new Date,a=r-(i||r);e.diff=a,e.prev=i,e.curr=r,i=r,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=n());var s=Array.prototype.slice.call(arguments);s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var l=0;s[0]=s[0].replace(/%([a-z%])/g,function(r,n){if("%%"===r)return r;l++;var o=t.formatters[n];if("function"==typeof o){var a=s[l];r=o.call(e,a),s.splice(l,1),l--}return r}),"function"==typeof t.formatArgs&&(s=t.formatArgs.apply(e,s));var u=o.log||t.log||console.log.bind(console);u.apply(e,s)}r.enabled=!1,o.enabled=!0;var a=t.enabled(e)?o:r;return a.namespace=e,a}function a(e){t.save(e);for(var r=(e||"").split(/[\s,]+/),n=r.length,o=0;o<n;o++)r[o]&&(e=r[o].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function s(){t.enable("")}function l(e){var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o,t.coerce=u,t.disable=s,t.enable=a,t.enabled=l,t.humanize=r(/*! ms */492),t.names=[],t.skips=[],t.formatters={};var i,c=0},/*!*******************************!*\
!*** ./~/lodash/_DataView.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=r(/*! ./_root */11),a=n(o,"DataView");e.exports=a},/*!***************************!*\
!*** ./~/lodash/_Hash.js ***!
\***************************/
function(e,t,r){function n(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var o=r(/*! ./_hashClear */399),a=r(/*! ./_hashDelete */400),s=r(/*! ./_hashGet */401),l=r(/*! ./_hashHas */402),u=r(/*! ./_hashSet */403);n.prototype.clear=o,n.prototype["delete"]=a,n.prototype.get=s,n.prototype.has=l,n.prototype.set=u,e.exports=n},/*!******************************!*\
!*** ./~/lodash/_Promise.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=r(/*! ./_root */11),a=n(o,"Promise");e.exports=a},/*!**********************************!*\
!*** ./~/lodash/_addMapEntry.js ***!
\**********************************/
function(e,t){function r(e,t){return e.set(t[0],t[1]),e}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_addSetEntry.js ***!
\**********************************/
function(e,t){function r(e,t){return e.add(t),e}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_arrayEvery.js ***!
\*********************************/
function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(!t(e[r],r,e))return!1;return!0}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_arrayFilter.js ***!
\**********************************/
function(e,t){function r(e,t){for(var r=-1,n=e?e.length:0,o=0,a=[];++r<n;){var s=e[r];t(s,r,e)&&(a[o++]=s)}return a}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_asciiToArray.js ***!
\***********************************/
function(e,t){function r(e){return e.split("")}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_asciiWords.js ***!
\*********************************/
function(e,t){function r(e){return e.match(n)||[]}var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseEvery.js ***!
\********************************/
function(e,t,r){function n(e,t){var r=!0;return o(e,function(e,n,o){return r=!!t(e,n,o)}),r}var o=r(/*! ./_baseEach */26);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseFilter.js ***!
\*********************************/
function(e,t,r){function n(e,t){var r=[];return o(e,function(e,n,o){t(e,n,o)&&r.push(e)}),r}var o=r(/*! ./_baseEach */26);e.exports=n},/*!******************************!*\
!*** ./~/lodash/_baseFor.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./_createBaseFor */378),o=n();e.exports=o},/*!*********************************!*\
!*** ./~/lodash/_baseGetTag.js ***!
\*********************************/
function(e,t){function r(e){return o.call(e)}var n=Object.prototype,o=n.toString;e.exports=r},/*!******************************!*\
!*** ./~/lodash/_baseHas.js ***!
\******************************/
function(e,t){function r(e,t){return null!=e&&o.call(e,t)}var n=Object.prototype,o=n.hasOwnProperty;e.exports=r},/*!********************************!*\
!*** ./~/lodash/_baseHasIn.js ***!
\********************************/
function(e,t){function r(e,t){return null!=e&&t in Object(e)}e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_baseInRange.js ***!
\**********************************/
function(e,t){function r(e,t,r){return e>=o(t,r)&&e<n(t,r)}var n=Math.max,o=Math.min;e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_baseIntersection.js ***!
\***************************************/
function(e,t,r){function n(e,t,r){for(var n=r?s:a,p=e[0].length,d=e.length,f=d,y=Array(d),m=1/0,v=[];f--;){var h=e[f];f&&t&&(h=l(h,u(t))),m=c(h.length,m),y[f]=!r&&(t||p>=120&&h.length>=120)?new o(f&&h):void 0}h=e[0];var g=-1,b=y[0];e:for(;++g<p&&v.length<m;){var P=h[g],T=t?t(P):P;if(P=r||0!==P?P:0,!(b?i(b,T):n(v,T,r))){for(f=d;--f;){var O=y[f];if(!(O?i(O,T):n(e[f],T,r)))continue e}b&&b.push(T),v.push(P)}}return v}var o=r(/*! ./_SetCache */49),a=r(/*! ./_arrayIncludes */51),s=r(/*! ./_arrayIncludesWith */103),l=r(/*! ./_arrayMap */18),u=r(/*! ./_baseUnary */111),i=r(/*! ./_cacheHas */112),c=Math.min;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseInvoke.js ***!
\*********************************/
function(e,t,r){function n(e,t,r){s(t,e)||(t=a(t),e=u(e,t),t=l(t));var n=null==e?e:e[i(t)];return null==n?void 0:o(n,e,r)}var o=r(/*! ./_apply */29),a=r(/*! ./_castPath */113),s=r(/*! ./_isKey */33),l=r(/*! ./last */475),u=r(/*! ./_parent */424),i=r(/*! ./_toKey */19);e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_baseIsEqualDeep.js ***!
\**************************************/
function(e,t,r){function n(e,t,r,n,v,g){var b=i(e),P=i(t),T=y,O=y;b||(T=u(e),T=T==f?m:T),P||(O=u(t),O=O==f?m:O);var _=T==m&&!c(e),E=O==m&&!c(t),j=T==O;if(j&&!_)return g||(g=new o),b||p(e)?a(e,t,r,n,v,g):s(e,t,T,r,n,v,g);if(!(v&d)){var w=_&&h.call(e,"__wrapped__"),M=E&&h.call(t,"__wrapped__");if(w||M){var S=w?e.value():e,x=M?t.value():t;return g||(g=new o),r(S,x,n,v,g)}}return!!j&&(g||(g=new o),l(e,t,r,n,v,g))}var o=r(/*! ./_Stack */102),a=r(/*! ./_equalArrays */226),s=r(/*! ./_equalByTag */390),l=r(/*! ./_equalObjects */391),u=r(/*! ./_getTag */118),i=r(/*! ./isArray */4),c=r(/*! ./_isHostObject */60),p=r(/*! ./isTypedArray */250),d=2,f="[object Arguments]",y="[object Array]",m="[object Object]",v=Object.prototype,h=v.hasOwnProperty;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseIsMatch.js ***!
\**********************************/
function(e,t,r){function n(e,t,r,n){var u=r.length,i=u,c=!n;if(null==e)return!i;for(e=Object(e);u--;){var p=r[u];if(c&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++u<i;){p=r[u];var d=p[0],f=e[d],y=p[1];if(c&&p[2]){if(void 0===f&&!(d in e))return!1}else{var m=new o;if(n)var v=n(f,y,d,e,t,m);if(!(void 0===v?a(y,f,n,s|l,m):v))return!1}}return!0}var o=r(/*! ./_Stack */102),a=r(/*! ./_baseIsEqual */108),s=1,l=2;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_baseIsNaN.js ***!
\********************************/
function(e,t){function r(e){return e!==e}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseIsNative.js ***!
\***********************************/
function(e,t,r){function n(e){if(!l(e)||s(e))return!1;var t=o(e)||a(e)?m:c;return t.test(u(e))}var o=r(/*! ./isFunction */24),a=r(/*! ./_isHostObject */60),s=r(/*! ./_isMasked */410),l=r(/*! ./isObject */13),u=r(/*! ./_toSource */240),i=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,p=Function.prototype,d=Object.prototype,f=p.toString,y=d.hasOwnProperty,m=RegExp("^"+f.call(y).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=n},/*!***************************************!*\
!*** ./~/lodash/_baseIsTypedArray.js ***!
\***************************************/
function(e,t,r){function n(e){return a(e)&&o(e.length)&&!!A[k.call(e)]}var o=r(/*! ./isLength */125),a=r(/*! ./isObjectLike */20),s="[object Arguments]",l="[object Array]",u="[object Boolean]",i="[object Date]",c="[object Error]",p="[object Function]",d="[object Map]",f="[object Number]",y="[object Object]",m="[object RegExp]",v="[object Set]",h="[object String]",g="[object WeakMap]",b="[object ArrayBuffer]",P="[object DataView]",T="[object Float32Array]",O="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",j="[object Int32Array]",w="[object Uint8Array]",M="[object Uint8ClampedArray]",S="[object Uint16Array]",x="[object Uint32Array]",A={};A[T]=A[O]=A[_]=A[E]=A[j]=A[w]=A[M]=A[S]=A[x]=!0,A[s]=A[l]=A[b]=A[u]=A[P]=A[i]=A[c]=A[p]=A[d]=A[f]=A[y]=A[m]=A[v]=A[h]=A[g]=!1;var N=Object.prototype,k=N.toString;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseKeysIn.js ***!
\*********************************/
function(e,t,r){function n(e){if(!o(e))return s(e);var t=a(e),r=[];for(var n in e)("constructor"!=n||!t&&u.call(e,n))&&r.push(n);return r}var o=r(/*! ./isObject */13),a=r(/*! ./_isPrototype */34),s=r(/*! ./_nativeKeysIn */422),l=Object.prototype,u=l.hasOwnProperty;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_baseMap.js ***!
\******************************/
function(e,t,r){function n(e,t){var r=-1,n=a(e)?Array(e.length):[];return o(e,function(e,o,a){n[++r]=t(e,o,a)}),n}var o=r(/*! ./_baseEach */26),a=r(/*! ./isArrayLike */15);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_baseMatches.js ***!
\**********************************/
function(e,t,r){function n(e){var t=a(e);return 1==t.length&&t[0][2]?s(t[0][0],t[0][1]):function(r){return r===e||o(r,e,t)}}var o=r(/*! ./_baseIsMatch */349),a=r(/*! ./_getMatchData */394),s=r(/*! ./_matchesStrictComparable */234);e.exports=n},/*!******************************************!*\
!*** ./~/lodash/_baseMatchesProperty.js ***!
\******************************************/
function(e,t,r){function n(e,t){return l(e)&&u(t)?i(c(e),t):function(r){var n=a(r,e);return void 0===n&&n===t?s(r,e):o(t,n,void 0,p|d)}}var o=r(/*! ./_baseIsEqual */108),a=r(/*! ./get */37),s=r(/*! ./hasIn */468),l=r(/*! ./_isKey */33),u=r(/*! ./_isStrictComparable */232),i=r(/*! ./_matchesStrictComparable */234),c=r(/*! ./_toKey */19),p=1,d=2;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_basePickBy.js ***!
\*********************************/
function(e,t){function r(e,t,r){for(var n=-1,o=t.length,a={};++n<o;){var s=t[n],l=e[s];r(l,s)&&(a[s]=l)}return a}e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_baseProperty.js ***!
\***********************************/
function(e,t){function r(e){return function(t){return null==t?void 0:t[e]}}e.exports=r},/*!***************************************!*\
!*** ./~/lodash/_basePropertyDeep.js ***!
\***************************************/
function(e,t,r){function n(e){return function(t){return o(t,e)}}var o=r(/*! ./_baseGet */107);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_basePropertyOf.js ***!
\*************************************/
function(e,t){function r(e){return function(t){return null==e?void 0:e[t]}}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_baseReduce.js ***!
\*********************************/
function(e,t){function r(e,t,r,n,o){return o(e,function(e,o,a){r=n?(n=!1,e):t(r,e,o,a)}),r}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_baseSome.js ***!
\*******************************/
function(e,t,r){function n(e,t){var r;return o(e,function(e,n,o){return r=t(e,n,o),!r}),!!r}var o=r(/*! ./_baseEach */26);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_baseUniq.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=-1,p=a,d=e.length,f=!0,y=[],m=y;if(r)f=!1,p=s;else if(d>=c){var v=t?null:u(e);if(v)return i(v);f=!1,p=l,m=new o}else m=t?[]:y;e:for(;++n<d;){var h=e[n],g=t?t(h):h;if(h=r||0!==h?h:0,f&&g===g){for(var b=m.length;b--;)if(m[b]===g)continue e;t&&m.push(g),y.push(h)}else p(m,g,r)||(m!==y&&m.push(g),y.push(h))}return y}var o=r(/*! ./_SetCache */49),a=r(/*! ./_arrayIncludes */51),s=r(/*! ./_arrayIncludesWith */103),l=r(/*! ./_cacheHas */112),u=r(/*! ./_createSet */387),i=r(/*! ./_setToArray */63),c=200;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_baseValues.js ***!
\*********************************/
function(e,t,r){function n(e,t){return o(t,function(t){return e[t]})}var o=r(/*! ./_arrayMap */18);e.exports=n},/*!******************************************!*\
!*** ./~/lodash/_castArrayLikeObject.js ***!
\******************************************/
function(e,t,r){function n(e){return o(e)?e:[]}var o=r(/*! ./isArrayLikeObject */38);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_cloneBuffer.js ***!
\**********************************/
function(e,t){function r(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}e.exports=r},/*!************************************!*\
!*** ./~/lodash/_cloneDataView.js ***!
\************************************/
function(e,t,r){function n(e,t){var r=t?o(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var o=r(/*! ./_cloneArrayBuffer */114);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/_cloneMap.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=t?r(s(e),!0):s(e);return a(n,o,new e.constructor)}var o=r(/*! ./_addMapEntry */333),a=r(/*! ./_arrayReduce */53),s=r(/*! ./_mapToArray */233);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_cloneRegExp.js ***!
\**********************************/
function(e,t){function r(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}var n=/\w*$/;e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_cloneSet.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=t?r(s(e),!0):s(e);return a(n,o,new e.constructor)}var o=r(/*! ./_addSetEntry */334),a=r(/*! ./_arrayReduce */53),s=r(/*! ./_setToArray */63);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_cloneSymbol.js ***!
\**********************************/
function(e,t,r){function n(e){return s?Object(s.call(e)):{}}var o=r(/*! ./_Symbol */50),a=o?o.prototype:void 0,s=a?a.valueOf:void 0;e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_cloneTypedArray.js ***!
\**************************************/
function(e,t,r){function n(e,t){var r=t?o(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var o=r(/*! ./_cloneArrayBuffer */114);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_copySymbols.js ***!
\**********************************/
function(e,t,r){function n(e,t){return o(e,a(e),t)}var o=r(/*! ./_copyObject */115),a=r(/*! ./_getSymbols */117);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_coreJsData.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./_root */11),o=n["__core-js_shared__"];e.exports=o},/*!***********************************!*\
!*** ./~/lodash/_countHolders.js ***!
\***********************************/
function(e,t){function r(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&n++;return n}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_createAssigner.js ***!
\*************************************/
function(e,t,r){function n(e){return o(function(t,r){var n=-1,o=r.length,s=o>1?r[o-1]:void 0,l=o>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,l&&a(r[0],r[1],l)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var u=r[n];u&&e(t,u,n,s)}return t})}var o=r(/*! ./_baseRest */12),a=r(/*! ./_isIterateeCall */119);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_createBaseEach.js ***!
\*************************************/
function(e,t,r){function n(e,t){return function(r,n){if(null==r)return r;if(!o(r))return e(r,n);for(var a=r.length,s=t?a:-1,l=Object(r);(t?s--:++s<a)&&n(l[s],s,l)!==!1;);return r}}var o=r(/*! ./isArrayLike */15);e.exports=n},/*!************************************!*\
!*** ./~/lodash/_createBaseFor.js ***!
\************************************/
function(e,t){function r(e){return function(t,r,n){for(var o=-1,a=Object(t),s=n(t),l=s.length;l--;){var u=s[e?l:++o];if(r(a[u],u,a)===!1)break}return t}}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_createBind.js ***!
\*********************************/
function(e,t,r){function n(e,t,r){function n(){var t=this&&this!==a&&this instanceof n?u:e;return t.apply(l?r:this,arguments)}var l=t&s,u=o(e);return n}var o=r(/*! ./_createCtor */56),a=r(/*! ./_root */11),s=1;e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_createCaseFirst.js ***!
\**************************************/
function(e,t,r){function n(e){return function(t){t=l(t);var r=a(t)?s(t):void 0,n=r?r[0]:t.charAt(0),u=r?o(r,1).join(""):t.slice(1);return n[e]()+u}}var o=r(/*! ./_castSlice */221),a=r(/*! ./_hasUnicode */230),s=r(/*! ./_stringToArray */434),l=r(/*! ./toString */25);e.exports=n},/*!***************************************!*\
!*** ./~/lodash/_createCompounder.js ***!
\***************************************/
function(e,t,r){function n(e){return function(t){return o(s(a(t).replace(u,"")),e,"")}}var o=r(/*! ./_arrayReduce */53),a=r(/*! ./deburr */444),s=r(/*! ./words */490),l="['’]",u=RegExp(l,"g");e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_createCurry.js ***!
\**********************************/
function(e,t,r){function n(e,t,r){function n(){for(var a=arguments.length,d=Array(a),f=a,y=u(n);f--;)d[f]=arguments[f];var m=a<3&&d[0]!==y&&d[a-1]!==y?[]:i(d,y);if(a-=m.length,a<r)return l(e,t,s,n.placeholder,void 0,d,m,void 0,void 0,r-a);var v=this&&this!==c&&this instanceof n?p:e;return o(v,this,d)}var p=a(e);return n}var o=r(/*! ./_apply */29),a=r(/*! ./_createCtor */56),s=r(/*! ./_createHybrid */224),l=r(/*! ./_createRecurry */225),u=r(/*! ./_getHolder */57),i=r(/*! ./_replaceHolders */35),c=r(/*! ./_root */11);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_createFind.js ***!
\*********************************/
function(e,t,r){function n(e){return function(t,r,n){var l=Object(t);if(!a(t)){var u=o(r,3);t=s(t),r=function(e){return u(l[e],e,l)}}var i=e(t,r,n);return i>-1?l[u?t[i]:i]:void 0}}var o=r(/*! ./_baseIteratee */14),a=r(/*! ./isArrayLike */15),s=r(/*! ./keys */8);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_createFlow.js ***!
\*********************************/
function(e,t,r){function n(e){return s(function(t){t=a(t,1);var r=t.length,n=r,s=o.prototype.thru;for(e&&t.reverse();n--;){var h=t[n];if("function"!=typeof h)throw new TypeError(d);if(s&&!g&&"wrapper"==u(h))var g=new o([],(!0))}for(n=g?n:r;++n<r;){h=t[n];var b=u(h),P="wrapper"==b?l(h):void 0;g=P&&c(P[0])&&P[1]==(m|f|y|v)&&!P[4].length&&1==P[9]?g[u(P[0])].apply(g,P[3]):1==h.length&&c(h)?g[b]():g.thru(h)}return function(){var e=arguments,n=e[0];if(g&&1==e.length&&i(n)&&n.length>=p)return g.plant(n).value();for(var o=0,a=r?t[o].apply(this,e):n;++o<r;)a=t[o].call(this,a);return a}})}var o=r(/*! ./_LodashWrapper */99),a=r(/*! ./_baseFlatten */27),s=r(/*! ./_baseRest */12),l=r(/*! ./_getData */116),u=r(/*! ./_getFuncName */228),i=r(/*! ./isArray */4),c=r(/*! ./_isLaziable */231),p=200,d="Expected a function",f=8,y=32,m=128,v=256;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_createPartial.js ***!
\************************************/
function(e,t,r){function n(e,t,r,n){function u(){for(var t=-1,a=arguments.length,l=-1,p=n.length,d=Array(p+a),f=this&&this!==s&&this instanceof u?c:e;++l<p;)d[l]=n[l];for(;a--;)d[l++]=arguments[++t];return o(f,i?r:this,d)}var i=t&l,c=a(e);return u}var o=r(/*! ./_apply */29),a=r(/*! ./_createCtor */56),s=r(/*! ./_root */11),l=1;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_createRound.js ***!
\**********************************/
function(e,t,r){function n(e){var t=Math[e];return function(e,r){if(e=a(e),r=l(o(r),292)){var n=(s(e)+"e").split("e"),u=t(n[0]+"e"+(+n[1]+r));return n=(s(u)+"e").split("e"),+(n[0]+"e"+(+n[1]-r))}return t(e)}}var o=r(/*! ./toInteger */17),a=r(/*! ./toNumber */68),s=r(/*! ./toString */25),l=Math.min;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_createSet.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./_Set */205),o=r(/*! ./noop */251),a=r(/*! ./_setToArray */63),s=1/0,l=n&&1/a(new n([,-0]))[1]==s?function(e){return new n(e)}:o;e.exports=l},/*!***********************************!*\
!*** ./~/lodash/_deburrLetter.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_basePropertyOf */360),o={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},a=n(o);e.exports=a},/*!*************************************!*\
!*** ./~/lodash/_defineProperty.js ***!
\*************************************/
function(e,t,r){var n=r(/*! ./_getNative */21),o=function(){var e=n(Object,"defineProperty"),t=n.name;return t&&t.length>2?e:void 0}();e.exports=o},/*!*********************************!*\
!*** ./~/lodash/_equalByTag.js ***!
\*********************************/
function(e,t,r){function n(e,t,r,n,o,_,j){switch(r){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T:return!(e.byteLength!=t.byteLength||!n(new a(e),new a(t)));case d:case f:case v:return s(+e,+t);case y:return e.name==t.name&&e.message==t.message;case h:case b:return e==t+"";case m:var w=u;case g:var M=_&p;if(w||(w=i),e.size!=t.size&&!M)return!1;var S=j.get(e);if(S)return S==t;_|=c,j.set(e,t);var x=l(w(e),w(t),n,o,_,j);return j["delete"](e),x;case P:if(E)return E.call(e)==E.call(t)}return!1}var o=r(/*! ./_Symbol */50),a=r(/*! ./_Uint8Array */206),s=r(/*! ./eq */36),l=r(/*! ./_equalArrays */226),u=r(/*! ./_mapToArray */233),i=r(/*! ./_setToArray */63),c=1,p=2,d="[object Boolean]",f="[object Date]",y="[object Error]",m="[object Map]",v="[object Number]",h="[object RegExp]",g="[object Set]",b="[object String]",P="[object Symbol]",T="[object ArrayBuffer]",O="[object DataView]",_=o?o.prototype:void 0,E=_?_.valueOf:void 0;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_equalObjects.js ***!
\***********************************/
function(e,t,r){function n(e,t,r,n,s,u){var i=s&a,c=o(e),p=c.length,d=o(t),f=d.length;if(p!=f&&!i)return!1;for(var y=p;y--;){var m=c[y];if(!(i?m in t:l.call(t,m)))return!1}var v=u.get(e);if(v&&u.get(t))return v==t;var h=!0;u.set(e,t),u.set(t,e);for(var g=i;++y<p;){m=c[y];var b=e[m],P=t[m];if(n)var T=i?n(P,b,m,t,e,u):n(b,P,m,e,t,u);if(!(void 0===T?b===P||r(b,P,n,s,u):T)){h=!1;break}g||(g="constructor"==m)}if(h&&!g){var O=e.constructor,_=t.constructor;O!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof O&&O instanceof O&&"function"==typeof _&&_ instanceof _)&&(h=!1)}return u["delete"](e),u["delete"](t),h}var o=r(/*! ./keys */8),a=2,s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_getAllKeys.js ***!
\*********************************/
function(e,t,r){function n(e){return o(e,s,a)}var o=r(/*! ./_baseGetAllKeys */214),a=r(/*! ./_getSymbols */117),s=r(/*! ./keys */8);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getAllKeysIn.js ***!
\***********************************/
function(e,t,r){function n(e){return o(e,s,a)}var o=r(/*! ./_baseGetAllKeys */214),a=r(/*! ./_getSymbolsIn */395),s=r(/*! ./keysIn */474);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getMatchData.js ***!
\***********************************/
function(e,t,r){function n(e){for(var t=a(e),r=t.length;r--;){var n=t[r],s=e[n];t[r]=[n,s,o(s)]}return t}var o=r(/*! ./_isStrictComparable */232),a=r(/*! ./keys */8);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_getSymbolsIn.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./_arrayPush */52),o=r(/*! ./_getPrototype */59),a=r(/*! ./_getSymbols */117),s=r(/*! ./stubArray */254),l=Object.getOwnPropertySymbols,u=l?function(e){for(var t=[];e;)n(t,a(e)),e=o(e);return t}:s;e.exports=u},/*!*******************************!*\
!*** ./~/lodash/_getValue.js ***!
\*******************************/
function(e,t){function r(e,t){return null==e?void 0:e[t]}e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_getWrapDetails.js ***!
\*************************************/
function(e,t){function r(e){var t=e.match(n);return t?t[1].split(o):[]}var n=/\{\n\/\* \[wrapped with (.+)\] \*/,o=/,? & /;e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_hasUnicodeWord.js ***!
\*************************************/
function(e,t){function r(e){return n.test(e)}var n=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=r},/*!********************************!*\
!*** ./~/lodash/_hashClear.js ***!
\********************************/
function(e,t,r){function n(){this.__data__=o?o(null):{}}var o=r(/*! ./_nativeCreate */62);e.exports=n},/*!*********************************!*\
!*** ./~/lodash/_hashDelete.js ***!
\*********************************/
function(e,t){function r(e){return this.has(e)&&delete this.__data__[e]}e.exports=r},/*!******************************!*\
!*** ./~/lodash/_hashGet.js ***!
\******************************/
function(e,t,r){function n(e){var t=this.__data__;if(o){var r=t[e];return r===a?void 0:r}return l.call(t,e)?t[e]:void 0}var o=r(/*! ./_nativeCreate */62),a="__lodash_hash_undefined__",s=Object.prototype,l=s.hasOwnProperty;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_hashHas.js ***!
\******************************/
function(e,t,r){function n(e){var t=this.__data__;return o?void 0!==t[e]:s.call(t,e)}var o=r(/*! ./_nativeCreate */62),a=Object.prototype,s=a.hasOwnProperty;e.exports=n},/*!******************************!*\
!*** ./~/lodash/_hashSet.js ***!
\******************************/
function(e,t,r){function n(e,t){var r=this.__data__;return r[e]=o&&void 0===t?a:t,this}var o=r(/*! ./_nativeCreate */62),a="__lodash_hash_undefined__";e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_initCloneArray.js ***!
\*************************************/
function(e,t){function r(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&o.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var n=Object.prototype,o=n.hasOwnProperty;e.exports=r},/*!*************************************!*\
!*** ./~/lodash/_initCloneByTag.js ***!
\*************************************/
function(e,t,r){function n(e,t,r,n){var A=e.constructor;switch(t){case b:return o(e);case p:case d:return new A((+e));case P:return a(e,n);case T:case O:case _:case E:case j:case w:case M:case S:case x:return c(e,n);case f:return s(e,n,r);case y:case h:return new A(e);case m:return l(e);case v:return u(e,n,r);case g:return i(e)}}var o=r(/*! ./_cloneArrayBuffer */114),a=r(/*! ./_cloneDataView */367),s=r(/*! ./_cloneMap */368),l=r(/*! ./_cloneRegExp */369),u=r(/*! ./_cloneSet */370),i=r(/*! ./_cloneSymbol */371),c=r(/*! ./_cloneTypedArray */372),p="[object Boolean]",d="[object Date]",f="[object Map]",y="[object Number]",m="[object RegExp]",v="[object Set]",h="[object String]",g="[object Symbol]",b="[object ArrayBuffer]",P="[object DataView]",T="[object Float32Array]",O="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",j="[object Int32Array]",w="[object Uint8Array]",M="[object Uint8ClampedArray]",S="[object Uint16Array]",x="[object Uint32Array]";e.exports=n},/*!**************************************!*\
!*** ./~/lodash/_initCloneObject.js ***!
\**************************************/
function(e,t,r){function n(e){return"function"!=typeof e.constructor||s(e)?{}:o(a(e))}var o=r(/*! ./_baseCreate */31),a=r(/*! ./_getPrototype */59),s=r(/*! ./_isPrototype */34);e.exports=n},/*!****************************************!*\
!*** ./~/lodash/_insertWrapDetails.js ***!
\****************************************/
function(e,t){function r(e,t){var r=t.length,o=r-1;return t[o]=(r>1?"& ":"")+t[o],t=t.join(r>2?", ":" "),e.replace(n,"{\n/* [wrapped with "+t+"] */\n")}var n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=r},/*!************************************!*\
!*** ./~/lodash/_isFlattenable.js ***!
\************************************/
function(e,t,r){function n(e){return s(e)||a(e)||!!(l&&e&&e[l])}var o=r(/*! ./_Symbol */50),a=r(/*! ./isArguments */66),s=r(/*! ./isArray */4),l=o?o.isConcatSpreadable:void 0;e.exports=n},/*!********************************!*\
!*** ./~/lodash/_isKeyable.js ***!
\********************************/
function(e,t){function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_isMasked.js ***!
\*******************************/
function(e,t,r){function n(e){return!!a&&a in e}var o=r(/*! ./_coreJsData */374),a=function(){var e=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_listCacheClear.js ***!
\*************************************/
function(e,t){function r(){this.__data__=[]}e.exports=r},/*!**************************************!*\
!*** ./~/lodash/_listCacheDelete.js ***!
\**************************************/
function(e,t,r){function n(e){var t=this.__data__,r=o(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():s.call(t,r,1),!0}var o=r(/*! ./_assocIndexOf */54),a=Array.prototype,s=a.splice;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_listCacheGet.js ***!
\***********************************/
function(e,t,r){function n(e){var t=this.__data__,r=o(t,e);return r<0?void 0:t[r][1]}var o=r(/*! ./_assocIndexOf */54);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_listCacheHas.js ***!
\***********************************/
function(e,t,r){function n(e){return o(this.__data__,e)>-1}var o=r(/*! ./_assocIndexOf */54);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_listCacheSet.js ***!
\***********************************/
function(e,t,r){function n(e,t){var r=this.__data__,n=o(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}var o=r(/*! ./_assocIndexOf */54);e.exports=n},/*!************************************!*\
!*** ./~/lodash/_mapCacheClear.js ***!
\************************************/
function(e,t,r){function n(){this.__data__={hash:new o,map:new(s||a),string:new o}}var o=r(/*! ./_Hash */331),a=r(/*! ./_ListCache */48),s=r(/*! ./_Map */100);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_mapCacheDelete.js ***!
\*************************************/
function(e,t,r){function n(e){return o(this,e)["delete"](e)}var o=r(/*! ./_getMapData */58);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_mapCacheGet.js ***!
\**********************************/
function(e,t,r){function n(e){return o(this,e).get(e)}var o=r(/*! ./_getMapData */58);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_mapCacheHas.js ***!
\**********************************/
function(e,t,r){function n(e){return o(this,e).has(e)}var o=r(/*! ./_getMapData */58);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_mapCacheSet.js ***!
\**********************************/
function(e,t,r){function n(e,t){return o(this,e).set(e,t),this}var o=r(/*! ./_getMapData */58);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_mergeData.js ***!
\********************************/
function(e,t,r){function n(e,t){var r=e[1],n=t[1],m=r|n,v=m<(u|i|d),h=n==d&&r==p||n==d&&r==f&&e[7].length<=t[8]||n==(d|f)&&t[7].length<=t[8]&&r==p;if(!v&&!h)return e;n&u&&(e[2]=t[2],m|=r&u?0:c);var g=t[3];if(g){var b=e[3];e[3]=b?o(b,g,t[4]):g,e[4]=b?s(e[3],l):t[4]}return g=t[5],g&&(b=e[5],e[5]=b?a(b,g,t[6]):g,e[6]=b?s(e[5],l):t[6]),g=t[7],g&&(e[7]=g),n&d&&(e[8]=null==e[8]?t[8]:y(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=m,e}var o=r(/*! ./_composeArgs */222),a=r(/*! ./_composeArgsRight */223),s=r(/*! ./_replaceHolders */35),l="__lodash_placeholder__",u=1,i=2,c=4,p=8,d=128,f=256,y=Math.min;e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_nativeKeysIn.js ***!
\***********************************/
function(e,t){function r(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_nodeUtil.js ***!
\*******************************/
function(e,t,r){(function(e){var n=r(/*! ./_freeGlobal */227),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o,l=s&&n.process,u=function(){try{return l&&l.binding("util")}catch(e){}}();e.exports=u}).call(t,r(/*! ./../webpack/buildin/module.js */259)(e))},/*!*****************************!*\
!*** ./~/lodash/_parent.js ***!
\*****************************/
function(e,t,r){function n(e,t){return 1==t.length?e:o(e,a(t,0,-1))}var o=r(/*! ./_baseGet */107),a=r(/*! ./_baseSlice */110);e.exports=n},/*!********************************!*\
!*** ./~/lodash/_realNames.js ***!
\********************************/
function(e,t){var r={};e.exports=r},/*!******************************!*\
!*** ./~/lodash/_reorder.js ***!
\******************************/
function(e,t,r){function n(e,t){for(var r=e.length,n=s(t.length,r),l=o(e);n--;){var u=t[n];e[n]=a(u,r)?l[u]:void 0}return e}var o=r(/*! ./_copyArray */55),a=r(/*! ./_isIndex */61),s=Math.min;e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_setCacheAdd.js ***!
\**********************************/
function(e,t){function r(e){return this.__data__.set(e,n),this}var n="__lodash_hash_undefined__";e.exports=r},/*!**********************************!*\
!*** ./~/lodash/_setCacheHas.js ***!
\**********************************/
function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/_stackClear.js ***!
\*********************************/
function(e,t,r){function n(){this.__data__=new o}var o=r(/*! ./_ListCache */48);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/_stackDelete.js ***!
\**********************************/
function(e,t){function r(e){return this.__data__["delete"](e)}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_stackGet.js ***!
\*******************************/
function(e,t){function r(e){return this.__data__.get(e)}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_stackHas.js ***!
\*******************************/
function(e,t){function r(e){return this.__data__.has(e)}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/_stackSet.js ***!
\*******************************/
function(e,t,r){function n(e,t){var r=this.__data__;if(r instanceof o){var n=r.__data__;if(!a||n.length<l-1)return n.push([e,t]),this;r=this.__data__=new s(n)}return r.set(e,t),this}var o=r(/*! ./_ListCache */48),a=r(/*! ./_Map */100),s=r(/*! ./_MapCache */101),l=200;e.exports=n},/*!************************************!*\
!*** ./~/lodash/_stringToArray.js ***!
\************************************/
function(e,t,r){function n(e){return a(e)?s(e):o(e)}var o=r(/*! ./_asciiToArray */337),a=r(/*! ./_hasUnicode */230),s=r(/*! ./_unicodeToArray */435);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/_unicodeToArray.js ***!
\*************************************/
function(e,t){function r(e){return e.match(P)||[]}var n="\\ud800-\\udfff",o="\\u0300-\\u036f\\ufe20-\\ufe23",a="\\u20d0-\\u20f0",s="\\ufe0e\\ufe0f",l="["+n+"]",u="["+o+a+"]",i="\\ud83c[\\udffb-\\udfff]",c="(?:"+u+"|"+i+")",p="[^"+n+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",m=c+"?",v="["+s+"]?",h="(?:"+y+"(?:"+[p,d,f].join("|")+")"+v+m+")*",g=v+m+h,b="(?:"+[p+u+"?",u,d,f,l].join("|")+")",P=RegExp(i+"(?="+i+")|"+b+g,"g");e.exports=r},/*!***********************************!*\
!*** ./~/lodash/_unicodeWords.js ***!
\***********************************/
function(e,t){function r(e){return e.match(D)||[]}var n="\\ud800-\\udfff",o="\\u0300-\\u036f\\ufe20-\\ufe23",a="\\u20d0-\\u20f0",s="\\u2700-\\u27bf",l="a-z\\xdf-\\xf6\\xf8-\\xff",u="\\xac\\xb1\\xd7\\xf7",i="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",c="\\u2000-\\u206f",p=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",d="A-Z\\xc0-\\xd6\\xd8-\\xde",f="\\ufe0e\\ufe0f",y=u+i+c+p,m="['’]",v="["+y+"]",h="["+o+a+"]",g="\\d+",b="["+s+"]",P="["+l+"]",T="[^"+n+y+g+s+l+d+"]",O="\\ud83c[\\udffb-\\udfff]",_="(?:"+h+"|"+O+")",E="[^"+n+"]",j="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",M="["+d+"]",S="\\u200d",x="(?:"+P+"|"+T+")",A="(?:"+M+"|"+T+")",N="(?:"+m+"(?:d|ll|m|re|s|t|ve))?",k="(?:"+m+"(?:D|LL|M|RE|S|T|VE))?",C=_+"?",I="["+f+"]?",K="(?:"+S+"(?:"+[E,j,w].join("|")+")"+I+C+")*",L=I+C+K,U="(?:"+[b,j,w].join("|")+")"+L,D=RegExp([M+"?"+P+"+"+N+"(?="+[v,M,"$"].join("|")+")",A+"+"+k+"(?="+[v,M+x,"$"].join("|")+")",M+"?"+x+"+"+N,M+"+"+k,g,U].join("|"),"g");e.exports=r},/*!****************************************!*\
!*** ./~/lodash/_updateWrapDetails.js ***!
\****************************************/
function(e,t,r){function n(e,t){return o(m,function(r){var n="_."+r[0];t&r[1]&&!a(e,n)&&e.push(n)}),e.sort()}var o=r(/*! ./_arrayEach */30),a=r(/*! ./_arrayIncludes */51),s=1,l=2,u=8,i=16,c=32,p=64,d=128,f=256,y=512,m=[["ary",d],["bind",s],["bindKey",l],["curry",u],["curryRight",i],["flip",y],["partial",c],["partialRight",p],["rearg",f]];e.exports=n},/*!***********************************!*\
!*** ./~/lodash/_wrapperClone.js ***!
\***********************************/
function(e,t,r){function n(e){if(e instanceof o)return e.clone();var t=new a(e.__wrapped__,e.__chain__);return t.__actions__=s(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var o=r(/*! ./_LazyWrapper */98),a=r(/*! ./_LodashWrapper */99),s=r(/*! ./_copyArray */55);e.exports=n},/*!*************************!*\
!*** ./~/lodash/ary.js ***!
\*************************/
function(e,t,r){function n(e,t,r){return t=r?void 0:t,t=e&&null==t?e.length:t,o(e,a,void 0,void 0,void 0,void 0,t)}var o=r(/*! ./_createWrap */32),a=128;e.exports=n},/*!****************************!*\
!*** ./~/lodash/assign.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./_assignValue */104),o=r(/*! ./_copyObject */115),a=r(/*! ./_createAssigner */376),s=r(/*! ./isArrayLike */15),l=r(/*! ./_isPrototype */34),u=r(/*! ./keys */8),i=Object.prototype,c=i.hasOwnProperty,p=i.propertyIsEnumerable,d=!p.call({valueOf:1},"valueOf"),f=a(function(e,t){if(d||l(t)||s(t))return void o(t,u(t),e);for(var r in t)c.call(t,r)&&n(e,r,t[r])});e.exports=f},/*!***************************!*\
!*** ./~/lodash/clamp.js ***!
\***************************/
function(e,t,r){function n(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=a(r),r=r===r?r:0),void 0!==t&&(t=a(t),t=t===t?t:0),o(a(e),t,r)}var o=r(/*! ./_baseClamp */211),a=r(/*! ./toNumber */68);e.exports=n},/*!***************************!*\
!*** ./~/lodash/clone.js ***!
\***************************/
function(e,t,r){function n(e){return o(e,!1,!0)}var o=r(/*! ./_baseClone */212);e.exports=n},/*!******************************!*\
!*** ./~/lodash/constant.js ***!
\******************************/
function(e,t){function r(e){return function(){return e}}e.exports=r},/*!****************************!*\
!*** ./~/lodash/deburr.js ***!
\****************************/
function(e,t,r){function n(e){return e=a(e),e&&e.replace(s,o).replace(c,"")}var o=r(/*! ./_deburrLetter */388),a=r(/*! ./toString */25),s=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,l="\\u0300-\\u036f\\ufe20-\\ufe23",u="\\u20d0-\\u20f0",i="["+l+u+"]",c=RegExp(i,"g");e.exports=n},/*!********************************!*\
!*** ./~/lodash/difference.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./_baseDifference */105),o=r(/*! ./_baseFlatten */27),a=r(/*! ./_baseRest */12),s=r(/*! ./isArrayLikeObject */38),l=a(function(e,t){return s(e)?n(e,o(t,1,s,!0)):[]});e.exports=l},/*!*******************************!*\
!*** ./~/lodash/dropRight.js ***!
\*******************************/
function(e,t,r){function n(e,t,r){var n=e?e.length:0;return n?(t=r||void 0===t?1:a(t),t=n-t,o(e,0,t<0?0:t)):[]}var o=r(/*! ./_baseSlice */110),a=r(/*! ./toInteger */17);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/escapeRegExp.js ***!
\**********************************/
function(e,t,r){function n(e){return e=o(e),e&&s.test(e)?e.replace(a,"\\$&"):e}var o=r(/*! ./toString */25),a=/[\\^$.*+?()[\]{}|]/g,s=RegExp(a.source);e.exports=n},/*!**************************!*\
!*** ./~/lodash/flow.js ***!
\**************************/
function(e,t,r){var n=r(/*! ./_createFlow */384),o=n();e.exports=o},/*!*****************************!*\
!*** ./~/lodash/forEach.js ***!
\*****************************/
function(e,t,r){function n(e,t){var r=l(e)?o:a;return r(e,s(t,3))}var o=r(/*! ./_arrayEach */30),a=r(/*! ./_baseEach */26),s=r(/*! ./_baseIteratee */14),l=r(/*! ./isArray */4);e.exports=n},/*!*************************************!*\
!*** ./~/lodash/fp/_baseConvert.js ***!
\*************************************/
function(e,t,r){function n(e,t){return 2==t?function(t,r){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}}function o(e,t){return 2==t?function(t,r){return e(t,r)}:function(t){return e(t)}}function a(e){for(var t=e?e.length:0,r=Array(t);t--;)r[t]=e[t];return r}function s(e){return function(t){return e({},t)}}function l(e,t){return function(){var r=arguments.length;if(r){for(var n=Array(r);r--;)n[r]=arguments[r];var o=n[0]=t.apply(void 0,n);return e.apply(void 0,n),o}}}function u(e,t,r,d){function f(e,t){if(M.cap){var r=i.iterateeRearg[e];if(r)return T(t,r);var n=!j&&i.iterateeAry[e];if(n)return P(t,n)}return t}function y(e,t,r){return S||M.curry&&r>1?U(t,r):t}function m(e,t,r){if(M.fixed&&(x||!i.skipFixed[e])){var n=i.methodSpread[e],o=n&&n.start;return void 0===o?I(t,r):V(t,o)}return t}function v(e,t,r){return M.rearg&&r>1&&(A||!i.skipRearg[e])?F(t,i.methodRearg[e]||i.aryRearg[r]):t}function h(e,t){t=Y(t);for(var r=-1,n=t.length,o=n-1,a=L(Object(e)),s=a;null!=s&&++r<n;){var l=t[r],u=s[l];null!=u&&(s[t[r]]=L(r==o?u:Object(u))),s=s[l]}return a}function g(e){return G.runInContext.convert(e)(void 0)}function b(e,t){var r=d;return function(n){var o=j?k:C,a=j?k[e]:t,s=K(K({},r),n);return u(o,e,a,s)}}function P(e,t){return O(e,function(e){return"function"==typeof e?o(e,t):e})}function T(e,t){return O(e,function(e){var r=t.length;return n(F(o(e,r),t),r)})}function O(e,t){return function(){var r=arguments.length;if(!r)return e();for(var n=Array(r);r--;)n[r]=arguments[r];var o=M.rearg?0:r-1;return n[o]=t(n[o]),e.apply(void 0,n)}}function _(e,t){e=i.aliasToReal[e]||e;var r,n=t,o=H[e];return o?n=o(t):M.immutable&&(c.array[e]?n=l(t,a):c.object[e]?n=l(t,s(t)):c.set[e]&&(n=l(t,h))),D(q,function(t){return D(i.aryMethod[t],function(o){if(e==o){var a=i.methodSpread[e],s=a&&a.afterRearg;return r=s?m(e,v(e,n,t),t):v(e,m(e,n,t),t),r=f(e,r),r=y(e,r,t),!1}}),!r}),r||(r=n),r==t&&(r=S?U(r,1):function(){return t.apply(this,arguments)}),r.convert=b(e,t),i.placeholder[e]&&(E=!0,r.placeholder=t.placeholder=N),r}var E,j="function"==typeof t,w=t===Object(t);if(w&&(d=r,r=t,t=void 0),null==r)throw new TypeError;d||(d={});var M={cap:!("cap"in d)||d.cap,curry:!("curry"in d)||d.curry,fixed:!("fixed"in d)||d.fixed,immutable:!("immutable"in d)||d.immutable,rearg:!("rearg"in d)||d.rearg},S="curry"in d&&d.curry,x="fixed"in d&&d.fixed,A="rearg"in d&&d.rearg,N=j?r:p,k=j?r.runInContext():void 0,C=j?r:{ary:e.ary,assign:e.assign,clone:e.clone,curry:e.curry,forEach:e.forEach,isArray:e.isArray,isFunction:e.isFunction,iteratee:e.iteratee,keys:e.keys,rearg:e.rearg,spread:e.spread,toInteger:e.toInteger,toPath:e.toPath},I=C.ary,K=C.assign,L=C.clone,U=C.curry,D=C.forEach,R=C.isArray,z=C.isFunction,W=C.keys,F=C.rearg,V=C.spread,B=C.toInteger,Y=C.toPath,q=W(i.aryMethod),H={castArray:function(e){return function(){var t=arguments[0];return R(t)?e(a(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[0],r=arguments[1],n=e(t,r),a=n.length;return M.cap&&"number"==typeof r?(r=r>2?r-2:1,a&&a<=r?n:o(n,r)):n}},mixin:function(e){return function(t){var r=this;if(!z(r))return e(r,Object(t));var n=[];return D(W(t),function(e){z(t[e])&&n.push([e,r.prototype[e]])}),e(r,Object(t)),D(n,function(e){var t=e[1];z(t)?r.prototype[e[0]]=t:delete r.prototype[e[0]]}),r}},nthArg:function(e){return function(t){var r=t<0?1:B(t)+1;return U(e(t),r)}},rearg:function(e){return function(t,r){var n=r?r.length:0;return U(e(t,r),n)}},runInContext:function(t){return function(r){return u(e,t(r),d)}}};if(!w)return _(t,r);var G=r,Z=[];return D(q,function(e){D(i.aryMethod[e],function(e){var t=G[i.remap[e]||e];t&&Z.push([e,_(e,t)])})}),D(W(G),function(e){var t=G[e];if("function"==typeof t){for(var r=Z.length;r--;)if(Z[r][0]==e)return;t.convert=b(e,t),Z.push([e,t])}}),D(Z,function(e){G[e[0]]=e[1]}),G.convert=g,E&&(G.placeholder=N),D(W(G),function(e){D(i.realToAlias[e]||[],function(t){G[t]=G[e]})}),G}var i=r(/*! ./_mapping */451),c=i.mutate,p=r(/*! ./placeholder */5);e.exports=u},/*!*********************************!*\
!*** ./~/lodash/fp/_mapping.js ***!
\*********************************/
function(e,t){t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},t.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},t.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={mapKeys:[1]},t.methodRearg={assignInAllWith:[1,2,0],assignInWith:[1,2,0],assignAllWith:[1,2,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,2,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},t.methodSpread={assignAll:{start:0},assignAllWith:{afterRearg:!0,start:1},assignInAll:{start:0},assignInAllWith:{afterRearg:!0,start:1},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{afterRearg:!0,start:1},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},t.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,r=t.aliasToReal,n={};for(var o in r){var a=r[o];e.call(n,a)?n[a].push(o):n[a]=[o]}return n}(),t.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},t.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},t.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},/*!******************************!*\
!*** ./~/lodash/fp/_util.js ***!
\******************************/
function(e,t,r){e.exports={ary:r(/*! ../ary */439),assign:r(/*! ../_baseAssign */210),clone:r(/*! ../clone */442),curry:r(/*! ../curry */242),forEach:r(/*! ../_arrayEach */30),isArray:r(/*! ../isArray */4),isFunction:r(/*! ../isFunction */24),iteratee:r(/*! ../iteratee */473),keys:r(/*! ../_baseKeys */216),rearg:r(/*! ../rearg */482),spread:r(/*! ../spread */484),toInteger:r(/*! ../toInteger */17),toPath:r(/*! ../toPath */488)}},/*!********************************!*\
!*** ./~/lodash/fp/compact.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("compact",r(/*! ../compact */241),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!******************************!*\
!*** ./~/lodash/fp/curry.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("curry",r(/*! ../curry */242));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***************************!*\
!*** ./~/lodash/fp/eq.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("eq",r(/*! ../eq */36));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/get.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("get",r(/*! ../get */37));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/has.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("has",r(/*! ../has */23));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*********************************!*\
!*** ./~/lodash/fp/includes.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("includes",r(/*! ../includes */65));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***********************************!*\
!*** ./~/lodash/fp/isFunction.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("isFunction",r(/*! ../isFunction */24),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!******************************!*\
!*** ./~/lodash/fp/isNil.js ***!
\******************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("isNil",r(/*! ../isNil */471),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*********************************!*\
!*** ./~/lodash/fp/isObject.js ***!
\*********************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("isObject",r(/*! ../isObject */13),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!**************************************!*\
!*** ./~/lodash/fp/isPlainObject.js ***!
\**************************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("isPlainObject",r(/*! ../isPlainObject */126),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*****************************!*\
!*** ./~/lodash/fp/keys.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("keys",r(/*! ../keys */8),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!****************************!*\
!*** ./~/lodash/fp/map.js ***!
\****************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("map",r(/*! ../map */9));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*****************************!*\
!*** ./~/lodash/fp/pick.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("pick",r(/*! ../pick */41));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***********************************!*\
!*** ./~/lodash/fp/startsWith.js ***!
\***********************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("startsWith",r(/*! ../startsWith */486));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!*******************************!*\
!*** ./~/lodash/fp/values.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./convert */7),o=n("values",r(/*! ../values */127),r(/*! ./_falseOptions */22));o.placeholder=r(/*! ./placeholder */5),e.exports=o},/*!***************************!*\
!*** ./~/lodash/hasIn.js ***!
\***************************/
function(e,t,r){function n(e,t){return null!=e&&a(e,t,o)}var o=r(/*! ./_baseHasIn */344),a=r(/*! ./_hasPath */229);e.exports=n},/*!*****************************!*\
!*** ./~/lodash/inRange.js ***!
\*****************************/
function(e,t,r){function n(e,t,r){return t=a(t),void 0===r?(r=t,t=0):r=a(r),e=s(e),o(e,t,r)}var o=r(/*! ./_baseInRange */345),a=r(/*! ./toFinite */256),s=r(/*! ./toNumber */68);e.exports=n},/*!**********************************!*\
!*** ./~/lodash/intersection.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_arrayMap */18),o=r(/*! ./_baseIntersection */346),a=r(/*! ./_baseRest */12),s=r(/*! ./_castArrayLikeObject */365),l=a(function(e){var t=n(e,s);return t.length&&t[0]===e[0]?o(t):[]});e.exports=l},/*!***************************!*\
!*** ./~/lodash/isNil.js ***!
\***************************/
function(e,t){function r(e){return null==e}e.exports=r},/*!*********************************!*\
!*** ./~/lodash/isUndefined.js ***!
\*********************************/
function(e,t){function r(e){return void 0===e}e.exports=r},/*!******************************!*\
!*** ./~/lodash/iteratee.js ***!
\******************************/
function(e,t,r){function n(e){return a("function"==typeof e?e:o(e,!0))}var o=r(/*! ./_baseClone */212),a=r(/*! ./_baseIteratee */14);e.exports=n},/*!****************************!*\
!*** ./~/lodash/keysIn.js ***!
\****************************/
function(e,t,r){function n(e){return s(e)?o(e,!0):a(e)}var o=r(/*! ./_arrayLikeKeys */208),a=r(/*! ./_baseKeysIn */353),s=r(/*! ./isArrayLike */15);e.exports=n},/*!**************************!*\
!*** ./~/lodash/last.js ***!
\**************************/
function(e,t){function r(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=r},/*!*******************************!*\
!*** ./~/lodash/mapValues.js ***!
\*******************************/
function(e,t,r){function n(e,t){var r={};return t=a(t,3),o(e,function(e,n,o){r[n]=t(e,n,o)}),r}var o=r(/*! ./_baseForOwn */106),a=r(/*! ./_baseIteratee */14);e.exports=n},/*!*****************************!*\
!*** ./~/lodash/memoize.js ***!
\*****************************/
function(e,t,r){function n(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(a);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return r.cache=a.set(o,s),s};return r.cache=new(n.Cache||o),r}var o=r(/*! ./_MapCache */101),a="Expected a function";n.Cache=o,e.exports=n},/*!*************************!*\
!*** ./~/lodash/now.js ***!
\*************************/
function(e,t,r){var n=r(/*! ./_root */11),o=function(){return n.Date.now()};e.exports=o},/*!*****************************!*\
!*** ./~/lodash/partial.js ***!
\*****************************/
function(e,t,r){var n=r(/*! ./_baseRest */12),o=r(/*! ./_createWrap */32),a=r(/*! ./_getHolder */57),s=r(/*! ./_replaceHolders */35),l=32,u=n(function(e,t){var r=s(t,a(u));return o(e,l,void 0,t,r)});u.placeholder={},e.exports=u},/*!**********************************!*\
!*** ./~/lodash/partialRight.js ***!
\**********************************/
function(e,t,r){var n=r(/*! ./_baseRest */12),o=r(/*! ./_createWrap */32),a=r(/*! ./_getHolder */57),s=r(/*! ./_replaceHolders */35),l=64,u=n(function(e,t){var r=s(t,a(u));return o(e,l,void 0,t,r)});u.placeholder={},e.exports=u},/*!******************************!*\
!*** ./~/lodash/property.js ***!
\******************************/
function(e,t,r){function n(e){return s(e)?o(l(e)):a(e)}var o=r(/*! ./_baseProperty */358),a=r(/*! ./_basePropertyDeep */359),s=r(/*! ./_isKey */33),l=r(/*! ./_toKey */19);e.exports=n},/*!***************************!*\
!*** ./~/lodash/rearg.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_baseFlatten */27),o=r(/*! ./_baseRest */12),a=r(/*! ./_createWrap */32),s=256,l=o(function(e,t){return a(e,s,void 0,void 0,void 0,n(t,1))});e.exports=l},/*!***************************!*\
!*** ./~/lodash/round.js ***!
\***************************/
function(e,t,r){var n=r(/*! ./_createRound */386),o=n("round");e.exports=o},/*!****************************!*\
!*** ./~/lodash/spread.js ***!
\****************************/
function(e,t,r){function n(e,t){if("function"!=typeof e)throw new TypeError(i);return t=void 0===t?0:c(u(t),0),s(function(r){var n=r[t],s=l(r,0,t);return n&&a(s,n),o(e,this,s)})}var o=r(/*! ./_apply */29),a=r(/*! ./_arrayPush */52),s=r(/*! ./_baseRest */12),l=r(/*! ./_castSlice */221),u=r(/*! ./toInteger */17),i="Expected a function",c=Math.max;e.exports=n},/*!*******************************!*\
!*** ./~/lodash/startCase.js ***!
\*******************************/
function(e,t,r){var n=r(/*! ./_createCompounder */381),o=r(/*! ./upperFirst */489),a=n(function(e,t,r){return e+(r?" ":"")+o(t)});e.exports=a},/*!********************************!*\
!*** ./~/lodash/startsWith.js ***!
\********************************/
function(e,t,r){function n(e,t,r){return e=l(e),r=o(s(r),0,e.length),t=a(t),e.slice(r,r+t.length)==t}var o=r(/*! ./_baseClamp */211),a=r(/*! ./_baseToString */220),s=r(/*! ./toInteger */17),l=r(/*! ./toString */25);e.exports=n},/*!*******************************!*\
!*** ./~/lodash/stubFalse.js ***!
\*******************************/
function(e,t){function r(){return!1}e.exports=r},/*!****************************!*\
!*** ./~/lodash/toPath.js ***!
\****************************/
function(e,t,r){function n(e){return s(e)?o(e,i):l(e)?[e]:a(u(e))}var o=r(/*! ./_arrayMap */18),a=r(/*! ./_copyArray */55),s=r(/*! ./isArray */4),l=r(/*! ./isSymbol */39),u=r(/*! ./_stringToPath */239),i=r(/*! ./_toKey */19);e.exports=n},/*!********************************!*\
!*** ./~/lodash/upperFirst.js ***!
\********************************/
function(e,t,r){var n=r(/*! ./_createCaseFirst */380),o=n("toUpperCase");e.exports=o},/*!***************************!*\
!*** ./~/lodash/words.js ***!
\***************************/
function(e,t,r){function n(e,t,r){return e=s(e),t=r?void 0:t,void 0===t?a(e)?l(e):o(e):e.match(t)||[]}var o=r(/*! ./_asciiWords */338),a=r(/*! ./_hasUnicodeWord */398),s=r(/*! ./toString */25),l=r(/*! ./_unicodeWords */436);e.exports=n},/*!***********************************!*\
!*** ./~/lodash/wrapperLodash.js ***!
\***********************************/
function(e,t,r){function n(e){if(u(e)&&!l(e)&&!(e instanceof o)){if(e instanceof a)return e;if(p.call(e,"__wrapped__"))return i(e)}return new a(e)}var o=r(/*! ./_LazyWrapper */98),a=r(/*! ./_LodashWrapper */99),s=r(/*! ./_baseLodash */109),l=r(/*! ./isArray */4),u=r(/*! ./isObjectLike */20),i=r(/*! ./_wrapperClone */438),c=Object.prototype,p=c.hasOwnProperty;n.prototype=s.prototype,n.prototype.constructor=n,e.exports=n},/*!***********************!*\
!*** ./~/ms/index.js ***!
\***********************/
function(e,t){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"days":case"day":case"d":return r*i;case"hours":case"hour":case"hrs":case"hr":case"h":return r*u;case"minutes":case"minute":case"mins":case"min":case"m":return r*l;case"seconds":case"second":case"secs":case"sec":case"s":return r*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function n(e){return e>=i?Math.round(e/i)+"d":e>=u?Math.round(e/u)+"h":e>=l?Math.round(e/l)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,i,"day")||a(e,u,"hour")||a(e,l,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var s=1e3,l=60*s,u=60*l,i=24*u,c=365.25*i;e.exports=function(e,t){return t=t||{},"string"==typeof e?r(e):t["long"]?o(e):n(e)}},/*!***************************!*\
!*** external "ReactDOM" ***!
\***************************/
function(e,r){e.exports=t}])}); |
src/components/options/OptionsContainer.js | secretin/secretin-app | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import PropTypes from 'prop-types';
import ShortLoginShow from 'components/options/ShortLoginShow';
import QRCodeShow from 'components/options/QRCodeShow';
import RescueCodesShow from 'components/options/RescueCodesShow';
import ChangePasswordShow from 'components/options/ChangePasswordShow';
import Title from 'components/utilities/Title';
import Checkbox from 'components/utilities/Checkbox';
import Input from 'components/utilities/Input';
import Button from 'components/utilities/Button';
import * as OptionsActions from 'slices/OptionsSlice';
class OptionsContainer extends Component {
static propTypes = {
options: PropTypes.object,
newPass: PropTypes.object,
isOnline: PropTypes.bool,
actions: PropTypes.object,
};
constructor(props) {
super(props);
this.onChangeTimeToClose = this.onChangeTimeToClose.bind(this);
this.onChangeDefaultUsername = this.onChangeDefaultUsername.bind(this);
this.onSaveDefaultUsername = this.onSaveDefaultUsername.bind(this);
this.state = {
defaultUsername: props.options.defaultUsername,
};
}
onChangeDefaultUsername({ value }) {
this.setState({ defaultUsername: value });
}
onChangeTimeToClose({ value }) {
this.props.actions.changeTimeToClose({
timeToClose: value === '' ? -1 : parseInt(value, 10) || 0,
});
}
onSaveDefaultUsername() {
this.props.actions.changeDefaultUsername({
defaultUsername: this.state.defaultUsername,
});
}
render() {
const {
options,
isOnline,
options: { defaultUsername = '' },
} = this.props;
return (
<div className="page">
<div className="page-header">
<div className="breadcrumb">
<Title link="/options/" icon="gear" title="Options" />
</div>
</div>
<div className="page-content options">
<div className="options-section">
<h3 className="options-section-title">Experience</h3>
<div className="options-section-item">
<Input
name="defaultUsername"
label="Default username"
size="small"
value={this.state.defaultUsername}
onChange={this.onChangeDefaultUsername}
disabled={!isOnline}
/>
<div className="options-section-subitem-save">
<Button
type="button"
buttonStyle={
this.state.defaultUsername === defaultUsername
? 'default'
: 'primary'
}
onClick={this.onSaveDefaultUsername}
size="small"
disabled={
!isOnline || this.state.defaultUsername === defaultUsername
}
>
Save
</Button>
</div>
</div>
</div>
<div className="options-section">
<h3 className="options-section-title">Security</h3>
<div className="options-section-item">
<QRCodeShow />
<Checkbox
checked={options.totp}
onChange={this.props.actions.toggleTotp}
disabled={!isOnline}
>
Activate two-factor authentication
</Checkbox>
{options.totp && (
<div className="options-section-subitem">
<RescueCodesShow />
<Button
size="small"
buttonStyle="default"
onClick={this.props.actions.showRescueCodes}
>
Generate rescue Codes
</Button>
</div>
)}
</div>
<div className="options-section-item">
<ShortLoginShow />
<Checkbox
checked={options.shortLogin}
onChange={this.props.actions.toggleShortLogin}
disabled={!isOnline}
>
Activate ShortLogin
</Checkbox>
</div>
<div className="options-section-item">
<Checkbox
checked={options.timeToClose !== 0}
onChange={this.props.actions.toggleAutoLogout}
disabled={!isOnline}
>
Activate auto logout
</Checkbox>
{(options.timeToClose === -1 || options.timeToClose > 0) && (
<div className="options-section-subitem">
{'Disconnect me after '}
<Input
name="timeToClose"
label=""
size="small"
value={
options.timeToClose === -1
? ''
: options.timeToClose.toString()
}
onChange={this.onChangeTimeToClose}
type="number"
inputProps={{
min: 0,
max: 60,
step: 5,
}}
disabled={!isOnline}
/>
<b> min</b>
</div>
)}
</div>
</div>
<div className="options-section">
<div className="options-section-item">
<ChangePasswordShow />
<Button
type="button"
buttonStyle="warning"
onClick={this.props.actions.showChangePassword}
disabled={!isOnline}
>
Change master password
</Button>
</div>
</div>
</div>
</div>
);
}
}
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators(OptionsActions, dispatch),
});
const mapStateToProps = state => {
const { options } = state.Options;
const { online } = state.AppUI;
return {
options,
isOnline: online,
};
};
export default connect(mapStateToProps, mapDispatchToProps)(OptionsContainer);
|
ajax/libs/reactable/0.9.6/reactable.min.js | wil93/cdnjs | "use strict";(function(a,b){if(typeof define==="function"&&define.amd){define(["react"],b)}else{if(typeof exports==="object"){module.exports=b(require("react"))}else{a.Reactable=b(a.React)}}}(this,function(b){var e={};if(!Array.prototype.map){Array.prototype.map=function(y,x){var r,q,s;if(this==null){throw new TypeError(" this is null or not defined")}var u=Object(this);var v=u.length>>>0;if(typeof y!=="function"){throw new TypeError(y+" is not a function")}if(arguments.length>1){r=x}q=new Array(v);s=0;while(s<v){var t,w;if(s in u){t=u[s];w=y.call(r,t,s,u);q[s]=w}s++}return q}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(r){var q=this.length>>>0;var s=Number(arguments[1])||0;s=(s<0)?Math.ceil(s):Math.floor(s);if(s<0){s+=q}for(;s<q;s++){if(s in this&&this[s]===r){return s}}return -1}}if(!Array.prototype.find){Object.defineProperty(Array.prototype,"find",{enumerable:false,configurable:true,writable:true,value:function(q){if(this==null){throw new TypeError("Array.prototype.find called on null or undefined")}if(typeof q!=="function"){throw new TypeError("predicate must be a function")}var v=Object(this);var t=v.length>>>0;var r=arguments[1];var u;for(var s=0;s<t;s++){if(s in v){u=v[s];if(q.call(r,u,s,v)){return u}}}return undefined}})}if(!Array.isArray){Array.isArray=function(q){return Object.prototype.toString.call(q)==="[object Array]"}}if(!Object.assign){Object.defineProperty(Object,"assign",{enumerable:false,configurable:true,writable:true,value:function(x,q){if(x===undefined||x===null){throw new TypeError("Cannot convert first argument to object")}var z=Object(x);for(var r=1;r<arguments.length;r++){var u=arguments[r];if(u===undefined||u===null){continue}var s=Object.keys(Object(u));for(var t=0,w=s.length;t<w;t++){var y=s[t];var v=Object.getOwnPropertyDescriptor(u,y);if(v!==undefined&&v.enumerable){z[y]=u[y]}}}return z}})}function l(q){this.content=q}l.prototype.toString=function(){return this.content};function n(q){return q!==null&&typeof(q)!=="undefined"&&typeof(q.toString==="function")}function h(q){return q!==null&&typeof(q)==="object"&&typeof(q.props)!=="undefined"}b.Children.children=function(q){return b.Children.map(q,function(r){return r})||[]};e.unsafe=function(q){return new l(q)};e.Sort={Numeric:function(s,q){var t=parseFloat(s.toString().replace(",",""));var r=parseFloat(q.toString().replace(",",""));if(isNaN(t)&&isNaN(r)){t=s;r=q}else{if(isNaN(t)){return 1}if(isNaN(r)){return -1}}if(t<r){return -1}if(t>r){return 1}return 0},Currency:function(r,q){if(r[0]==="$"){r=r.substring(1)}if(q[0]==="$"){q=q.substring(1)}return e.Sort.Numeric(r,q)},Date:function(s,q){var t=Date.parse(s);var r=Date.parse(q);if(isNaN(t)||isNaN(r)){return e.Sort.Numeric(s,q)}if(t>r){return 1}if(r>t){return -1}return 0},CaseInsensitive:function(s,q){var t=s.toLowerCase();var r=q.toLowerCase();if(t>r){return 1}if(r>t){return -1}return 0}};var g=e.Td=b.createClass({displayName:"Td",handleClick:function(q){if(typeof this.props.handleClick!=="undefined"){return this.props.handleClick(q,this)}},render:function(){var s={"data-column":this.props.column.key,className:this.props.className,onClick:this.handleClick};for(var q in this.props.column){if(q!=="key"&&q!=="name"){s[q]=this.props.column[q]}}var r=this.props.data;if(typeof(this.props.children)!=="undefined"){if(h(this.props.children)){r=this.props.children}else{if(typeof(this.props.data)==="undefined"&&n(this.props.children)){r=this.props.children.toString()}}if(this.props.children instanceof l){s.dangerouslySetInnerHTML={__html:this.props.children.toString()}}else{s.children=r}}return b.DOM.td(s)}});var m=e.Tr=b.createClass({displayName:"Tr",statics:{childNode:g,dataType:"object"},render:function(){var q=d(b.Children.children(this.props.children));if(this.props.data&&this.props.columns&&typeof this.props.columns.map==="function"){if(typeof(q.concat)==="undefined"){console.log(q)}q=q.concat(this.props.columns.map(function(u,s){if(this.props.data.hasOwnProperty(u.key)){var v=this.props.data[u.key];var t={};if(typeof(v)!=="undefined"&&v!==null&&v.__reactableMeta===true){t=v.props;v=v.value}return g(Object.assign({column:u,key:u.key},t),v)}else{return g({column:u,key:u.key})}}.bind(this)))}var r=o(this.props);return b.DOM.tr(r,q)}});var f=e.Thead=b.createClass({displayName:"Thead",getColumns:function(){return b.Children.map(this.props.children,function(q){if(typeof q.props.children==="string"){return q.props.children}else{throw new TypeError("<th> must have a string child")}})},handleClickTh:function(q){this.props.onSort(q.key)},render:function(){var u=[];for(var r=0;r<this.props.columns.length;r++){var t=this.props.columns[r];var q="";if(this.props.sortableColumns[t.key]){q+="reactable-header-sortable "}if(this.props.sort.column===t.key){q+="reactable-header-sort";if(this.props.sort.direction===1){q+="-asc"}else{q+="-desc"}}u.push(c({className:q,key:r,onClick:this.handleClickTh.bind(this,t)},t.label))}var s=o(this.props);return b.DOM.thead(s,(this.props.filtering===true?k({colSpan:this.props.columns.length,onFilter:this.props.onFilter,value:this.props.currentFilter}):""),b.DOM.tr({className:"reactable-column-header"},u))}});var c=e.Th=b.createClass({displayName:"Th",render:function(){if(this.props.children instanceof l){return this.transferPropsTo(b.DOM.th({dangerouslySetInnerHTML:{__html:this.props.children.toString()}}))}else{return this.transferPropsTo(b.DOM.th(null,this.props.children))}}});var p=b.createClass({displayName:"FiltererInput",onChange:function(){this.props.onFilter(this.getDOMNode().value)},render:function(){return(b.DOM.input({type:"text",className:"reactable-filter-input",value:this.props.value,onKeyUp:this.onChange,onChange:this.onChange}))}});var k=b.createClass({displayName:"Filterer",render:function(){if(typeof this.props.colSpan==="undefined"){throw new TypeError("Must pass a colSpan argument to Filterer")}return(b.DOM.tr({className:"reactable-filterer"},b.DOM.td({colSpan:this.props.colSpan},p({onFilter:this.props.onFilter,value:this.props.value}))))}});var a=b.createClass({displayName:"Paginator",render:function(){if(typeof this.props.colSpan==="undefined"){throw new TypeError("Must pass a colSpan argument to Paginator")}if(typeof this.props.numPages==="undefined"){throw new TypeError("Must pass a non-zero numPages argument to Paginator")}if(typeof this.props.currentPage==="undefined"){throw new TypeError("Must pass a currentPage argument to Paginator")}var s=[];for(var q=0;q<this.props.numPages;q++){var t=q;var r="reactable-page-button";if(this.props.currentPage===q){r+=" reactable-current-page"}s.push(b.DOM.a({className:r,key:q,onClick:(function(u){return function(){this.props.onPageChange(u)}.bind(this)}.bind(this))(q)},q+1))}return(b.DOM.tbody({className:"reactable-pagination"},b.DOM.tr(null,b.DOM.td({colSpan:this.props.colSpan},s))))}});var j=e.Table=b.createClass({displayName:"Table",translateColumnsArray:function(q){return q.map(function(t,s){if(typeof(t)==="string"){return{key:t,label:t}}else{if(typeof(t.sortable)!=="undefined"){var r=t.sortable===true?"default":t.sortable;this._sortable[t.key]=r}return t}}.bind(this))},parseChildData:function(q){var r=[];if(typeof(q.children)!=="undefined"){b.Children.forEach(q.children,function(t){var s=t.props.data||{};b.Children.forEach(t.props.children,function(u){if(true){if(typeof(u.props.column)!=="undefined"){var v;if(typeof(u.props.data)!=="undefined"){v=u.props.data}else{if(typeof(u.props.children)!=="undefined"){v=u.props.children}else{console.warn("exports.Td specified without a `data` property or children, ignoring");return}}s[u.props.column]={value:v,props:o(u.props),__reactableMeta:true}}else{console.warn("exports.Td specified without a `column` property, ignoring")}}});r.push({data:s,props:o(t.props),__reactableMeta:true})}.bind(this))}return r},initialize:function(q){this.data=q.data||[];this.data=this.data.concat(this.parseChildData(q));this.initializeSorts(q)},initializeSorts:function(){this._sortable={};for(var s in this.props.sortable){var t=this.props.sortable[s];var r,q;if(t instanceof Object){if(typeof(t.column)!=="undefined"){r=t.column}else{console.warn("Sortable column specified without column name");return}if(typeof(t.sortFunction)==="function"){q=t.sortFunction}else{q="default"}}else{r=t;q="default"}this._sortable[r]=q}},getDefaultProps:function(){var q={sortBy:false,defaultSort:false,itemsPerPage:0};return q},getInitialState:function(){var q={currentPage:0,currentSort:{column:null,direction:1},filter:""};if(this.props.sortBy!==false||this.props.defaultSort!==false){var r=this.props.sortBy||this.props.defaultSort;q.currentSort=this.getCurrentSort(r)}return q},getCurrentSort:function(r){if(r instanceof Object){var q,s;if(typeof(r.column)!=="undefined"){q=r.column}else{console.warn("Default column specified without column name");return}if(typeof(r.direction)!=="undefined"){if(r.direction===1||r.direction==="asc"){s=1}else{if(r.direction===-1||r.direction==="desc"){s=-1}else{console.warn("Invalid default sort specified. Defaulting to ascending");s=1}}}else{s=1}}else{q=r;s=1}return{column:q,direction:s}},updateCurrentSort:function(q){if(q!==false&&q.column!==this.state.currentSort.column&&q.direction!==this.state.currentSort.direction){this.setState({currentSort:this.getCurrentSort(q)})}},componentWillMount:function(){this.initialize(this.props);this.sortByCurrentSort()},componentWillReceiveProps:function(q){this.initialize(q);this.updateCurrentSort(q.sortBy);this.sortByCurrentSort()},onPageChange:function(q){this.setState({currentPage:q})},filterBy:function(q){this.setState({filter:q})},applyFilter:function(t,s){var t=t.toLowerCase();var u=[];for(var r=0;r<s.length;r++){var v=s[r].props.data;for(var q=0;q<this.props.filterable.length;q++){var w=this.props.filterable[q];if(typeof(v[w])!=="undefined"&&v[w].toString().toLowerCase().indexOf(t)>-1){u.push(s[r]);break}}}return u},sortByCurrentSort:function(){var q=this.state.currentSort;if(q.column===null){return}this.data.sort(function(u,s){var t=u[q.column];t=n(t)?t.toString():"";var r=s[q.column];r=n(r)?r.toString():"";if(typeof(this._sortable[q.column])==="undefined"||this._sortable[q.column]==="default"){if(t<r){return -1*q.direction}if(t>r){return 1*q.direction}return 0}else{if(q.direction===1){return this._sortable[q.column](t,r)}else{return this._sortable[q.column](r,t)}}}.bind(this))},onSort:function(r){if(typeof(this._sortable[r])==="undefined"){return}var q=this.state.currentSort;if(q.column===r){q.direction*=-1}else{q.column=r;q.direction=1}this.setState({currentSort:q});this.sortByCurrentSort()},render:function(){var r=[];var u;var y=false;if(this.props.children&&this.props.children.length>0&&this.props.children[0].type.ConvenienceConstructor===f){u=this.props.children[0].getColumns()}else{u=this.props.columns||[]}if(u.length>0){y=true;u=this.translateColumnsArray(u)}if(this.data&&typeof this.data.map==="function"){r=r.concat(this.data.map(function(H,D){var G=H;var F={};if(H.__reactableMeta===true){G=H.data;F=H.props}for(var C in G){if(G.hasOwnProperty(C)){if(y===false){var E={key:C,label:C};if(u.find(function(I){return I.key===E.key})===undefined){u.push(E)}}}}return(m(Object.assign({columns:u,key:D,data:G},F)))}.bind(this)))}if(this.props.sortable===true){for(var v=0;v<u.length;v++){this._sortable[u[v].key]="default"}}var B=false;if(this.props.filterable&&Array.isArray(this.props.filterable)&&this.props.filterable.length>0){B=true}var q=r;if(this.state.filter!==""){q=this.applyFilter(this.state.filter,q)}var s=0;var z=false;var t;var w=this.state.currentPage;var A=q;if(this.props.itemsPerPage>0){s=this.props.itemsPerPage;t=Math.ceil(q.length/s);if(w>t-1){w=t-1}z=true;A=q.slice(w*s,(w+1)*s)}var x=o(this.props);return b.DOM.table(Object.assign({},x),[(u&&u.length>0?f({columns:u,filtering:B,onFilter:this.filterBy,currentFilter:this.state.filter,sort:this.state.currentSort,sortableColumns:this._sortable,onSort:this.onSort,key:"thead"}):null),b.DOM.tbody({className:"reactable-data",key:"tbody"},A),(z===true?a({colSpan:u.length,numPages:t,currentPage:w,onPageChange:this.onPageChange,key:"paginator"}):null)])}});function d(s){var r=[];for(var q in s){r[q]=s}return r}function o(q){q=q||{};var s={};for(var r in q){if(!(r in i)){s[r]=q[r]}}return s}var i={columns:true,sortable:true,filterable:true,sortBy:true,defaultSort:true,itemsPerPage:true,childNode:true,data:true};return e})); |
src/containers/HomePage/index.stories.js | ghrecommender/ghrecommender-frontend | import React from 'react'
import { MemoryRouter } from 'react-router-dom'
import HomePage from './index'
export default {
title: 'Pages|Home',
decorators: [story => <MemoryRouter>{story()}</MemoryRouter>],
}
export const homePage = () => <HomePage />
|
ajax/libs/swagger-ui/3.44.1/swagger-ui-es-bundle-core.js | cdnjs/cdnjs | /*! For license information please see swagger-ui-es-bundle-core.js.LICENSE.txt */
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist",n(n.s=412)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("immutable")},function(e,t,n){e.exports=n(444)},function(e,t,n){var r=n(194);e.exports=function(e,t,n){return t in e?r(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(473)},function(e,t,n){"use strict";(function(e){n.d(t,"t",(function(){return be})),n.d(t,"A",(function(){return Ee})),n.d(t,"i",(function(){return xe})),n.d(t,"w",(function(){return Se})),n.d(t,"r",(function(){return we})),n.d(t,"u",(function(){return je})),n.d(t,"s",(function(){return Oe})),n.d(t,"p",(function(){return Ce})),n.d(t,"v",(function(){return _e})),n.d(t,"y",(function(){return Ae})),n.d(t,"z",(function(){return ke})),n.d(t,"K",(function(){return Ie})),n.d(t,"f",(function(){return Pe})),n.d(t,"n",(function(){return Te})),n.d(t,"h",(function(){return Re})),n.d(t,"E",(function(){return Ne})),n.d(t,"L",(function(){return De})),n.d(t,"o",(function(){return ze})),n.d(t,"D",(function(){return Fe})),n.d(t,"a",(function(){return Je})),n.d(t,"I",(function(){return We})),n.d(t,"b",(function(){return He})),n.d(t,"H",(function(){return $e})),n.d(t,"G",(function(){return Ye})),n.d(t,"F",(function(){return Ke})),n.d(t,"k",(function(){return Ge})),n.d(t,"d",(function(){return Ze})),n.d(t,"g",(function(){return Xe})),n.d(t,"m",(function(){return Qe})),n.d(t,"l",(function(){return et})),n.d(t,"e",(function(){return tt})),n.d(t,"J",(function(){return nt})),n.d(t,"x",(function(){return rt})),n.d(t,"B",(function(){return at})),n.d(t,"C",(function(){return ot})),n.d(t,"j",(function(){return it})),n.d(t,"c",(function(){return st})),n.d(t,"q",(function(){return ut}));var r=n(15),a=n.n(r),o=(n(16),n(45)),i=n.n(o),s=n(19),c=n.n(s),u=n(13),l=n.n(u),p=n(4),f=n.n(p),d=n(71),h=n.n(d),m=n(2),v=n.n(m),g=n(18),y=n.n(g),b=n(12),E=n.n(b),x=n(17),S=n.n(x),w=(n(29),n(21)),j=n.n(w),O=n(22),C=n.n(O),_=n(160),A=n.n(_),k=n(23),I=n.n(k),P=n(33),T=n.n(P),R=(n(35),n(30)),N=n.n(R),M=n(14),D=n.n(M),q=n(56),B=n.n(q),L=n(133),U=n.n(L),V=n(84),z=n.n(V),F=n(1),J=n.n(F),W=n(378),H=n(379),$=n.n(H),Y=n(211),K=n.n(Y),G=n(212),Z=n.n(G),X=n(161),Q=n.n(X),ee=n(269),te=n.n(ee),ne=n(101),re=n.n(ne),ae=n(55),oe=n.n(ae),ie=n(111),se=n(26),ce=n(381),ue=n.n(ce),le=n(113),pe=n(382),fe=n.n(pe),de=n(383),he=n.n(de),me=n(65),ve=n.n(me),ge="default",ye=function(e){return J.a.Iterable.isIterable(e)};function be(e){try{var t=JSON.parse(e);if(t&&"object"===c()(t))return t}catch(e){}return!1}function Ee(e){return je(e)?ye(e)?e.toJS():e:{}}function xe(e){var t,n;if(ye(e))return e;if(e instanceof se.a.File)return e;if(!je(e))return e;if(l()(e))return f()(n=J.a.Seq(e)).call(n,xe).toList();if(oe()(h()(e))){var r,a=function(e){if(!oe()(h()(e)))return e;var t,n={},r="_**[]",a={},o=i()(h()(e).call(e));try{for(o.s();!(t=o.n()).done;){var s=t.value;if(n[s[0]]||a[s[0]]&&a[s[0]].containsMultiple){var c,u,l,p;if(!a[s[0]])a[s[0]]={containsMultiple:!0,length:1},n[v()(l=v()(p="".concat(s[0])).call(p,r)).call(l,a[s[0]].length)]=n[s[0]],delete n[s[0]];a[s[0]].length+=1,n[v()(c=v()(u="".concat(s[0])).call(u,r)).call(c,a[s[0]].length)]=s[1]}else n[s[0]]=s[1]}}catch(e){o.e(e)}finally{o.f()}return n}(e);return f()(r=J.a.OrderedMap(a)).call(r,xe)}return f()(t=J.a.OrderedMap(e)).call(t,xe)}function Se(e){return l()(e)?e:[e]}function we(e){return"function"==typeof e}function je(e){return!!e&&"object"===c()(e)}function Oe(e){return"function"==typeof e}function Ce(e){return l()(e)}var _e=Z.a;function Ae(e,t){var n;return j()(n=S()(e)).call(n,(function(n,r){return n[r]=t(e[r],r),n}),{})}function ke(e,t){var n;return j()(n=S()(e)).call(n,(function(n,r){var a=t(e[r],r);return a&&"object"===c()(a)&&C()(n,a),n}),{})}function Ie(e){return function(t){t.dispatch,t.getState;return function(t){return function(n){return"function"==typeof n?n(e()):t(n)}}}}function Pe(e){var t,n=e.keySeq();return n.contains(ge)?ge:A()(t=E()(n).call(n,(function(e){return"2"===(e+"")[0]}))).call(t).first()}function Te(e,t){if(!J.a.Iterable.isIterable(e))return J.a.List();var n=e.getIn(l()(t)?t:[t]);return J.a.List.isList(n)?n:J.a.List()}function Re(e){var t,n=[/filename\*=[^']+'\w*'"([^"]+)";?/i,/filename\*=[^']+'\w*'([^;]+);?/i,/filename="([^;]*);?"/i,/filename=([^;]*);?/i];if(T()(n).call(n,(function(n){return null!==(t=n.exec(e))})),null!==t&&t.length>1)try{return decodeURIComponent(t[1])}catch(e){console.error(e)}return null}function Ne(e){return t=e.replace(/\.[^./]*$/,""),K()($()(t));var t}function Me(e,t,n,r,o){if(!t)return[];var i=[],s=t.get("nullable"),u=t.get("required"),p=t.get("maximum"),d=t.get("minimum"),h=t.get("type"),m=t.get("format"),g=t.get("maxLength"),b=t.get("minLength"),x=t.get("uniqueItems"),S=t.get("maxItems"),w=t.get("minItems"),j=t.get("pattern"),O=n||u;if(s&&null===e||!h||!(O||"array"===h||!(!O&&!(null!=e))))return[];var C="string"===h&&e,_="array"===h&&l()(e)&&e.length,A="array"===h&&J.a.List.isList(e)&&e.count(),k=[C,_,A,"array"===h&&"string"==typeof e&&e,"file"===h&&e instanceof se.a.File,"boolean"===h&&(e||!1===e),"number"===h&&(e||0===e),"integer"===h&&(e||0===e),"object"===h&&"object"===c()(e)&&null!==e,"object"===h&&"string"==typeof e&&e],I=T()(k).call(k,(function(e){return!!e}));if(O&&!I&&!r)return i.push("Required field is not provided"),i;if("object"===h&&(null===o||"application/json"===o)){var P,R=e;if("string"==typeof e)try{R=JSON.parse(e)}catch(e){return i.push("Parameter string value must be valid JSON"),i}if(t&&t.has("required")&&Oe(u.isList)&&u.isList()&&y()(u).call(u,(function(e){void 0===R[e]&&i.push({propKey:e,error:"Required property not found"})})),t&&t.has("properties"))y()(P=t.get("properties")).call(P,(function(e,t){var n=Me(R[t],e,!1,r,o);i.push.apply(i,a()(f()(n).call(n,(function(e){return{propKey:t,error:e}}))))}))}if(j){var N=function(e,t){if(!new RegExp(t).test(e))return"Value must follow pattern "+t}(e,j);N&&i.push(N)}if(w&&"array"===h){var M=function(e,t){var n;if(!e&&t>=1||e&&e.length<t)return v()(n="Array must contain at least ".concat(t," item")).call(n,1===t?"":"s")}(e,w);M&&i.push(M)}if(S&&"array"===h){var D=function(e,t){var n;if(e&&e.length>t)return v()(n="Array must not contain more then ".concat(t," item")).call(n,1===t?"":"s")}(e,S);D&&i.push({needRemove:!0,error:D})}if(x&&"array"===h){var q=function(e,t){if(e&&("true"===t||!0===t)){var n=Object(F.fromJS)(e),r=n.toSet();if(e.length>r.size){var a=Object(F.Set)();if(y()(n).call(n,(function(e,t){E()(n).call(n,(function(t){return Oe(t.equals)?t.equals(e):t===e})).size>1&&(a=a.add(t))})),0!==a.size)return f()(a).call(a,(function(e){return{index:e,error:"No duplicates allowed."}})).toArray()}}}(e,x);q&&i.push.apply(i,a()(q))}if(g||0===g){var B=function(e,t){var n;if(e.length>t)return v()(n="Value must be no longer than ".concat(t," character")).call(n,1!==t?"s":"")}(e,g);B&&i.push(B)}if(b){var L=function(e,t){var n;if(e.length<t)return v()(n="Value must be at least ".concat(t," character")).call(n,1!==t?"s":"")}(e,b);L&&i.push(L)}if(p||0===p){var U=function(e,t){if(e>t)return"Value must be less than ".concat(t)}(e,p);U&&i.push(U)}if(d||0===d){var V=function(e,t){if(e<t)return"Value must be greater than ".concat(t)}(e,d);V&&i.push(V)}if("string"===h){var z;if(!(z="date-time"===m?function(e){if(isNaN(Date.parse(e)))return"Value must be a DateTime"}(e):"uuid"===m?function(e){if(e=e.toString().toLowerCase(),!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[)}]?$/.test(e))return"Value must be a Guid"}(e):function(e){if(e&&"string"!=typeof e)return"Value must be a string"}(e)))return i;i.push(z)}else if("boolean"===h){var W=function(e){if("true"!==e&&"false"!==e&&!0!==e&&!1!==e)return"Value must be a boolean"}(e);if(!W)return i;i.push(W)}else if("number"===h){var H=function(e){if(!/^-?\d+(\.?\d+)?$/.test(e))return"Value must be a number"}(e);if(!H)return i;i.push(H)}else if("integer"===h){var $=function(e){if(!/^-?\d+$/.test(e))return"Value must be an integer"}(e);if(!$)return i;i.push($)}else if("array"===h){if(!_&&!A)return i;e&&y()(e).call(e,(function(e,n){var s=Me(e,t.get("items"),!1,r,o);i.push.apply(i,a()(f()(s).call(s,(function(e){return{index:n,error:e}}))))}))}else if("file"===h){var Y=function(e){if(e&&!(e instanceof se.a.File))return"Value must be a file"}(e);if(!Y)return i;i.push(Y)}return i}var De=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.isOAS3,a=void 0!==r&&r,o=n.bypassRequiredCheck,i=void 0!==o&&o,s=e.get("required"),c=Object(le.a)(e,{isOAS3:a}),u=c.schema,l=c.parameterContentMediaType;return Me(t,u,s,i,l)},qe=function(e,t,n){if(e&&(!e.xml||!e.xml.name)){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'<?xml version="1.0" encoding="UTF-8"?>\n\x3c!-- XML example cannot be generated; root element name is undefined --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return Object(ie.memoizedCreateXMLExample)(e,t,n)},Be=[{when:/json/,shouldStringifyTypes:["string"]}],Le=["object"],Ue=function(e,t,n,r){var o=Object(ie.memoizedSampleFromSchema)(e,t,r),i=c()(o),s=j()(Be).call(Be,(function(e,t){var r;return t.when.test(n)?v()(r=[]).call(r,a()(e),a()(t.shouldStringifyTypes)):e}),Le);return te()(s,(function(e){return e===i}))?N()(o,null,2):o},Ve=function(e,t,n,r){var a,o=Ue(e,t,n,r);try{"\n"===(a=ve.a.safeDump(ve.a.safeLoad(o),{lineWidth:-1}))[a.length-1]&&(a=I()(a).call(a,0,a.length-1))}catch(e){return console.error(e),"error: could not generate yaml example"}return a.replace(/\t/g," ")},ze=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;return e&&Oe(e.toJS)&&(e=e.toJS()),r&&Oe(r.toJS)&&(r=r.toJS()),/xml/.test(t)?qe(e,n,r):/(yaml|yml)/.test(t)?Ve(e,n,t,r):Ue(e,n,t,r)},Fe=function(){var e={},t=se.a.location.search;if(!t)return{};if(""!=t){var n=t.substr(1).split("&");for(var r in n)n.hasOwnProperty(r)&&(r=n[r].split("="),e[decodeURIComponent(r[0])]=r[1]&&decodeURIComponent(r[1])||"")}return e},Je=function(t){return(t instanceof e?t:e.from(t.toString(),"utf-8")).toString("base64")},We={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},He=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},$e=function(e,t,n){return!!Q()(n,(function(n){return re()(e[n],t[n])}))};function Ye(e){return"string"!=typeof e||""===e?"":Object(W.sanitizeUrl)(e)}function Ke(e){return!(!e||D()(e).call(e,"localhost")>=0||D()(e).call(e,"127.0.0.1")>=0||"none"===e)}function Ge(e){if(!J.a.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=B()(e).call(e,(function(e,t){return U()(t).call(t,"2")&&S()(e.get("content")||{}).length>0})),n=e.get("default")||J.a.OrderedMap(),r=(n.get("content")||J.a.OrderedMap()).keySeq().toJS().length?n:null;return t||r}var Ze=function(e){return"string"==typeof e||e instanceof String?z()(e).call(e).replace(/\s/g,"%20"):""},Xe=function(e){return ue()(Ze(e).replace(/%20/g,"_"))},Qe=function(e){return E()(e).call(e,(function(e,t){return/^x-/.test(t)}))},et=function(e){return E()(e).call(e,(function(e,t){return/^pattern|maxLength|minLength|maximum|minimum/.test(t)}))};function tt(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};if("object"!==c()(e)||l()(e)||null===e||!t)return e;var a=C()({},e);return y()(n=S()(a)).call(n,(function(e){e===t&&r(a[e],e)?delete a[e]:a[e]=tt(a[e],t,r)})),a}function nt(e){if("string"==typeof e)return e;if(e&&e.toJS&&(e=e.toJS()),"object"===c()(e)&&null!==e)try{return N()(e,null,2)}catch(t){return String(e)}return null==e?"":e.toString()}function rt(e){return"number"==typeof e?e.toString():e}function at(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.returnAll,r=void 0!==n&&n,a=t.allowHashes,o=void 0===a||a;if(!J.a.Map.isMap(e))throw new Error("paramToIdentifier: received a non-Im.Map parameter as input");var i,s,c,u=e.get("name"),l=e.get("in"),p=[];e&&e.hashCode&&l&&u&&o&&p.push(v()(i=v()(s="".concat(l,".")).call(s,u,".hash-")).call(i,e.hashCode()));l&&u&&p.push(v()(c="".concat(l,".")).call(c,u));return p.push(u),r?p:p[0]||""}function ot(e,t){var n,r=at(e,{returnAll:!0});return E()(n=f()(r).call(r,(function(e){return t[e]}))).call(n,(function(e){return void 0!==e}))[0]}function it(){return ct(fe()(32).toString("base64"))}function st(e){return ct(he()("sha256").update(e).digest("base64"))}function ct(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var ut=function(e){return!e||!(!ye(e)||!e.isEmpty())}}).call(this,n(477).Buffer)},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(194);function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),r(e,a.key,a)}}e.exports=function(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(669),a=n(672);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=r(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(365),a=n(159),o=n(683),i=n(684);e.exports=function(e){var t=o();return function(){var n,o=a(e);if(t){var s=a(this).constructor;n=r(o,arguments,s)}else n=o.apply(this,arguments);return i(this,n)}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=require("prop-types")},function(e,t,n){e.exports=n(447)},function(e,t,n){e.exports=n(466)},function(e,t,n){e.exports=n(517)},function(e,t,n){var r=n(481),a=n(304),o=n(145),i=n(490);e.exports=function(e){return r(e)||a(e)||o(e)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(312),a=n(491),o=n(145),i=n(315);e.exports=function(e,t){return r(e)||a(e,t)||o(e,t)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(450)},function(e,t,n){e.exports=n(316)},function(e,t,n){var r=n(137),a=n(439);function o(t){return"function"==typeof r&&"symbol"==typeof a?(e.exports=o=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=o=function(e){return e&&"function"==typeof r&&e.constructor===r&&e!==r.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),o(t)}e.exports=o,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=require("reselect")},function(e,t,n){e.exports=n(468)},function(e,t,n){e.exports=n(461)},function(e,t,n){e.exports=n(463)},function(e,t,n){"use strict";var r=n(38),a=n(89).f,o=n(283),i=n(31),s=n(91),c=n(59),u=n(48),l=function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var n,p,f,d,h,m,v,g,y=e.target,b=e.global,E=e.stat,x=e.proto,S=b?r:E?r[y]:(r[y]||{}).prototype,w=b?i:i[y]||(i[y]={}),j=w.prototype;for(f in t)n=!o(b?f:y+(E?".":"#")+f,e.forced)&&S&&u(S,f),h=w[f],n&&(m=e.noTargetGet?(g=a(S,f))&&g.value:S[f]),d=n&&m?m:t[f],n&&typeof h==typeof d||(v=e.bind&&n?s(d,r):e.wrap&&n?l(d):x&&"function"==typeof d?s(Function.call,d):d,(e.sham||d&&d.sham||h&&h.sham)&&c(v,"sham",!0),w[f]=v,x&&(u(i,p=y+"Prototype")||c(i,p,{}),i[p][f]=d,e.real&&j&&!j[f]&&c(j,f,d)))}},function(e,t,n){var r=n(345),a=n(346),o=n(628),i=n(347),s=n(633),c=n(635),u=n(640),l=n(194),p=n(3);function f(e,t){var n=r(e);if(a){var s=a(e);t&&(s=o(s).call(s,(function(t){return i(e,t).enumerable}))),n.push.apply(n,s)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n,r=null!=arguments[t]?arguments[t]:{};if(t%2)s(n=f(Object(r),!0)).call(n,(function(t){p(e,t,r[t])}));else if(c)u(e,c(r));else{var a;s(a=f(Object(r))).call(a,(function(t){l(e,t,i(r,t))}))}}return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";t.a=function(){var e={location:{},history:{},open:function(){},close:function(){},File:function(){}};if("undefined"==typeof window)return e;try{e=window;for(var t=0,n=["File","Blob","FormData"];t<n.length;t++){var r=n[t];r in window&&(e[r]=window[r])}}catch(e){console.error(e)}return e}()},function(e,t){e.exports=require("react-immutable-proptypes")},function(e,t,n){var r=n(667);function a(){return e.exports=a=r||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,a.apply(this,arguments)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(457)},function(e,t,n){e.exports=n(452)},function(e,t){e.exports={}},function(e,t,n){"use strict";n.r(t),n.d(t,"isOAS3",(function(){return u})),n.d(t,"isSwagger2",(function(){return l})),n.d(t,"OAS3ComponentWrapFactory",(function(){return p}));var r=n(28),a=n.n(r),o=n(133),i=n.n(o),s=n(0),c=n.n(s);function u(e){var t=e.get("openapi");return"string"==typeof t&&(i()(t).call(t,"3.0.")&&t.length>4)}function l(e){var t=e.get("swagger");return"string"==typeof t&&i()(t).call(t,"2.0")}function p(e){return function(t,n){return function(r){return n&&n.specSelectors&&n.specSelectors.specJson?u(n.specSelectors.specJson())?c.a.createElement(e,a()({},r,n,{Ori:t})):c.a.createElement(t,r):(console.warn("OAS3 wrapper: couldn't get spec"),null)}}}},function(e,t,n){e.exports=n(506)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){e.exports=n(510)},function(e,t,n){var r=n(38),a=n(180),o=n(48),i=n(141),s=n(182),c=n(284),u=a("wks"),l=r.Symbol,p=c?l:l&&l.withoutSetter||i;e.exports=function(e){return o(u,e)&&(s||"string"==typeof u[e])||(s&&o(l,e)?u[e]=l[e]:u[e]=p("Symbol."+e)),u[e]}},function(e,t,n){e.exports=n(657)},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||function(){return this}()||Function("return this")()}).call(this,n(177))},function(e,t,n){var r=n(31);e.exports=function(e){return r[e+"Prototype"]}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(155);e.exports=function(e,t,n){var a=null==e?void 0:r(e,t);return void 0===a?n:a}},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_SPEC",(function(){return te})),n.d(t,"UPDATE_URL",(function(){return ne})),n.d(t,"UPDATE_JSON",(function(){return re})),n.d(t,"UPDATE_PARAM",(function(){return ae})),n.d(t,"UPDATE_EMPTY_PARAM_INCLUSION",(function(){return oe})),n.d(t,"VALIDATE_PARAMS",(function(){return ie})),n.d(t,"SET_RESPONSE",(function(){return se})),n.d(t,"SET_REQUEST",(function(){return ce})),n.d(t,"SET_MUTATED_REQUEST",(function(){return ue})),n.d(t,"LOG_REQUEST",(function(){return le})),n.d(t,"CLEAR_RESPONSE",(function(){return pe})),n.d(t,"CLEAR_REQUEST",(function(){return fe})),n.d(t,"CLEAR_VALIDATE_PARAMS",(function(){return de})),n.d(t,"UPDATE_OPERATION_META_VALUE",(function(){return he})),n.d(t,"UPDATE_RESOLVED",(function(){return me})),n.d(t,"UPDATE_RESOLVED_SUBTREE",(function(){return ve})),n.d(t,"SET_SCHEME",(function(){return ge})),n.d(t,"updateSpec",(function(){return ye})),n.d(t,"updateResolved",(function(){return be})),n.d(t,"updateUrl",(function(){return Ee})),n.d(t,"updateJsonSpec",(function(){return xe})),n.d(t,"parseToJson",(function(){return Se})),n.d(t,"resolveSpec",(function(){return je})),n.d(t,"requestResolvedSubtree",(function(){return _e})),n.d(t,"changeParam",(function(){return Ae})),n.d(t,"changeParamByIdentity",(function(){return ke})),n.d(t,"updateResolvedSubtree",(function(){return Ie})),n.d(t,"invalidateResolvedSubtreeCache",(function(){return Pe})),n.d(t,"validateParams",(function(){return Te})),n.d(t,"updateEmptyParamInclusion",(function(){return Re})),n.d(t,"clearValidateParams",(function(){return Ne})),n.d(t,"changeConsumesValue",(function(){return Me})),n.d(t,"changeProducesValue",(function(){return De})),n.d(t,"setResponse",(function(){return qe})),n.d(t,"setRequest",(function(){return Be})),n.d(t,"setMutatedRequest",(function(){return Le})),n.d(t,"logRequest",(function(){return Ue})),n.d(t,"executeRequest",(function(){return Ve})),n.d(t,"execute",(function(){return ze})),n.d(t,"clearResponse",(function(){return Fe})),n.d(t,"clearRequest",(function(){return Je})),n.d(t,"setScheme",(function(){return We}));var r=n(25),a=n.n(r),o=n(49),i=n.n(o),s=n(66),c=n.n(s),u=n(19),l=n.n(u),p=n(37),f=n.n(p),d=n(13),h=n.n(d),m=n(4),v=n.n(m),g=n(271),y=n.n(g),b=n(21),E=n.n(b),x=n(85),S=n.n(x),w=n(57),j=n.n(w),O=n(12),C=n.n(O),_=n(162),A=n.n(_),k=n(14),I=n.n(k),P=n(18),T=n.n(P),R=n(2),N=n.n(R),M=n(17),D=n.n(M),q=n(22),B=n.n(q),L=n(272),U=n.n(L),V=n(65),z=n.n(V),F=n(1),J=n(79),W=n.n(J),H=n(110),$=n.n(H),Y=n(163),K=n.n(Y),G=n(385),Z=n.n(G),X=n(273),Q=n.n(X),ee=n(5),te="spec_update_spec",ne="spec_update_url",re="spec_update_json",ae="spec_update_param",oe="spec_update_empty_param_inclusion",ie="spec_validate_param",se="spec_set_response",ce="spec_set_request",ue="spec_set_mutated_request",le="spec_log_request",pe="spec_clear_response",fe="spec_clear_request",de="spec_clear_validate_param",he="spec_update_operation_meta_value",me="spec_update_resolved",ve="spec_update_resolved_subtree",ge="set_scheme";function ye(e){var t,n=(t=e,K()(t)?t:"").replace(/\t/g," ");if("string"==typeof e)return{type:te,payload:n}}function be(e){return{type:me,payload:e}}function Ee(e){return{type:ne,payload:e}}function xe(e){return{type:re,payload:e}}var Se=function(e){return function(t){var n=t.specActions,r=t.specSelectors,a=t.errActions,o=r.specStr,i=null;try{e=e||o(),a.clear({source:"parser"}),i=z.a.safeLoad(e)}catch(e){return console.error(e),a.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return i&&"object"===l()(i)?n.updateJsonSpec(i):{}}},we=!1,je=function(e,t){return function(n){var r=n.specActions,a=n.specSelectors,o=n.errActions,i=n.fn,s=i.fetch,c=i.resolve,u=i.AST,l=void 0===u?{}:u,p=n.getConfigs;we||(console.warn("specActions.resolveSpec is deprecated since v3.10.0 and will be removed in v4.0.0; use requestResolvedSubtree instead!"),we=!0);var f=p(),d=f.modelPropertyMacro,m=f.parameterMacro,g=f.requestInterceptor,b=f.responseInterceptor;void 0===e&&(e=a.specJson()),void 0===t&&(t=a.url());var E=l.getLineNumberForPath?l.getLineNumberForPath:function(){},x=a.specStr();return c({fetch:s,spec:e,baseDoc:t,modelPropertyMacro:d,parameterMacro:m,requestInterceptor:g,responseInterceptor:b}).then((function(e){var t=e.spec,n=e.errors;if(o.clear({type:"thrown"}),h()(n)&&n.length>0){var a=v()(n).call(n,(function(e){return console.error(e),e.line=e.fullPath?E(x,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",y()(e,"message",{enumerable:!0,value:e.message}),e}));o.newThrownErrBatch(a)}return r.updateResolved(t)}))}},Oe=[],Ce=Z()(c()(f.a.mark((function e(){var t,n,r,a,o,i,s,u,l,p,d,m,g,b,x,w,O,_;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Oe.system){e.next=4;break}return console.error("debResolveSubtrees: don't have a system to operate on, aborting."),e.abrupt("return");case 4:if(n=t.errActions,r=t.errSelectors,a=t.fn,o=a.resolveSubtree,i=a.fetch,s=a.AST,u=void 0===s?{}:s,l=t.specSelectors,p=t.specActions,o){e.next=8;break}return console.error("Error: Swagger-Client did not provide a `resolveSubtree` method, doing nothing."),e.abrupt("return");case 8:return d=u.getLineNumberForPath?u.getLineNumberForPath:function(){},m=l.specStr(),g=t.getConfigs(),b=g.modelPropertyMacro,x=g.parameterMacro,w=g.requestInterceptor,O=g.responseInterceptor,e.prev=11,e.next=14,E()(Oe).call(Oe,function(){var e=c()(f.a.mark((function e(t,a){var s,u,p,g,E,_,k,I,P;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:return s=e.sent,u=s.resultMap,p=s.specWithCurrentSubtrees,e.next=7,o(p,a,{baseDoc:l.url(),modelPropertyMacro:b,parameterMacro:x,requestInterceptor:w,responseInterceptor:O});case 7:if(g=e.sent,E=g.errors,_=g.spec,r.allErrors().size&&n.clearBy((function(e){var t;return"thrown"!==e.get("type")||"resolver"!==e.get("source")||!S()(t=e.get("fullPath")).call(t,(function(e,t){return e===a[t]||void 0===a[t]}))})),h()(E)&&E.length>0&&(k=v()(E).call(E,(function(e){return e.line=e.fullPath?d(m,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",y()(e,"message",{enumerable:!0,value:e.message}),e})),n.newThrownErrBatch(k)),!_||!l.isOAS3()||"components"!==a[0]||"securitySchemes"!==a[1]){e.next=15;break}return e.next=15,j.a.all(v()(I=C()(P=A()(_)).call(P,(function(e){return"openIdConnect"===e.type}))).call(I,function(){var e=c()(f.a.mark((function e(t){var n,r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={url:t.openIdConnectUrl,requestInterceptor:w,responseInterceptor:O},e.prev=1,e.next=4,i(n);case 4:(r=e.sent)instanceof Error||r.status>=400?console.error(r.statusText+" "+n.url):t.openIdConnectData=JSON.parse(r.text),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()));case 15:return Q()(u,a,_),Q()(p,a,_),e.abrupt("return",{resultMap:u,specWithCurrentSubtrees:p});case 18:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),j.a.resolve({resultMap:(l.specResolvedSubtree([])||Object(F.Map)()).toJS(),specWithCurrentSubtrees:l.specJson().toJS()}));case 14:_=e.sent,delete Oe.system,Oe=[],e.next=22;break;case 19:e.prev=19,e.t0=e.catch(11),console.error(e.t0);case 22:p.updateResolvedSubtree([],_.resultMap);case 23:case"end":return e.stop()}}),e,null,[[11,19]])}))),35),_e=function(e){return function(t){var n;I()(n=v()(Oe).call(Oe,(function(e){return e.join("@@")}))).call(n,e.join("@@"))>-1||(Oe.push(e),Oe.system=t,Ce())}};function Ae(e,t,n,r,a){return{type:ae,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:a}}}function ke(e,t,n,r){return{type:ae,payload:{path:e,param:t,value:n,isXml:r}}}var Ie=function(e,t){return{type:ve,payload:{path:e,value:t}}},Pe=function(){return{type:ve,payload:{path:[],value:Object(F.Map)()}}},Te=function(e,t){return{type:ie,payload:{pathMethod:e,isOAS3:t}}},Re=function(e,t,n,r){return{type:oe,payload:{pathMethod:e,paramName:t,paramIn:n,includeEmptyValue:r}}};function Ne(e){return{type:de,payload:{pathMethod:e}}}function Me(e,t){return{type:he,payload:{path:e,value:t,key:"consumes_value"}}}function De(e,t){return{type:he,payload:{path:e,value:t,key:"produces_value"}}}var qe=function(e,t,n){return{payload:{path:e,method:t,res:n},type:se}},Be=function(e,t,n){return{payload:{path:e,method:t,req:n},type:ce}},Le=function(e,t,n){return{payload:{path:e,method:t,req:n},type:ue}},Ue=function(e){return{payload:e,type:le}},Ve=function(e){return function(t){var n,r,a=t.fn,o=t.specActions,i=t.specSelectors,s=t.getConfigs,u=t.oas3Selectors,l=e.pathName,p=e.method,d=e.operation,m=s(),g=m.requestInterceptor,y=m.responseInterceptor,b=d.toJS();d&&d.get("parameters")&&T()(n=C()(r=d.get("parameters")).call(r,(function(e){return e&&!0===e.get("allowEmptyValue")}))).call(n,(function(t){if(i.parameterInclusionSettingFor([l,p],t.get("name"),t.get("in"))){e.parameters=e.parameters||{};var n=Object(ee.C)(t,e.parameters);(!n||n&&0===n.size)&&(e.parameters[t.get("name")]="")}}));if(e.contextUrl=W()(i.url()).toString(),b&&b.operationId?e.operationId=b.operationId:b&&l&&p&&(e.operationId=a.opId(b,l,p)),i.isOAS3()){var E,x=N()(E="".concat(l,":")).call(E,p);e.server=u.selectedServer(x)||u.selectedServer();var S=u.serverVariables({server:e.server,namespace:x}).toJS(),w=u.serverVariables({server:e.server}).toJS();e.serverVariables=D()(S).length?S:w,e.requestContentType=u.requestContentType(l,p),e.responseContentType=u.responseContentType(l,p)||"*/*";var j=u.requestBodyValue(l,p),O=u.requestBodyInclusionSetting(l,p);if(Object(ee.t)(j))e.requestBody=JSON.parse(j);else if(j&&j.toJS){var _;e.requestBody=C()(_=v()(j).call(j,(function(e){return F.Map.isMap(e)?e.get("value"):e}))).call(_,(function(e,t){return(h()(e)?0!==e.length:!Object(ee.q)(e))||O.get(t)})).toJS()}else e.requestBody=j}var A=B()({},e);A=a.buildRequest(A),o.setRequest(e.pathName,e.method,A);var k=function(){var t=c()(f.a.mark((function t(n){var r,a;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,g.apply(undefined,[n]);case 2:return r=t.sent,a=B()({},r),o.setMutatedRequest(e.pathName,e.method,a),t.abrupt("return",r);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();e.requestInterceptor=k,e.responseInterceptor=y;var I=U()();return a.execute(e).then((function(t){t.duration=U()()-I,o.setResponse(e.pathName,e.method,t)})).catch((function(t){"Failed to fetch"===t.message&&(t.name="",t.message='**Failed to fetch.** \n**Possible Reasons:** \n - CORS \n - Network Failure \n - URL scheme must be "http" or "https" for CORS request.'),o.setResponse(e.pathName,e.method,{error:!0,err:$()(t)})}))}},ze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=i()(e,["path","method"]);return function(e){var o=e.fn.fetch,i=e.specSelectors,s=e.specActions,c=i.specJsonWithResolvedSubtrees().toJS(),u=i.operationScheme(t,n),l=i.contentTypeValues([t,n]).toJS(),p=l.requestContentType,f=l.responseContentType,d=/xml/i.test(p),h=i.parameterValues([t,n],d).toJS();return s.executeRequest(a()(a()({},r),{},{fetch:o,spec:c,pathName:t,method:n,parameters:h,requestContentType:p,scheme:u,responseContentType:f}))}};function Fe(e,t){return{type:pe,payload:{path:e,method:t}}}function Je(e,t){return{type:fe,payload:{path:e,method:t}}}function We(e,t,n){return{type:ge,payload:{scheme:e,path:t,method:n}}}},function(e,t,n){var r=n(31),a=n(48),o=n(189),i=n(60).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});a(t,e)||i(t,e,{value:o.f(e)})}},function(e,t,n){var r=n(34);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){var r=n(137),a=n(493),o=n(195),i=n(313),s=n(145);e.exports=function(e,t){var n;if(void 0===r||null==a(e)){if(o(e)||(n=s(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var c=0,u=function(){};return{s:u,n:function(){return c>=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,p=!0,f=!1;return{s:function(){n=i(e)},n:function(){var e=n.next();return p=e.done,e},e:function(e){f=!0,l=e},f:function(){try{p||null==n.return||n.return()}finally{if(f)throw l}}}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(40);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(346),a=n(348),o=n(645);e.exports=function(e,t){if(null==e)return{};var n,i,s=o(e,t);if(r){var c=r(e);for(i=0;i<c.length;i++)n=c[i],a(t).call(t,n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_SELECTED_SERVER",(function(){return r})),n.d(t,"UPDATE_REQUEST_BODY_VALUE",(function(){return a})),n.d(t,"UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG",(function(){return o})),n.d(t,"UPDATE_REQUEST_BODY_INCLUSION",(function(){return i})),n.d(t,"UPDATE_ACTIVE_EXAMPLES_MEMBER",(function(){return s})),n.d(t,"UPDATE_REQUEST_CONTENT_TYPE",(function(){return c})),n.d(t,"UPDATE_RESPONSE_CONTENT_TYPE",(function(){return u})),n.d(t,"UPDATE_SERVER_VARIABLE_VALUE",(function(){return l})),n.d(t,"SET_REQUEST_BODY_VALIDATE_ERROR",(function(){return p})),n.d(t,"CLEAR_REQUEST_BODY_VALIDATE_ERROR",(function(){return f})),n.d(t,"CLEAR_REQUEST_BODY_VALUE",(function(){return d})),n.d(t,"setSelectedServer",(function(){return h})),n.d(t,"setRequestBodyValue",(function(){return m})),n.d(t,"setRetainRequestBodyValueFlag",(function(){return v})),n.d(t,"setRequestBodyInclusion",(function(){return g})),n.d(t,"setActiveExamplesMember",(function(){return y})),n.d(t,"setRequestContentType",(function(){return b})),n.d(t,"setResponseContentType",(function(){return E})),n.d(t,"setServerVariableValue",(function(){return x})),n.d(t,"setRequestBodyValidateError",(function(){return S})),n.d(t,"clearRequestBodyValidateError",(function(){return w})),n.d(t,"initRequestBodyValidateError",(function(){return j})),n.d(t,"clearRequestBodyValue",(function(){return O}));var r="oas3_set_servers",a="oas3_set_request_body_value",o="oas3_set_request_body_retain_flag",i="oas3_set_request_body_inclusion",s="oas3_set_active_examples_member",c="oas3_set_request_content_type",u="oas3_set_response_content_type",l="oas3_set_server_variable_value",p="oas3_set_request_body_validate_error",f="oas3_clear_request_body_validate_error",d="oas3_clear_request_body_value";function h(e,t){return{type:r,payload:{selectedServerUrl:e,namespace:t}}}function m(e){var t=e.value,n=e.pathMethod;return{type:a,payload:{value:t,pathMethod:n}}}var v=function(e){var t=e.value,n=e.pathMethod;return{type:o,payload:{value:t,pathMethod:n}}};function g(e){var t=e.value,n=e.pathMethod,r=e.name;return{type:i,payload:{value:t,pathMethod:n,name:r}}}function y(e){var t=e.name,n=e.pathMethod,r=e.contextType,a=e.contextName;return{type:s,payload:{name:t,pathMethod:n,contextType:r,contextName:a}}}function b(e){var t=e.value,n=e.pathMethod;return{type:c,payload:{value:t,pathMethod:n}}}function E(e){var t=e.value,n=e.path,r=e.method;return{type:u,payload:{value:t,path:n,method:r}}}function x(e){var t=e.server,n=e.namespace,r=e.key,a=e.val;return{type:l,payload:{server:t,namespace:n,key:r,val:a}}}var S=function(e){var t=e.path,n=e.method,r=e.validationErrors;return{type:p,payload:{path:t,method:n,validationErrors:r}}},w=function(e){var t=e.path,n=e.method;return{type:f,payload:{path:t,method:n}}},j=function(e){var t=e.pathMethod;return{type:f,payload:{path:t[0],method:t[1]}}},O=function(e){var t=e.pathMethod;return{type:d,payload:{pathMethod:t}}}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";n.d(t,"b",(function(){return b})),n.d(t,"e",(function(){return E})),n.d(t,"c",(function(){return S})),n.d(t,"a",(function(){return w})),n.d(t,"d",(function(){return j}));var r=n(45),a=n.n(r),o=n(18),i=n.n(o),s=n(33),c=n.n(s),u=n(2),l=n.n(u),p=n(19),f=n.n(p),d=n(51),h=n.n(d),m=n(278),v=n.n(m),g=function(e){return String.prototype.toLowerCase.call(e)},y=function(e){return e.replace(/[^\w]/gi,"_")};function b(e){var t=e.openapi;return!!t&&v()(t,"3")}function E(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=r.v2OperationIdCompatibilityMode;if(!e||"object"!==f()(e))return null;var o=(e.operationId||"").replace(/\s/g,"");return o.length?y(e.operationId):x(t,n,{v2OperationIdCompatibilityMode:a})}function x(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.v2OperationIdCompatibilityMode;if(a){var o,i,s=l()(o="".concat(t.toLowerCase(),"_")).call(o,e).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return(s=s||l()(i="".concat(e.substring(1),"_")).call(i,t)).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return l()(n="".concat(g(t))).call(n,y(e))}function S(e,t){var n;return l()(n="".concat(g(t),"-")).call(n,e)}function w(e,t){return e&&e.paths?function(e,t){return function(e,t,n){if(!e||"object"!==f()(e)||!e.paths||"object"!==f()(e.paths))return null;var r=e.paths;for(var a in r)for(var o in r[a])if("PARAMETERS"!==o.toUpperCase()){var i=r[a][o];if(i&&"object"===f()(i)){var s={spec:e,pathName:a,method:o.toUpperCase(),operation:i},c=t(s);if(n&&c)return s}}return}(e,t,!0)||null}(e,(function(e){var n,r=e.pathName,a=e.method,o=e.operation;if(!o||"object"!==f()(o))return!1;var i=o.operationId,s=E(o,r,a),u=S(r,a);return c()(n=[s,u,i]).call(n,(function(e){return e&&e===t}))})):null}function j(e){var t=e.spec,n=t.paths,r={};if(!n||t.$$normalized)return e;for(var o in n){var s=n[o];if(h()(s)){var u=s.parameters,p=function(e){var n=s[e];if(!h()(n))return"continue";var p=E(n,o,e);if(p){r[p]?r[p].push(n):r[p]=[n];var f=r[p];if(f.length>1)i()(f).call(f,(function(e,t){var n;e.__originalOperationId=e.__originalOperationId||e.operationId,e.operationId=l()(n="".concat(p)).call(n,t+1)}));else if(void 0!==n.operationId){var d=f[0];d.__originalOperationId=d.__originalOperationId||n.operationId,d.operationId=p}}if("parameters"!==e){var m=[],v={};for(var g in t)"produces"!==g&&"consumes"!==g&&"security"!==g||(v[g]=t[g],m.push(v));if(u&&(v.parameters=u,m.push(v)),m.length){var y,b=a()(m);try{for(b.s();!(y=b.n()).done;){var x=y.value;for(var S in x)if(n[S]){if("parameters"===S){var w,j=a()(x[S]);try{var O=function(){var e,t=w.value;c()(e=n[S]).call(e,(function(e){return e.name&&e.name===t.name||e.$ref&&e.$ref===t.$ref||e.$$ref&&e.$$ref===t.$$ref||e===t}))||n[S].push(t)};for(j.s();!(w=j.n()).done;)O()}catch(e){j.e(e)}finally{j.f()}}}else n[S]=x[S]}}catch(e){b.e(e)}finally{b.f()}}}};for(var f in s)p(f)}}return t.$$normalized=!0,e}},function(e,t,n){"use strict";n.r(t),n.d(t,"NEW_THROWN_ERR",(function(){return o})),n.d(t,"NEW_THROWN_ERR_BATCH",(function(){return i})),n.d(t,"NEW_SPEC_ERR",(function(){return s})),n.d(t,"NEW_SPEC_ERR_BATCH",(function(){return c})),n.d(t,"NEW_AUTH_ERR",(function(){return u})),n.d(t,"CLEAR",(function(){return l})),n.d(t,"CLEAR_BY",(function(){return p})),n.d(t,"newThrownErr",(function(){return f})),n.d(t,"newThrownErrBatch",(function(){return d})),n.d(t,"newSpecErr",(function(){return h})),n.d(t,"newSpecErrBatch",(function(){return m})),n.d(t,"newAuthErr",(function(){return v})),n.d(t,"clear",(function(){return g})),n.d(t,"clearBy",(function(){return y}));var r=n(110),a=n.n(r),o="err_new_thrown_err",i="err_new_thrown_err_batch",s="err_new_spec_err",c="err_new_spec_err_batch",u="err_new_auth_err",l="err_clear",p="err_clear_by";function f(e){return{type:o,payload:a()(e)}}function d(e){return{type:i,payload:e}}function h(e){return{type:s,payload:e}}function m(e){return{type:c,payload:e}}function v(e){return{type:u,payload:e}}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:l,payload:e}}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return{type:p,payload:e}}},function(e,t){e.exports=require("classnames")},function(e,t,n){var r=n(96),a=n(51);e.exports=function(e){if(!a(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){e.exports=n(520)},function(e,t,n){e.exports=n(659)},function(e,t,n){var r=n(139),a=n(104);e.exports=function(e){return r(a(e))}},function(e,t,n){var r=n(44),a=n(60),o=n(90);e.exports=r?function(e,t,n){return a.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(44),a=n(282),o=n(46),i=n(140),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(o(e),t=i(t,!0),o(n),a)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(104);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(31),a=n(38),o=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?o(r[e])||o(a[e]):r[e]&&r[e][t]||a[e]&&a[e][t]}},function(e,t,n){n(125);var r=n(443),a=n(38),o=n(74),i=n(59),s=n(94),c=n(36)("toStringTag");for(var u in r){var l=a[u],p=l&&l.prototype;p&&o(p)!==c&&i(p,c,u),s[u]=s.Array}},function(e,t,n){var r=n(322),a="object"==typeof self&&self&&self.Object===Object&&self,o=r||a||Function("return this")();e.exports=o},function(e,t){e.exports=require("js-yaml")},function(e,t,n){var r=n(646);function a(e,t,n,a,o,i,s){try{var c=e[i](s),u=c.value}catch(e){return void n(e)}c.done?t(u):r.resolve(u).then(a,o)}e.exports=function(e){return function(){var t=this,n=arguments;return new r((function(r,o){var i=e.apply(t,n);function s(e){a(i,r,o,s,c,"next",e)}function c(e){a(i,r,o,s,c,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(117),a=Math.min;e.exports=function(e){return e>0?a(r(e),9007199254740991):0}},function(e,t,n){var r,a,o,i=n(288),s=n(38),c=n(40),u=n(59),l=n(48),p=n(181),f=n(144),d=n(123),h=s.WeakMap;if(i){var m=p.state||(p.state=new h),v=m.get,g=m.has,y=m.set;r=function(e,t){return t.facade=e,y.call(m,e,t),t},a=function(e){return v.call(m,e)||{}},o=function(e){return g.call(m,e)}}else{var b=f("state");d[b]=!0,r=function(e,t){return t.facade=e,u(e,b,t),t},a=function(e){return l(e,b)?e[b]:{}},o=function(e){return l(e,b)}}e.exports={set:r,get:a,has:o,enforce:function(e){return o(e)?a(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=a(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},function(e,t){e.exports=require("deep-extend")},function(e,t,n){e.exports=n(495)},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";n.r(t),n.d(t,"SHOW_AUTH_POPUP",(function(){return d})),n.d(t,"AUTHORIZE",(function(){return h})),n.d(t,"LOGOUT",(function(){return m})),n.d(t,"PRE_AUTHORIZE_OAUTH2",(function(){return v})),n.d(t,"AUTHORIZE_OAUTH2",(function(){return g})),n.d(t,"VALIDATE",(function(){return y})),n.d(t,"CONFIGURE_AUTH",(function(){return b})),n.d(t,"RESTORE_AUTHORIZATION",(function(){return E})),n.d(t,"showDefinitions",(function(){return x})),n.d(t,"authorize",(function(){return S})),n.d(t,"authorizeWithPersistOption",(function(){return w})),n.d(t,"logout",(function(){return j})),n.d(t,"logoutWithPersistOption",(function(){return O})),n.d(t,"preAuthorizeImplicit",(function(){return C})),n.d(t,"authorizeOauth2",(function(){return _})),n.d(t,"authorizeOauth2WithPersistOption",(function(){return A})),n.d(t,"authorizePassword",(function(){return k})),n.d(t,"authorizeApplication",(function(){return I})),n.d(t,"authorizeAccessCodeWithFormParams",(function(){return P})),n.d(t,"authorizeAccessCodeWithBasicAuthentication",(function(){return T})),n.d(t,"authorizeRequest",(function(){return R})),n.d(t,"configureAuth",(function(){return N})),n.d(t,"restoreAuthorization",(function(){return M})),n.d(t,"persistAuthorizationIfNeeded",(function(){return D}));var r=n(19),a=n.n(r),o=n(30),i=n.n(o),s=n(22),c=n.n(s),u=n(79),l=n.n(u),p=n(26),f=n(5),d="show_popup",h="authorize",m="logout",v="pre_authorize_oauth2",g="authorize_oauth2",y="validate",b="configure_auth",E="restore_authorization";function x(e){return{type:d,payload:e}}function S(e){return{type:h,payload:e}}var w=function(e){return function(t){var n=t.authActions;n.authorize(e),n.persistAuthorizationIfNeeded()}};function j(e){return{type:m,payload:e}}var O=function(e){return function(t){var n=t.authActions;n.logout(e),n.persistAuthorizationIfNeeded()}},C=function(e){return function(t){var n=t.authActions,r=t.errActions,a=e.auth,o=e.token,s=e.isValid,c=a.schema,u=a.name,l=c.get("flow");delete p.a.swaggerUIRedirectOauth2,"accessCode"===l||s||r.newAuthErr({authId:u,source:"auth",level:"warning",message:"Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"}),o.error?r.newAuthErr({authId:u,source:"auth",level:"error",message:i()(o)}):n.authorizeOauth2WithPersistOption({auth:a,token:o})}};function _(e){return{type:g,payload:e}}var A=function(e){return function(t){var n=t.authActions;n.authorizeOauth2(e),n.persistAuthorizationIfNeeded()}},k=function(e){return function(t){var n=t.authActions,r=e.schema,a=e.name,o=e.username,i=e.password,s=e.passwordType,u=e.clientId,l=e.clientSecret,p={grant_type:"password",scope:e.scopes.join(" "),username:o,password:i},d={};switch(s){case"request-body":!function(e,t,n){t&&c()(e,{client_id:t});n&&c()(e,{client_secret:n})}(p,u,l);break;case"basic":d.Authorization="Basic "+Object(f.a)(u+":"+l);break;default:console.warn("Warning: invalid passwordType ".concat(s," was passed, not including client id and secret"))}return n.authorizeRequest({body:Object(f.b)(p),url:r.get("tokenUrl"),name:a,headers:d,query:{},auth:e})}};var I=function(e){return function(t){var n=t.authActions,r=e.schema,a=e.scopes,o=e.name,i=e.clientId,s=e.clientSecret,c={Authorization:"Basic "+Object(f.a)(i+":"+s)},u={grant_type:"client_credentials",scope:a.join(" ")};return n.authorizeRequest({body:Object(f.b)(u),name:o,url:r.get("tokenUrl"),auth:e,headers:c})}},P=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,a=t.schema,o=t.name,i=t.clientId,s=t.clientSecret,c=t.codeVerifier,u={grant_type:"authorization_code",code:t.code,client_id:i,client_secret:s,redirect_uri:n,code_verifier:c};return r.authorizeRequest({body:Object(f.b)(u),name:o,url:a.get("tokenUrl"),auth:t})}},T=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,a=t.schema,o=t.name,i=t.clientId,s=t.clientSecret,c={Authorization:"Basic "+Object(f.a)(i+":"+s)},u={grant_type:"authorization_code",code:t.code,client_id:i,redirect_uri:n};return r.authorizeRequest({body:Object(f.b)(u),name:o,url:a.get("tokenUrl"),auth:t,headers:c})}},R=function(e){return function(t){var n,r=t.fn,o=t.getConfigs,s=t.authActions,u=t.errActions,p=t.oas3Selectors,f=t.specSelectors,d=t.authSelectors,h=e.body,m=e.query,v=void 0===m?{}:m,g=e.headers,y=void 0===g?{}:g,b=e.name,E=e.url,x=e.auth,S=(d.getConfigs()||{}).additionalQueryStringParams;if(f.isOAS3()){var w=p.serverEffectiveValue(p.selectedServer());n=l()(E,w,!0)}else n=l()(E,f.url(),!0);"object"===a()(S)&&(n.query=c()({},n.query,S));var j=n.toString(),O=c()({Accept:"application/json, text/plain, */*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},y);r.fetch({url:j,method:"post",headers:O,query:v,body:h,requestInterceptor:o().requestInterceptor,responseInterceptor:o().responseInterceptor}).then((function(e){var t=JSON.parse(e.data),n=t&&(t.error||""),r=t&&(t.parseError||"");e.ok?n||r?u.newAuthErr({authId:b,level:"error",source:"auth",message:i()(t)}):s.authorizeOauth2WithPersistOption({auth:x,token:t}):u.newAuthErr({authId:b,level:"error",source:"auth",message:e.statusText})})).catch((function(e){var t=new Error(e).message;if(e.response&&e.response.data){var n=e.response.data;try{var r="string"==typeof n?JSON.parse(n):n;r.error&&(t+=", error: ".concat(r.error)),r.error_description&&(t+=", description: ".concat(r.error_description))}catch(e){}}u.newAuthErr({authId:b,level:"error",source:"auth",message:t})}))}};function N(e){return{type:b,payload:e}}function M(e){return{type:E,payload:e}}var D=function(){return function(e){var t=e.authSelectors;if((0,e.getConfigs)().persistAuthorization){var n=t.authorized();localStorage.setItem("authorized",i()(n.toJS()))}}}},function(e,t,n){var r=n(190),a=n(115),o=n(36)("toStringTag"),i="Arguments"==a(function(){return arguments}());e.exports=r?a:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?a(t):"Object"==(r=a(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){var r=n(91),a=n(139),o=n(61),i=n(68),s=n(179),c=[].push,u=function(e){var t=1==e,n=2==e,u=3==e,l=4==e,p=6==e,f=7==e,d=5==e||p;return function(h,m,v,g){for(var y,b,E=o(h),x=a(E),S=r(m,v,3),w=i(x.length),j=0,O=g||s,C=t?O(h,w):n||f?O(h,0):void 0;w>j;j++)if((d||j in x)&&(b=S(y=x[j],j,E),e))if(t)C[j]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return j;case 2:c.call(C,y)}else switch(e){case 4:return!1;case 7:c.call(C,y)}return p?-1:u||l?l:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){var r=n(321);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"lastError",(function(){return N})),n.d(t,"url",(function(){return M})),n.d(t,"specStr",(function(){return D})),n.d(t,"specSource",(function(){return q})),n.d(t,"specJson",(function(){return B})),n.d(t,"specResolved",(function(){return L})),n.d(t,"specResolvedSubtree",(function(){return U})),n.d(t,"specJsonWithResolvedSubtrees",(function(){return z})),n.d(t,"spec",(function(){return F})),n.d(t,"isOAS3",(function(){return J})),n.d(t,"info",(function(){return W})),n.d(t,"externalDocs",(function(){return H})),n.d(t,"version",(function(){return $})),n.d(t,"semver",(function(){return Y})),n.d(t,"paths",(function(){return K})),n.d(t,"operations",(function(){return G})),n.d(t,"consumes",(function(){return Z})),n.d(t,"produces",(function(){return X})),n.d(t,"security",(function(){return Q})),n.d(t,"securityDefinitions",(function(){return ee})),n.d(t,"findDefinition",(function(){return te})),n.d(t,"definitions",(function(){return ne})),n.d(t,"basePath",(function(){return re})),n.d(t,"host",(function(){return ae})),n.d(t,"schemes",(function(){return oe})),n.d(t,"operationsWithRootInherited",(function(){return ie})),n.d(t,"tags",(function(){return se})),n.d(t,"tagDetails",(function(){return ce})),n.d(t,"operationsWithTags",(function(){return ue})),n.d(t,"taggedOperations",(function(){return le})),n.d(t,"responses",(function(){return pe})),n.d(t,"requests",(function(){return fe})),n.d(t,"mutatedRequests",(function(){return de})),n.d(t,"responseFor",(function(){return he})),n.d(t,"requestFor",(function(){return me})),n.d(t,"mutatedRequestFor",(function(){return ve})),n.d(t,"allowTryItOutFor",(function(){return ge})),n.d(t,"parameterWithMetaByIdentity",(function(){return ye})),n.d(t,"parameterInclusionSettingFor",(function(){return be})),n.d(t,"parameterWithMeta",(function(){return Ee})),n.d(t,"operationWithMeta",(function(){return xe})),n.d(t,"getParameter",(function(){return Se})),n.d(t,"hasHost",(function(){return we})),n.d(t,"parameterValues",(function(){return je})),n.d(t,"parametersIncludeIn",(function(){return Oe})),n.d(t,"parametersIncludeType",(function(){return Ce})),n.d(t,"contentTypeValues",(function(){return _e})),n.d(t,"currentProducesFor",(function(){return Ae})),n.d(t,"producesOptionsFor",(function(){return ke})),n.d(t,"consumesOptionsFor",(function(){return Ie})),n.d(t,"operationScheme",(function(){return Pe})),n.d(t,"canExecuteScheme",(function(){return Te})),n.d(t,"validateBeforeExecute",(function(){return Re})),n.d(t,"getOAS3RequiredRequestBodyContentType",(function(){return Ne})),n.d(t,"isMediaTypeSchemaPropertiesEqual",(function(){return Me}));var r=n(16),a=n.n(r),o=n(15),i=n.n(o),s=n(2),c=n.n(s),u=n(23),l=n.n(u),p=n(18),f=n.n(p),d=n(14),h=n.n(d),m=n(4),v=n.n(m),g=n(12),y=n.n(g),b=n(56),E=n.n(b),x=n(21),S=n.n(x),w=n(160),j=n.n(w),O=n(33),C=n.n(O),_=n(13),A=n.n(_),k=n(20),I=n(5),P=n(1),T=["get","put","post","delete","options","head","patch","trace"],R=function(e){return e||Object(P.Map)()},N=Object(k.createSelector)(R,(function(e){return e.get("lastError")})),M=Object(k.createSelector)(R,(function(e){return e.get("url")})),D=Object(k.createSelector)(R,(function(e){return e.get("spec")||""})),q=Object(k.createSelector)(R,(function(e){return e.get("specSource")||"not-editor"})),B=Object(k.createSelector)(R,(function(e){return e.get("json",Object(P.Map)())})),L=Object(k.createSelector)(R,(function(e){return e.get("resolved",Object(P.Map)())})),U=function(e,t){var n;return e.getIn(c()(n=["resolvedSubtrees"]).call(n,i()(t)),void 0)},V=function e(t,n){return P.Map.isMap(t)&&P.Map.isMap(n)?n.get("$$ref")?n:Object(P.OrderedMap)().mergeWith(e,t,n):n},z=Object(k.createSelector)(R,(function(e){return Object(P.OrderedMap)().mergeWith(V,e.get("json"),e.get("resolvedSubtrees"))})),F=function(e){return B(e)},J=Object(k.createSelector)(F,(function(){return!1})),W=Object(k.createSelector)(F,(function(e){return De(e&&e.get("info"))})),H=Object(k.createSelector)(F,(function(e){return De(e&&e.get("externalDocs"))})),$=Object(k.createSelector)(W,(function(e){return e&&e.get("version")})),Y=Object(k.createSelector)($,(function(e){var t;return l()(t=/v?([0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(e)).call(t,1)})),K=Object(k.createSelector)(z,(function(e){return e.get("paths")})),G=Object(k.createSelector)(K,(function(e){if(!e||e.size<1)return Object(P.List)();var t=Object(P.List)();return e&&f()(e)?(f()(e).call(e,(function(e,n){if(!e||!f()(e))return{};f()(e).call(e,(function(e,r){var a;h()(T).call(T,r)<0||(t=t.push(Object(P.fromJS)({path:n,method:r,operation:e,id:c()(a="".concat(r,"-")).call(a,n)})))}))})),t):Object(P.List)()})),Z=Object(k.createSelector)(F,(function(e){return Object(P.Set)(e.get("consumes"))})),X=Object(k.createSelector)(F,(function(e){return Object(P.Set)(e.get("produces"))})),Q=Object(k.createSelector)(F,(function(e){return e.get("security",Object(P.List)())})),ee=Object(k.createSelector)(F,(function(e){return e.get("securityDefinitions")})),te=function(e,t){var n=e.getIn(["resolvedSubtrees","definitions",t],null),r=e.getIn(["json","definitions",t],null);return n||r||null},ne=Object(k.createSelector)(F,(function(e){var t=e.get("definitions");return P.Map.isMap(t)?t:Object(P.Map)()})),re=Object(k.createSelector)(F,(function(e){return e.get("basePath")})),ae=Object(k.createSelector)(F,(function(e){return e.get("host")})),oe=Object(k.createSelector)(F,(function(e){return e.get("schemes",Object(P.Map)())})),ie=Object(k.createSelector)(G,Z,X,(function(e,t,n){return v()(e).call(e,(function(e){return e.update("operation",(function(e){if(e){if(!P.Map.isMap(e))return;return e.withMutations((function(e){return e.get("consumes")||e.update("consumes",(function(e){return Object(P.Set)(e).merge(t)})),e.get("produces")||e.update("produces",(function(e){return Object(P.Set)(e).merge(n)})),e}))}return Object(P.Map)()}))}))})),se=Object(k.createSelector)(F,(function(e){var t=e.get("tags",Object(P.List)());return P.List.isList(t)?y()(t).call(t,(function(e){return P.Map.isMap(e)})):Object(P.List)()})),ce=function(e,t){var n,r=se(e)||Object(P.List)();return E()(n=y()(r).call(r,P.Map.isMap)).call(n,(function(e){return e.get("name")===t}),Object(P.Map)())},ue=Object(k.createSelector)(ie,se,(function(e,t){return S()(e).call(e,(function(e,t){var n=Object(P.Set)(t.getIn(["operation","tags"]));return n.count()<1?e.update("default",Object(P.List)(),(function(e){return e.push(t)})):S()(n).call(n,(function(e,n){return e.update(n,Object(P.List)(),(function(e){return e.push(t)}))}),e)}),S()(t).call(t,(function(e,t){return e.set(t.get("name"),Object(P.List)())}),Object(P.OrderedMap)()))})),le=function(e){return function(t){var n,r=(0,t.getConfigs)(),a=r.tagsSorter,o=r.operationsSorter;return v()(n=ue(e).sortBy((function(e,t){return t}),(function(e,t){var n="function"==typeof a?a:I.I.tagsSorter[a];return n?n(e,t):null}))).call(n,(function(t,n){var r="function"==typeof o?o:I.I.operationsSorter[o],a=r?j()(t).call(t,r):t;return Object(P.Map)({tagDetails:ce(e,n),operations:a})}))}},pe=Object(k.createSelector)(R,(function(e){return e.get("responses",Object(P.Map)())})),fe=Object(k.createSelector)(R,(function(e){return e.get("requests",Object(P.Map)())})),de=Object(k.createSelector)(R,(function(e){return e.get("mutatedRequests",Object(P.Map)())})),he=function(e,t,n){return pe(e).getIn([t,n],null)},me=function(e,t,n){return fe(e).getIn([t,n],null)},ve=function(e,t,n){return de(e).getIn([t,n],null)},ge=function(){return!0},ye=function(e,t,n){var r,a,o=z(e).getIn(c()(r=["paths"]).call(r,i()(t),["parameters"]),Object(P.OrderedMap)()),s=e.getIn(c()(a=["meta","paths"]).call(a,i()(t),["parameters"]),Object(P.OrderedMap)()),u=v()(o).call(o,(function(e){var t,r,a,o=s.get(c()(t="".concat(n.get("in"),".")).call(t,n.get("name"))),i=s.get(c()(r=c()(a="".concat(n.get("in"),".")).call(a,n.get("name"),".hash-")).call(r,n.hashCode()));return Object(P.OrderedMap)().merge(e,o,i)}));return E()(u).call(u,(function(e){return e.get("in")===n.get("in")&&e.get("name")===n.get("name")}),Object(P.OrderedMap)())},be=function(e,t,n,r){var a,o,s=c()(a="".concat(r,".")).call(a,n);return e.getIn(c()(o=["meta","paths"]).call(o,i()(t),["parameter_inclusions",s]),!1)},Ee=function(e,t,n,r){var a,o=z(e).getIn(c()(a=["paths"]).call(a,i()(t),["parameters"]),Object(P.OrderedMap)()),s=E()(o).call(o,(function(e){return e.get("in")===r&&e.get("name")===n}),Object(P.OrderedMap)());return ye(e,t,s)},xe=function(e,t,n){var r,a=z(e).getIn(["paths",t,n],Object(P.OrderedMap)()),o=e.getIn(["meta","paths",t,n],Object(P.OrderedMap)()),i=v()(r=a.get("parameters",Object(P.List)())).call(r,(function(r){return ye(e,[t,n],r)}));return Object(P.OrderedMap)().merge(a,o).set("parameters",i)};function Se(e,t,n,r){var a;t=t||[];var o=e.getIn(c()(a=["meta","paths"]).call(a,i()(t),["parameters"]),Object(P.fromJS)([]));return E()(o).call(o,(function(e){return P.Map.isMap(e)&&e.get("name")===n&&e.get("in")===r}))||Object(P.Map)()}var we=Object(k.createSelector)(F,(function(e){var t=e.get("host");return"string"==typeof t&&t.length>0&&"/"!==t[0]}));function je(e,t,n){var r;t=t||[];var a=xe.apply(void 0,c()(r=[e]).call(r,i()(t))).get("parameters",Object(P.List)());return S()(a).call(a,(function(e,t){var r=n&&"body"===t.get("in")?t.get("value_xml"):t.get("value");return e.set(Object(I.B)(t,{allowHashes:!1}),r)}),Object(P.fromJS)({}))}function Oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(P.List.isList(e))return C()(e).call(e,(function(e){return P.Map.isMap(e)&&e.get("in")===t}))}function Ce(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(P.List.isList(e))return C()(e).call(e,(function(e){return P.Map.isMap(e)&&e.get("type")===t}))}function _e(e,t){var n,r;t=t||[];var a=z(e).getIn(c()(n=["paths"]).call(n,i()(t)),Object(P.fromJS)({})),o=e.getIn(c()(r=["meta","paths"]).call(r,i()(t)),Object(P.fromJS)({})),s=Ae(e,t),u=a.get("parameters")||new P.List,l=o.get("consumes_value")?o.get("consumes_value"):Ce(u,"file")?"multipart/form-data":Ce(u,"formData")?"application/x-www-form-urlencoded":void 0;return Object(P.fromJS)({requestContentType:l,responseContentType:s})}function Ae(e,t){var n,r;t=t||[];var a=z(e).getIn(c()(n=["paths"]).call(n,i()(t)),null);if(null!==a){var o=e.getIn(c()(r=["meta","paths"]).call(r,i()(t),["produces_value"]),null),s=a.getIn(["produces",0],null);return o||s||"application/json"}}function ke(e,t){var n;t=t||[];var r=z(e),o=r.getIn(c()(n=["paths"]).call(n,i()(t)),null);if(null!==o){var s=t,u=a()(s,1)[0],l=o.get("produces",null),p=r.getIn(["paths",u,"produces"],null),f=r.getIn(["produces"],null);return l||p||f}}function Ie(e,t){var n;t=t||[];var r=z(e),o=r.getIn(c()(n=["paths"]).call(n,i()(t)),null);if(null!==o){var s=t,u=a()(s,1)[0],l=o.get("consumes",null),p=r.getIn(["paths",u,"consumes"],null),f=r.getIn(["consumes"],null);return l||p||f}}var Pe=function(e,t,n){var r=e.get("url").match(/^([a-z][a-z0-9+\-.]*):/),a=A()(r)?r[1]:null;return e.getIn(["scheme",t,n])||e.getIn(["scheme","_defaultScheme"])||a||""},Te=function(e,t,n){var r;return h()(r=["http","https"]).call(r,Pe(e,t,n))>-1},Re=function(e,t){var n;t=t||[];var r=e.getIn(c()(n=["meta","paths"]).call(n,i()(t),["parameters"]),Object(P.fromJS)([])),a=!0;return f()(r).call(r,(function(e){var t=e.get("errors");t&&t.count()&&(a=!1)})),a},Ne=function(e,t){var n,r,a={requestBody:!1,requestContentType:{}},o=e.getIn(c()(n=["resolvedSubtrees","paths"]).call(n,i()(t),["requestBody"]),Object(P.fromJS)([]));return o.size<1||(o.getIn(["required"])&&(a.requestBody=o.getIn(["required"])),f()(r=o.getIn(["content"]).entrySeq()).call(r,(function(e){var t=e[0];if(e[1].getIn(["schema","required"])){var n=e[1].getIn(["schema","required"]).toJS();a.requestContentType[t]=n}}))),a},Me=function(e,t,n,r){var a;if((n||r)&&n===r)return!0;var o=e.getIn(c()(a=["resolvedSubtrees","paths"]).call(a,i()(t),["requestBody","content"]),Object(P.fromJS)([]));if(o.size<2||!n||!r)return!1;var s=o.getIn([n,"schema","properties"],Object(P.fromJS)([])),u=o.getIn([r,"schema","properties"],Object(P.fromJS)([]));return!!s.equals(u)};function De(e){return P.Map.isMap(e)?e:new P.Map}},function(e,t){e.exports=require("url-parse")},function(e,t,n){e.exports=n(742)},function(e,t){e.exports=!0},function(e,t,n){var r=n(190),a=n(60).f,o=n(59),i=n(48),s=n(417),c=n(36)("toStringTag");e.exports=function(e,t,n,u){if(e){var l=n?e:e.prototype;i(l,c)||a(l,c,{configurable:!0,value:t}),u&&!r&&o(l,"toString",s)}}},function(e,t,n){"use strict";var r=n(291).charAt,a=n(69),o=n(191),i="String Iterator",s=a.set,c=a.getterFor(i);o(String,"String",(function(e){s(this,{type:i,string:String(e),index:0})}),(function(){var e,t=c(this),n=t.string,a=t.index;return a>=n.length?{value:void 0,done:!0}:(e=r(n,a),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){e.exports=n(528)},function(e,t,n){e.exports=n(620)},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_LAYOUT",(function(){return a})),n.d(t,"UPDATE_FILTER",(function(){return o})),n.d(t,"UPDATE_MODE",(function(){return i})),n.d(t,"SHOW",(function(){return s})),n.d(t,"updateLayout",(function(){return c})),n.d(t,"updateFilter",(function(){return u})),n.d(t,"show",(function(){return l})),n.d(t,"changeMode",(function(){return p}));var r=n(5),a="layout_update_layout",o="layout_update_filter",i="layout_update_mode",s="layout_show";function c(e){return{type:a,payload:e}}function u(e){return{type:o,payload:e}}function l(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e=Object(r.w)(e),{type:s,payload:{thing:e,shown:t}}}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=Object(r.w)(e),{type:i,payload:{thing:e,mode:t}}}},function(e,t,n){var r=n(336),a=n(128),o=n(152),i=n(47),s=n(99),c=n(153),u=n(127),l=n(202),p=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(i(e)||"string"==typeof e||"function"==typeof e.splice||c(e)||l(e)||o(e)))return!e.length;var t=a(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(p.call(e,n))return!1;return!0}},function(e,t){e.exports=require("react-syntax-highlighter")},function(e,t,n){var r=n(44),a=n(138),o=n(90),i=n(58),s=n(140),c=n(48),u=n(282),l=Object.getOwnPropertyDescriptor;t.f=r?l:function(e,t){if(e=i(e),t=s(t,!0),u)try{return l(e,t)}catch(e){}if(c(e,t))return o(!a.f.call(e,t),e[t])}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(67);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,a){return e.call(t,n,r,a)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r,a=n(46),o=n(183),i=n(186),s=n(123),c=n(287),u=n(178),l=n(144),p=l("IE_PROTO"),f=function(){},d=function(e){return"<script>"+e+"</"+"script>"},h=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;h=r?function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",c.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F);for(var n=i.length;n--;)delete h.prototype[i[n]];return h()};s[p]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f.prototype=a(e),n=new f,f.prototype=null,n[p]=e):n=h(),void 0===t?n:o(n,t)}},function(e,t,n){var r=n(59);e.exports=function(e,t,n,a){a&&a.enumerable?e[t]=n:r(e,t,n)}},function(e,t){e.exports={}},function(e,t,n){"use strict";var r=n(34);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t,n){var r=n(105),a=n(535),o=n(536),i=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?a(e):o(e)}},function(e,t,n){var r=n(553),a=n(556);e.exports=function(e,t){var n=a(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(335),a=n(336),o=n(99);e.exports=function(e){return o(e)?r(e):a(e)}},function(e,t,n){var r=n(55),a=n(203);e.exports=function(e){return null!=e&&a(e.length)&&!r(e)}},function(e,t,n){var r=n(46),a=n(310),o=n(68),i=n(91),s=n(126),c=n(309),u=function(e,t){this.stopped=e,this.result=t};e.exports=function(e,t,n){var l,p,f,d,h,m,v,g=n&&n.that,y=!(!n||!n.AS_ENTRIES),b=!(!n||!n.IS_ITERATOR),E=!(!n||!n.INTERRUPTED),x=i(t,g,1+y+E),S=function(e){return l&&c(l),new u(!0,e)},w=function(e){return y?(r(e),E?x(e[0],e[1],S):x(e[0],e[1])):E?x(e,S):x(e)};if(b)l=e;else{if("function"!=typeof(p=s(e)))throw TypeError("Target is not iterable");if(a(p)){for(f=0,d=o(e.length);d>f;f++)if((h=w(e[f]))&&h instanceof u)return h;return new u(!1)}l=p.call(e)}for(m=l.next;!(v=m.call(l)).done;){try{h=w(v.value)}catch(e){throw c(l),e}if("object"==typeof h&&h&&h instanceof u)return h}return new u(!1)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){e.exports=n(753)},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return l}));var r=n(12),a=n.n(r),o=n(4),i=n.n(o),s=n(384),c=n.n(s),u=[n(215),n(216)];function l(e){var t,n={jsSpec:{}},r=c()(u,(function(e,t){try{var r=t.transform(e,n);return a()(r).call(r,(function(e){return!!e}))}catch(t){return console.error("Transformer error:",t),e}}),e);return i()(t=a()(r).call(r,(function(e){return!!e}))).call(t,(function(e){return!e.get("line")&&e.get("path"),e}))}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(64).Symbol;e.exports=r},function(e,t,n){var r=n(47),a=n(206),o=n(600),i=n(77);e.exports=function(e,t){return r(e)?e:a(e,t)?[e]:o(i(e))}},function(e,t,n){var r=n(146);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){var r=n(157),a=n(361);e.exports=function(e,t,n,o){var i=!n;n||(n={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=o?o(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),i?a(n,u,l):r(n,u,l)}return n}},function(e,t){e.exports=require("serialize-error")},function(e,t,n){"use strict";n.r(t),n.d(t,"sampleFromSchemaGeneric",(function(){return j})),n.d(t,"inferSchema",(function(){return O})),n.d(t,"createXMLExample",(function(){return C})),n.d(t,"sampleFromSchema",(function(){return _})),n.d(t,"memoizedCreateXMLExample",(function(){return A})),n.d(t,"memoizedSampleFromSchema",(function(){return k}));var r=n(19),a=n.n(r),o=n(2),i=n.n(o),s=n(14),c=n.n(s),u=n(13),l=n.n(u),p=n(4),f=n.n(p),d=n(5),h=n(380),m=n.n(h),v=n(270),g=n.n(v),y=n(87),b=n.n(y),E={string:function(){return"string"},string_email:function(){return"[email protected]"},"string_date-time":function(){return(new Date).toISOString()},string_date:function(){return(new Date).toISOString().substring(0,10)},string_uuid:function(){return"3fa85f64-5717-4562-b3fc-2c963f66afa6"},string_hostname:function(){return"example.com"},string_ipv4:function(){return"198.51.100.42"},string_ipv6:function(){return"2001:0db8:5b96:0000:0000:426f:8e17:642a"},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},x=function(e){var t,n=e=Object(d.A)(e),r=n.type,a=n.format,o=E[i()(t="".concat(r,"_")).call(t,a)]||E[r];return Object(d.s)(o)?o(e):"Unknown Type: "+e.type},S=function(e){return Object(d.e)(e,"$$ref",(function(e){return"string"==typeof e&&c()(e).call(e,"#")>-1}))},w=function(e,t){return void 0===t.example&&void 0!==e.example&&(t.example=e.example),void 0===t.default&&void 0!==e.default&&(t.default=e.default),void 0===t.enum&&void 0!==e.enum&&(t.enum=e.enum),void 0===t.xml&&void 0!==e.xml&&(t.xml=e.xml),void 0===t.type&&void 0!==e.type&&(t.type=e.type),t},j=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=Object(d.A)(t);var s=void 0!==r||void 0!==t.example||t&&void 0!==t.default,u=!s&&t&&t.oneOf&&t.oneOf.length>0,p=!s&&t&&t.anyOf&&t.anyOf.length>0;if(!s&&(u||p)){var h=Object(d.A)(u?t.oneOf[0]:t.anyOf[0]);if(w(h,t),!t.xml&&h.xml&&(t.xml=h.xml),void 0!==t.example&&void 0!==h.example)s=!0;else if(h.properties){t.properties||(t.properties={});var m=Object(d.A)(h.properties);for(var v in m){var g;if(m.hasOwnProperty(v))if(!m[v]||!m[v].deprecated)if(!m[v]||!m[v].readOnly||n.includeReadOnly)if(!m[v]||!m[v].writeOnly||n.includeWriteOnly)if(!t.properties[v])t.properties[v]=m[v],!h.required&&l()(h.required)&&-1!==c()(g=h.required).call(g,v)&&(t.required?t.required.push(v):t.required=[v])}}}var y,E={},j=t,O=j.xml,C=j.type,_=j.example,A=j.properties,k=j.additionalProperties,I=j.items,P=n.includeReadOnly,T=n.includeWriteOnly,R=O=O||{},N=R.name,M=R.prefix,D=R.namespace,q={};if(o&&(y=(M?M+":":"")+(N=N||"notagname"),D)){var B=M?"xmlns:"+M:"xmlns";E[B]=D}if(o&&(q[y]=[]),t&&!C)if(A||k)C="object";else if(I)C="array";else if(!s&&!t.enum)return;var L,U,V=Object(d.A)(A);if(L=o?function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(t&&V[r]){if(V[r].xml=V[r].xml||{},V[r].xml.attribute){var s=l()(V[r].enum)?V[r].enum[0]:void 0,c=V[r].example,u=V[r].default;return void(E[V[r].xml.name||r]=void 0!==c?c:void 0!==u?u:void 0!==s?s:x(V[r]))}V[r].xml.name=V[r].xml.name||r}else V[r]||!1===k||(V[r]={xml:{name:r}});var p,f=e(t&&V[r]||void 0,n,a,o);l()(f)?q[y]=i()(p=q[y]).call(p,f):q[y].push(f)}:function(t,r){q[t]=e(V[t],n,r,o)},s){var z;if(z=S(void 0!==r?r:void 0!==_?_:t.default),!o){if("number"==typeof z&&"string"===C)return"".concat(z);if("string"!=typeof z||"string"===C)return z;try{return JSON.parse(z)}catch(e){return z}}if(t||(C=l()(z)?"array":a()(z)),"array"===C){if(!l()(z)){if("string"==typeof z)return z;z=[z]}var F=t?t.items:void 0;F&&(F.xml=F.xml||O||{},F.xml.name=F.xml.name||O.name);var J=f()(z).call(z,(function(t){return e(F,n,t,o)}));return O.wrapped?(q[y]=J,b()(E)||q[y].push({_attr:E})):q=J,q}if("object"===C){if("string"==typeof z)return z;for(var W in z)z.hasOwnProperty(W)&&(t&&V[W]&&V[W].readOnly&&!P||t&&V[W]&&V[W].writeOnly&&!T||(!(t&&V[W]&&V[W].xml&&V[W].xml.attribute)||_&&_[W]?t&&V[W]&&V[W].xml&&V[W].xml.attribute?E[V[W].xml.name||W]=_[W]:L(W,z[W]):E[V[W].xml.name||W]=z[W]));return b()(E)||q[y].push({_attr:E}),q}return q[y]=b()(E)?z:[{_attr:E},z],q}if("object"===C){for(var H in V)V.hasOwnProperty(H)&&(V[H]&&V[H].deprecated||V[H]&&V[H].readOnly&&!P||V[H]&&V[H].writeOnly&&!T||L(H));if(!0===k)o?q[y].push({additionalProp:"Anything can be here"}):q.additionalProp1={};else if(k){var $=Object(d.A)(k),Y=e($,n,void 0,o);if(o&&$.xml&&$.xml.name&&"notagname"!==$.xml.name)q[y].push(Y);else for(var K=1;K<4;K++)if(o){var G={};G["additionalProp"+K]=Y.notagname,q[y].push(G)}else q["additionalProp"+K]=Y}return o&&E&&q[y].push({_attr:E}),q}if("array"===C){var Z,X;if(o&&(I.xml=I.xml||t.xml||{},I.xml.name=I.xml.name||O.name),l()(I.anyOf))Z=f()(X=I.anyOf).call(X,(function(t){return e(w(I,t),n,void 0,o)}));else if(l()(I.oneOf)){var Q;Z=f()(Q=I.oneOf).call(Q,(function(t){return e(w(I,t),n,void 0,o)}))}else{if(!(!o||o&&O.wrapped))return e(I,n,void 0,o);Z=[e(I,n,void 0,o)]}return o&&O.wrapped?(q[y]=Z,b()(E)||q[y].push({_attr:E}),q):Z}if(t&&l()(t.enum))U=Object(d.w)(t.enum)[0];else{if(!t)return;U=x(t)}if("file"!==C)return o?(q[y]=b()(E)?U:[{_attr:E},U],q):U},O=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},C=function(e,t,n){var r=j(e,t,n,!0);if(r)return"string"==typeof r?r:m()(r,{declaration:!0,indent:"\t"})},_=function(e,t,n){return j(e,t,n,!1)},A=g()(C),k=g()(_)},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_CONFIGS",(function(){return o})),n.d(t,"TOGGLE_CONFIGS",(function(){return i})),n.d(t,"update",(function(){return s})),n.d(t,"toggle",(function(){return c})),n.d(t,"loaded",(function(){return u}));var r=n(3),a=n.n(r),o="configs_update",i="configs_toggle";function s(e,t){return{type:o,payload:a()({},e,t)}}function c(e){return{type:i,payload:e}}var u=function(){return function(e){var t=e.getConfigs,n=e.authActions;if(t().persistAuthorization){var r=localStorage.getItem("authorized");r&&n.restoreAuthorization({authorized:JSON.parse(r)})}}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(12),a=n.n(r),o=n(35),i=n.n(o),s=n(1),c=n.n(s),u=c.a.Set.of("type","format","items","default","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","minItems","uniqueItems","enum","multipleOf");function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.isOAS3;if(!c.a.Map.isMap(e))return{schema:c.a.Map(),parameterContentMediaType:null};if(!n)return"body"===e.get("in")?{schema:e.get("schema",c.a.Map()),parameterContentMediaType:null}:{schema:a()(e).call(e,(function(e,t){return i()(u).call(u,t)})),parameterContentMediaType:null};if(e.get("content")){var r=e.get("content",c.a.Map({})).keySeq(),o=r.first();return{schema:e.getIn(["content",o,"schema"],c.a.Map()),parameterContentMediaType:o}}return{schema:e.get("schema",c.a.Map()),parameterContentMediaType:null}}},function(e,t){e.exports=require("fast-json-patch")},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(115);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){"use strict";var r=n(140),a=n(60),o=n(90);e.exports=function(e,t,n){var i=r(t);i in e?a.f(e,i,o(0,n)):e[i]=n}},function(e,t,n){var r=n(115),a=n(38);e.exports="process"==r(a.process)},function(e,t,n){var r,a,o=n(38),i=n(142),s=o.process,c=s&&s.versions,u=c&&c.v8;u?a=(r=u.split("."))[0]+r[1]:i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(a=r[1]),e.exports=a&&+a},function(e,t,n){var r=n(34),a=n(36),o=n(120),i=a("species");e.exports=function(e){return o>=51||!r((function(){var t=[];return(t.constructor={})[i]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){var r=n(286),a=n(186);e.exports=Object.keys||function(e){return r(e,a)}},function(e,t){e.exports={}},function(e,t,n){var r=n(48),a=n(61),o=n(144),i=n(294),s=o("IE_PROTO"),c=Object.prototype;e.exports=i?Object.getPrototypeOf:function(e){return e=a(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?c:null}},function(e,t,n){"use strict";var r=n(58),a=n(193),o=n(94),i=n(69),s=n(191),c="Array Iterator",u=i.set,l=i.getterFor(c);e.exports=s(Array,"Array",(function(e,t){u(this,{type:c,target:r(e),index:0,kind:t})}),(function(){var e=l(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),o.Arguments=o.Array,a("keys"),a("values"),a("entries")},function(e,t,n){var r=n(74),a=n(94),o=n(36)("iterator");e.exports=function(e){if(null!=e)return e[o]||e["@@iterator"]||a[r(e)]}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){var r=n(594),a=n(197),o=n(595),i=n(596),s=n(597),c=n(96),u=n(327),l="[object Map]",p="[object Promise]",f="[object Set]",d="[object WeakMap]",h="[object DataView]",m=u(r),v=u(a),g=u(o),y=u(i),b=u(s),E=c;(r&&E(new r(new ArrayBuffer(1)))!=h||a&&E(new a)!=l||o&&E(o.resolve())!=p||i&&E(new i)!=f||s&&E(new s)!=d)&&(E=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case m:return h;case v:return l;case g:return p;case y:return f;case b:return d}return t}),e.exports=E},function(e,t,n){var r=n(93);e.exports=function(e,t,n){for(var a in t)n&&n.unsafe&&e[a]?e[a]=t[a]:r(e,a,t[a],n);return e}},function(e,t,n){"use strict";var r=n(67),a=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"parseYamlConfig",(function(){return o}));var r=n(65),a=n.n(r),o=function(e,t){try{return a.a.safeLoad(e)}catch(e){return t&&t.errActions.newThrownErr(new Error(e)),{}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"getDefaultRequestBodyValue",(function(){return b}));var r=n(16),a=n.n(r),o=n(4),i=n.n(o),s=n(14),c=n.n(s),u=n(35),l=n.n(u),p=n(2),f=n.n(p),d=n(13),h=n.n(d),m=n(0),v=n.n(m),g=(n(11),n(27),n(1)),y=n(5),b=function(e,t,n){var r=e.getIn(["content",t]),a=r.get("schema").toJS(),o=void 0!==r.get("examples"),i=r.get("example"),s=o?r.getIn(["examples",n,"value"]):i,c=Object(y.o)(a,t,{includeWriteOnly:!0},s);return Object(y.J)(c)};t.default=function(e){var t=e.userHasEditedBody,n=e.requestBody,r=e.requestBodyValue,o=e.requestBodyInclusionSetting,s=e.requestBodyErrors,u=e.getComponent,p=e.getConfigs,d=e.specSelectors,m=e.fn,E=e.contentType,x=e.isExecute,S=e.specPath,w=e.onChange,j=e.onChangeIncludeEmpty,O=e.activeExamplesKey,C=e.updateActiveExamplesKey,_=e.setRetainRequestBodyValueFlag,A=function(e){var t={key:e,shouldDispatchInit:!1,defaultValue:!0};return"no value"===o.get(e,"no value")&&(t.shouldDispatchInit=!0),t},k=u("Markdown",!0),I=u("modelExample"),P=u("RequestBodyEditor"),T=u("highlightCode"),R=u("ExamplesSelectValueRetainer"),N=u("Example"),M=u("ParameterIncludeEmpty"),D=p().showCommonExtensions,q=n&&n.get("description")||null,B=n&&n.get("content")||new g.OrderedMap;E=E||B.keySeq().first()||"";var L=B.get(E,Object(g.OrderedMap)()),U=L.get("schema",Object(g.OrderedMap)()),V=L.get("examples",null),z=null==V?void 0:i()(V).call(V,(function(e,t){var r,a=null===(r=e)||void 0===r?void 0:r.get("value",null);return a&&(e=e.set("value",b(n,E,t),a)),e}));if(s=g.List.isList(s)?s:Object(g.List)(),!L.size)return null;var F="object"===L.getIn(["schema","type"]);if("application/octet-stream"===E||0===c()(E).call(E,"image/")||0===c()(E).call(E,"audio/")||0===c()(E).call(E,"video/")){var J=u("Input");return x?v.a.createElement(J,{type:"file",onChange:function(e){w(e.target.files[0])}}):v.a.createElement("i",null,"Example values are not available for ",v.a.createElement("code",null,"application/octet-stream")," media types.")}if(F&&("application/x-www-form-urlencoded"===E||0===c()(E).call(E,"multipart/"))&&U.get("properties",Object(g.OrderedMap)()).size>0){var W,H=u("JsonSchemaForm"),$=u("ParameterExt"),Y=U.get("properties",Object(g.OrderedMap)());return r=g.Map.isMap(r)?r:Object(g.OrderedMap)(),v.a.createElement("div",{className:"table-container"},q&&v.a.createElement(k,{source:q}),v.a.createElement("table",null,v.a.createElement("tbody",null,g.Map.isMap(Y)&&i()(W=Y.entrySeq()).call(W,(function(e){var t,n,c=a()(e,2),p=c[0],d=c[1];if(!d.get("readOnly")){var b=D?Object(y.l)(d):null,E=l()(t=U.get("required",Object(g.List)())).call(t,p),S=d.get("type"),O=d.get("format"),C=d.get("description"),_=r.getIn([p,"value"]),I=r.getIn([p,"errors"])||s,P=o.get(p)||!1,T=d.has("default")||d.has("example")||d.hasIn(["items","example"])||d.hasIn(["items","default"]),R=d.has("enum")&&(1===d.get("enum").size||E),N=T||R,q="";"array"!==S||N?N&&(q=Object(y.o)(d,!1,{includeWriteOnly:!0})):q=[],"string"!=typeof q&&"object"===S&&(q=Object(y.J)(q)),"string"==typeof q&&"array"===S&&(q=JSON.parse(q));var B="string"===S&&("binary"===O||"base64"===O);return v.a.createElement("tr",{key:p,className:"parameters","data-property-name":p},v.a.createElement("td",{className:"parameters-col_name"},v.a.createElement("div",{className:E?"parameter__name required":"parameter__name"},p,E?v.a.createElement("span",null," *"):null),v.a.createElement("div",{className:"parameter__type"},S,O&&v.a.createElement("span",{className:"prop-format"},"($",O,")"),D&&b.size?i()(n=b.entrySeq()).call(n,(function(e){var t,n=a()(e,2),r=n[0],o=n[1];return v.a.createElement($,{key:f()(t="".concat(r,"-")).call(t,o),xKey:r,xVal:o})})):null),v.a.createElement("div",{className:"parameter__deprecated"},d.get("deprecated")?"deprecated":null)),v.a.createElement("td",{className:"parameters-col_description"},v.a.createElement(k,{source:C}),x?v.a.createElement("div",null,v.a.createElement(H,{fn:m,dispatchInitialValue:!B,schema:d,description:p,getComponent:u,value:void 0===_?q:_,required:E,errors:I,onChange:function(e){w(e,[p])}}),E?null:v.a.createElement(M,{onChange:function(e){return j(p,e)},isIncluded:P,isIncludedOptions:A(p),isDisabled:h()(_)?0!==_.length:!Object(y.q)(_)})):null))}})))))}var K=b(n,E,O);return v.a.createElement("div",null,q&&v.a.createElement(k,{source:q}),z?v.a.createElement(R,{userHasEditedBody:t,examples:z,currentKey:O,currentUserInputValue:r,onSelect:function(e){C(e)},updateValue:w,defaultToFirstExample:!0,getComponent:u,setRetainRequestBodyValueFlag:_}):null,x?v.a.createElement("div",null,v.a.createElement(P,{value:r,errors:s,defaultValue:K,onChange:w,getComponent:u})):v.a.createElement(I,{getComponent:u,getConfigs:p,specSelectors:d,expandDepth:1,isExecute:x,schema:L.get("schema"),specPath:S.push("content",E),example:v.a.createElement(T,{className:"body-param__example",getConfigs:p,value:Object(y.J)(r)||K}),includeWriteOnly:!0}),z?v.a.createElement(N,{example:z.get(O),getComponent:u,getConfigs:p}):null)}},function(e,t,n){e.exports=n(524)},function(e,t,n){"use strict";n.r(t),n.d(t,"makeMappedContainer",(function(){return A})),n.d(t,"render",(function(){return k})),n.d(t,"getComponent",(function(){return T}));var r=n(19),a=n.n(r),o=n(28),i=n.n(o),s=n(6),c=n.n(s),u=n(7),l=n.n(u),p=n(8),f=n.n(p),d=n(9),h=n.n(d),m=n(22),v=n.n(m),g=n(17),y=n.n(g),b=n(0),E=n.n(b),x=n(386),S=n.n(x),w=n(274),j=n(387),O=n.n(j),C=function(e,t,n){var r=function(e,t){return function(n){f()(a,n);var r=h()(a);function a(){return c()(this,a),r.apply(this,arguments)}return l()(a,[{key:"render",value:function(){return E.a.createElement(t,i()({},e(),this.props,this.context))}}]),a}(b.Component)}(e,t),a=Object(w.connect)((function(n,r){var a=v()({},r,e());return(t.prototype.mapStateToProps||function(e){return{state:e}})(n,a)}))(r);return n?function(e,t){return function(n){f()(a,n);var r=h()(a);function a(){return c()(this,a),r.apply(this,arguments)}return l()(a,[{key:"render",value:function(){return E.a.createElement(w.Provider,{store:e},E.a.createElement(t,i()({},this.props,this.context)))}}]),a}(b.Component)}(n,a):a},_=function(e,t,n,r){for(var a in t){var o=t[a];"function"==typeof o&&o(n[a],r[a],e())}},A=function(e,t,n,r,a,o){return function(t){f()(i,t);var r=h()(i);function i(t,n){var a;return c()(this,i),a=r.call(this,t,n),_(e,o,t,{}),a}return l()(i,[{key:"componentWillReceiveProps",value:function(t){_(e,o,t,this.props)}},{key:"render",value:function(){var e=O()(this.props,o?y()(o):[]),t=n(a,"root");return E.a.createElement(t,e)}}]),i}(b.Component)},k=function(e,t,n,r,a){var o=n(e,t,r,"App","root");S.a.render(E.a.createElement(o,null),a)},I=function(e){var t=e.name;return E.a.createElement("div",{className:"fallback"},"😱 ",E.a.createElement("i",null,"Could not render ","t"===t?"this component":t,", see the console."))},P=function(e){var t=function(e){return!(e.prototype&&e.prototype.isReactComponent)}(e)?function(e){return function(t){f()(r,t);var n=h()(r);function r(){return c()(this,r),n.apply(this,arguments)}return l()(r,[{key:"render",value:function(){return e(this.props)}}]),r}(b.Component)}(e):e,n=t.prototype.render;return t.prototype.render=function(){try{for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return n.apply(this,r)}catch(e){return console.error(e),E.a.createElement(I,{error:e,name:t.name})}},t},T=function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};if("string"!=typeof r)throw new TypeError("Need a string, to fetch a component. Was given a "+a()(r));var s=n(r);return s?o?"root"===o?C(e,s,t()):C(e,P(s)):P(s):(i.failSilently||e().log.warn("Could not find component:",r),null)}},function(e,t,n){"use strict";n.r(t),n.d(t,"setHash",(function(){return r}));var r=function(e){return e?history.pushState(null,null,"#".concat(e)):window.location.hash=""}},function(e,t){e.exports=require("redux")},function(e,t,n){e.exports=n(413)},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,o=a&&!r.call({1:2},1);t.f=o?function(e){var t=a(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(34),a=n(115),o="".split;e.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?o.call(e,""):Object(e)}:Object},function(e,t,n){var r=n(40);e.exports=function(e,t){if(!r(e))return e;var n,a;if(t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;if("function"==typeof(n=e.valueOf)&&!r(a=n.call(e)))return a;if(!t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;throw TypeError("Can't convert object to primitive value")}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++n+r).toString(36)}},function(e,t,n){var r=n(62);e.exports=r("navigator","userAgent")||""},function(e,t){},function(e,t,n){var r=n(180),a=n(141),o=r("keys");e.exports=function(e){return o[e]||(o[e]=a(e))}},function(e,t,n){var r=n(488),a=n(306),o=n(303);e.exports=function(e,t){var n;if(e){if("string"==typeof e)return o(e,t);var i=r(n=Object.prototype.toString.call(e)).call(n,8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?a(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?o(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(96),a=n(76);e.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(97)(Object,"create");e.exports=r},function(e,t,n){var r=n(561),a=n(562),o=n(563),i=n(564),s=n(565);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=a,c.prototype.get=o,c.prototype.has=i,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(101);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t,n){var r=n(567);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){var r=n(572),a=n(599),o=n(207),i=n(47),s=n(604);e.exports=function(e){return"function"==typeof e?e:null==e?o:"object"==typeof e?i(e)?a(e[0],e[1]):r(e):s(e)}},function(e,t,n){var r=n(590),a=n(76),o=Object.prototype,i=o.hasOwnProperty,s=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return a(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},function(e,t,n){(function(e){var r=n(64),a=n(591),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===o?r.Buffer:void 0,c=(s?s.isBuffer:void 0)||a;e.exports=c}).call(this,n(201)(e))},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,n){var r=n(106),a=n(107);e.exports=function(e,t){for(var n=0,o=(t=r(t,e)).length;null!=e&&n<o;)e=e[a(t[n++])];return n&&n==o?e:void 0}},function(e,t){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},function(e,t,n){var r=n(361),a=n(101),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var i=e[t];o.call(e,t)&&a(i,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(123),a=n(40),o=n(48),i=n(60).f,s=n(141),c=n(737),u=s("meta"),l=0,p=Object.isExtensible||function(){return!0},f=function(e){i(e,u,{value:{objectID:"O"+ ++l,weakData:{}}})},d=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,u)){if(!p(e))return"F";if(!t)return"E";f(e)}return e[u].objectID},getWeakData:function(e,t){if(!o(e,u)){if(!p(e))return!0;if(!t)return!1;f(e)}return e[u].weakData},onFreeze:function(e){return c&&d.REQUIRED&&p(e)&&!o(e,u)&&f(e),e}};r[u]=!0},function(e,t,n){var r=n(364),a=n(679);function o(t){return e.exports=o=r?a:function(e){return e.__proto__||a(e)},e.exports.default=e.exports,e.exports.__esModule=!0,o(t)}e.exports=o,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(502)},function(e,t,n){var r=n(571)(n(607));e.exports=r},function(e,t,n){e.exports=n(660)},function(e,t,n){var r=n(96),a=n(47),o=n(76);e.exports=function(e){return"string"==typeof e||!a(e)&&o(e)&&"[object String]"==r(e)}},function(e,t,n){e.exports=n(720)},function(e,t,n){var r=n(722),a=n(369)((function(e,t){return null==e?{}:r(e,t)}));e.exports=a},function(e,t){e.exports=require("buffer")},function(e,t,n){var r=n(157),a=n(109),o=n(740),i=n(99),s=n(127),c=n(98),u=Object.prototype.hasOwnProperty,l=o((function(e,t){if(s(t)||i(t))a(t,c(t),e);else for(var n in t)u.call(t,n)&&r(e,n,t[n])}));e.exports=l},function(e,t){e.exports=require("btoa")},function(e,t,n){e.exports=n(747)},function(e,t,n){"use strict";n.d(t,"a",(function(){return _}));var r=n(19),a=n.n(r),o=n(6),i=n.n(o),s=n(7),c=n.n(s),u=n(10),l=n.n(u),p=n(8),f=n.n(p),d=n(9),h=n.n(d),m=n(3),v=n.n(m),g=n(17),y=n.n(g),b=n(2),E=n.n(b),x=n(0),S=n.n(x),w=n(79),j=n.n(w),O=(n(11),n(5)),C=n(26),_=function(e){f()(n,e);var t=h()(n);function n(e,r){var a;i()(this,n),a=t.call(this,e,r),v()(l()(a),"getDefinitionUrl",(function(){var e=a.props.specSelectors;return new j.a(e.url(),C.a.location).toString()}));var o=(0,e.getConfigs)().validatorUrl;return a.state={url:a.getDefinitionUrl(),validatorUrl:void 0===o?"https://validator.swagger.io/validator":o},a}return c()(n,[{key:"componentWillReceiveProps",value:function(e){var t=(0,e.getConfigs)().validatorUrl;this.setState({url:this.getDefinitionUrl(),validatorUrl:void 0===t?"https://validator.swagger.io/validator":t})}},{key:"render",value:function(){var e,t,n=(0,this.props.getConfigs)().spec,r=Object(O.G)(this.state.validatorUrl);return"object"===a()(n)&&y()(n).length?null:this.state.url&&Object(O.F)(this.state.validatorUrl)&&Object(O.F)(this.state.url)?S.a.createElement("span",{className:"float-right"},S.a.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:E()(e="".concat(r,"/debug?url=")).call(e,encodeURIComponent(this.state.url))},S.a.createElement(A,{src:E()(t="".concat(r,"?url=")).call(t,encodeURIComponent(this.state.url)),alt:"Online validator badge"}))):null}}]),n}(S.a.Component),A=function(e){f()(n,e);var t=h()(n);function n(e){var r;return i()(this,n),(r=t.call(this,e)).state={loaded:!1,error:!1},r}return c()(n,[{key:"componentDidMount",value:function(){var e=this,t=new Image;t.onload=function(){e.setState({loaded:!0})},t.onerror=function(){e.setState({error:!0})},t.src=this.props.src}},{key:"componentWillReceiveProps",value:function(e){var t=this;if(e.src!==this.props.src){var n=new Image;n.onload=function(){t.setState({loaded:!0})},n.onerror=function(){t.setState({error:!0})},n.src=e.src}}},{key:"render",value:function(){return this.state.error?S.a.createElement("img",{alt:"Error"}):this.state.loaded?S.a.createElement("img",{src:this.props.src,alt:this.props.alt}):null}}]),n}(S.a.Component)},function(e,t){e.exports=require("react-copy-to-clipboard")},function(e,t,n){"use strict";n.d(t,"a",(function(){return P}));var r=n(28),a=n.n(r),o=n(6),i=n.n(o),s=n(7),c=n.n(s),u=n(10),l=n.n(u),p=n(8),f=n.n(p),d=n(9),h=n.n(d),m=n(3),v=n.n(m),g=n(2),y=n.n(g),b=n(14),E=n.n(b),x=n(4),S=n.n(x),w=n(0),j=n.n(w),O=n(410),C=n.n(O),_=n(27),A=n.n(_),k=n(11),I=n.n(k),P=function(e){f()(r,e);var t=h()(r);function r(){var e,n;i()(this,r);for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return n=t.call.apply(t,y()(e=[this]).call(e,o)),v()(l()(n),"getModelName",(function(e){return-1!==E()(e).call(e,"#/definitions/")?e.replace(/^.*#\/definitions\//,""):-1!==E()(e).call(e,"#/components/schemas/")?e.replace(/^.*#\/components\/schemas\//,""):void 0})),v()(l()(n),"getRefSchema",(function(e){return n.props.specSelectors.findDefinition(e)})),n}return c()(r,[{key:"render",value:function(){var e=this.props,t=e.getComponent,r=e.getConfigs,o=e.specSelectors,i=e.schema,s=e.required,c=e.name,u=e.isRef,l=e.specPath,p=e.displayName,f=e.includeReadOnly,d=e.includeWriteOnly,h=t("ObjectModel"),m=t("ArrayModel"),v=t("PrimitiveModel"),g="object",y=i&&i.get("$$ref");if(!c&&y&&(c=this.getModelName(y)),!i&&y&&(i=this.getRefSchema(c)),!i)return j.a.createElement("span",{className:"model model-title"},j.a.createElement("span",{className:"model-title__text"},p||c),j.a.createElement("img",{src:n(375),height:"20px",width:"20px"}));var b=o.isOAS3()&&i.get("deprecated");switch(u=void 0!==u?u:!!y,g=i&&i.get("type")||g){case"object":return j.a.createElement(h,a()({className:"object"},this.props,{specPath:l,getConfigs:r,schema:i,name:c,deprecated:b,isRef:u,includeReadOnly:f,includeWriteOnly:d}));case"array":return j.a.createElement(m,a()({className:"array"},this.props,{getConfigs:r,schema:i,name:c,deprecated:b,required:s,includeReadOnly:f,includeWriteOnly:d}));case"string":case"number":case"integer":case"boolean":default:return j.a.createElement(v,a()({},this.props,{getComponent:t,getConfigs:r,schema:i,name:c,deprecated:b,required:s}))}}}]),r}(C.a);v()(P,"propTypes",{schema:S()(A.a).isRequired,getComponent:I.a.func.isRequired,getConfigs:I.a.func.isRequired,specSelectors:I.a.object.isRequired,name:I.a.string,displayName:I.a.string,isRef:I.a.bool,required:I.a.bool,expandDepth:I.a.number,depth:I.a.number,specPath:A.a.list.isRequired,includeReadOnly:I.a.bool,includeWriteOnly:I.a.bool})},function(e,t){e.exports=require("remarkable")},function(e,t,n){"use strict";n.d(t,"b",(function(){return y}));var r=n(0),a=n.n(r),o=(n(11),n(173)),i=n(411),s=n.n(i),c=/www|@|\:\/\//;function u(e){return/^<\/a\s*>/i.test(e)}function l(){var e=[],t=new s.a({stripPrefix:!1,url:!0,email:!0,replaceFn:function(t){switch(t.getType()){case"url":e.push({text:t.matchedText,url:t.getUrl()});break;case"email":e.push({text:t.matchedText,url:"mailto:"+t.getEmail().replace(/^mailto:/i,"")})}return!1}});return{links:e,autolinker:t}}function p(e){var t,n,r,a,o,i,s,p,f,d,h,m,v,g,y=e.tokens,b=null;for(n=0,r=y.length;n<r;n++)if("inline"===y[n].type)for(h=0,t=(a=y[n].children).length-1;t>=0;t--)if("link_close"!==(o=a[t]).type){if("htmltag"===o.type&&(g=o.content,/^<a[>\s]/i.test(g)&&h>0&&h--,u(o.content)&&h++),!(h>0)&&"text"===o.type&&c.test(o.content)){if(b||(m=(b=l()).links,v=b.autolinker),i=o.content,m.length=0,v.link(i),!m.length)continue;for(s=[],d=o.level,p=0;p<m.length;p++)e.inline.validateLink(m[p].url)&&((f=i.indexOf(m[p].text))&&s.push({type:"text",content:i.slice(0,f),level:d}),s.push({type:"link_open",href:m[p].url,title:"",level:d++}),s.push({type:"text",content:m[p].text,level:d}),s.push({type:"link_close",level:--d}),i=i.slice(f+m[p].text.length));i.length&&s.push({type:"text",content:i,level:d}),y[n].children=a=[].concat(a.slice(0,t),s,a.slice(t+1))}}else for(t--;a[t].level!==o.level&&"link_open"!==a[t].type;)t--}function f(e){e.core.ruler.push("linkify",p)}var d=n(176),h=n.n(d),m=n(54),v=n.n(m);function g(e){var t=e.source,n=e.className,r=void 0===n?"":n,i=e.getConfigs;if("string"!=typeof t)return null;var s=new o.Remarkable({html:!0,typographer:!0,breaks:!0,linkTarget:"_blank"}).use(f);s.core.ruler.disable(["replacements","smartquotes"]);var c=i().useUnsafeMarkdown,u=s.render(t),l=y(u,{useUnsafeMarkdown:c});return t&&u&&l?a.a.createElement("div",{className:v()(r,"markdown"),dangerouslySetInnerHTML:{__html:l}}):null}h.a.addHook&&h.a.addHook("beforeSanitizeElements",(function(e){return e.href&&e.setAttribute("rel","noopener noreferrer"),e})),g.defaultProps={getConfigs:function(){return{useUnsafeMarkdown:!1}}};t.a=g;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.useUnsafeMarkdown,r=void 0!==n&&n,a=r,o=r?[]:["style","class"];return r&&!y.hasWarnedAboutDeprecation&&(console.warn("useUnsafeMarkdown display configuration parameter is deprecated since >3.26.0 and will be removed in v4.0.0."),y.hasWarnedAboutDeprecation=!0),h.a.sanitize(e,{ADD_ATTR:["target"],FORBID_TAGS:["style"],ALLOW_DATA_ATTR:a,FORBID_ATTR:o})}y.hasWarnedAboutDeprecation=!1},function(e,t){e.exports=require("qs")},function(e,t){e.exports=require("dompurify")},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(38),a=n(40),o=r.document,i=a(o)&&a(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(40),a=n(116),o=n(36)("species");e.exports=function(e,t){var n;return a(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!a(n.prototype)?r(n)&&null===(n=n[o])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r=n(81),a=n(181);(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.9.1",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(38),a=n(415),o="__core-js_shared__",i=r[o]||a(o,{});e.exports=i},function(e,t,n){var r=n(119),a=n(120),o=n(34);e.exports=!!Object.getOwnPropertySymbols&&!o((function(){return!Symbol.sham&&(r?38===a:a>37&&a<41)}))},function(e,t,n){var r=n(44),a=n(60),o=n(46),i=n(122);e.exports=r?Object.defineProperties:function(e,t){o(e);for(var n,r=i(t),s=r.length,c=0;s>c;)a.f(e,n=r[c++],t[n]);return e}},function(e,t,n){var r=n(58),a=n(68),o=n(185),i=function(e){return function(t,n,i){var s,c=r(t),u=a(c.length),l=o(i,u);if(e&&n!=n){for(;u>l;)if((s=c[l++])!=s)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},function(e,t,n){var r=n(117),a=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?a(n+t,0):o(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,n){var r=n(286),a=n(186).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,a)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(36);t.f=r},function(e,t,n){var r={};r[n(36)("toStringTag")]="z",e.exports="[object z]"===String(r)},function(e,t,n){"use strict";var r=n(24),a=n(292),o=n(124),i=n(192),s=n(82),c=n(59),u=n(93),l=n(36),p=n(81),f=n(94),d=n(293),h=d.IteratorPrototype,m=d.BUGGY_SAFARI_ITERATORS,v=l("iterator"),g="keys",y="values",b="entries",E=function(){return this};e.exports=function(e,t,n,l,d,x,S){a(n,t,l);var w,j,O,C=function(e){if(e===d&&P)return P;if(!m&&e in k)return k[e];switch(e){case g:case y:case b:return function(){return new n(this,e)}}return function(){return new n(this)}},_=t+" Iterator",A=!1,k=e.prototype,I=k[v]||k["@@iterator"]||d&&k[d],P=!m&&I||C(d),T="Array"==t&&k.entries||I;if(T&&(w=o(T.call(new e)),h!==Object.prototype&&w.next&&(p||o(w)===h||(i?i(w,h):"function"!=typeof w[v]&&c(w,v,E)),s(w,_,!0,!0),p&&(f[_]=E))),d==y&&I&&I.name!==y&&(A=!0,P=function(){return I.call(this)}),p&&!S||k[v]===P||c(k,v,P),f[t]=P,d)if(j={values:C(y),keys:x?P:C(g),entries:C(b)},S)for(O in j)(m||A||!(O in k))&&u(k,O,j[O]);else r({target:t,proto:!0,forced:m||A},j);return j}},function(e,t,n){var r=n(46),a=n(442);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,o){return r(n),a(o),t?e.call(n,o):n.__proto__=o,n}}():void 0)},function(e,t){e.exports=function(){}},function(e,t,n){e.exports=n(455)},function(e,t,n){e.exports=n(482)},function(e,t,n){var r=n(550),a=n(566),o=n(568),i=n(569),s=n(570);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=a,c.prototype.get=o,c.prototype.has=i,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(97)(n(64),"Map");e.exports=r},function(e,t,n){var r=n(148),a=n(574),o=n(575),i=n(576),s=n(577),c=n(578);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=a,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=c,e.exports=u},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e}},function(e,t,n){var r=n(588),a=n(334),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return o.call(e,t)})))}:a;e.exports=s},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){var r=n(592),a=n(204),o=n(205),i=o&&o.isTypedArray,s=i?a(i):r;e.exports=s},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){(function(e){var r=n(322),a=t&&!t.nodeType&&t,o=a&&"object"==typeof e&&e&&!e.nodeType&&e,i=o&&o.exports===a&&r.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s}).call(this,n(201)(e))},function(e,t,n){var r=n(47),a=n(146),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!a(e))||(i.test(e)||!o.test(e)||null!=t&&e in Object(t))}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(335),a=n(688),o=n(99);e.exports=function(e){return o(e)?r(e,!0):a(e)}},function(e,t,n){var r=n(337)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(331);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t,n){var r=n(537)("toUpperCase");e.exports=r},function(e,t,n){var r=n(196);function a(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i)||o,i};return n.cache=new(a.Cache||r),n}a.Cache=r,e.exports=a},function(e,t,n){"use strict";n.r(t);var r=n(214),a=n(53),o=n(217);t.default=function(e){return{statePlugins:{err:{reducers:Object(r.default)(e),actions:a,selectors:o}}}}},function(e,t,n){"use strict";n.r(t);var r=n(3),a=n.n(r),o=n(22),i=n.n(o),s=n(4),c=n.n(s),u=n(2),l=n.n(u),p=n(12),f=n.n(p),d=n(85),h=n.n(d),m=n(53),v=n(1),g=n(103),y={line:0,level:"error",message:"Unknown error"};t.default=function(){var e;return e={},a()(e,m.NEW_THROWN_ERR,(function(e,t){var n=t.payload,r=i()(y,n,{type:"thrown"});return e.update("errors",(function(e){return(e||Object(v.List)()).push(Object(v.fromJS)(r))})).update("errors",(function(e){return Object(g.default)(e)}))})),a()(e,m.NEW_THROWN_ERR_BATCH,(function(e,t){var n=t.payload;return n=c()(n).call(n,(function(e){return Object(v.fromJS)(i()(y,e,{type:"thrown"}))})),e.update("errors",(function(e){var t;return l()(t=e||Object(v.List)()).call(t,Object(v.fromJS)(n))})).update("errors",(function(e){return Object(g.default)(e)}))})),a()(e,m.NEW_SPEC_ERR,(function(e,t){var n=t.payload,r=Object(v.fromJS)(n);return r=r.set("type","spec"),e.update("errors",(function(e){return(e||Object(v.List)()).push(Object(v.fromJS)(r)).sortBy((function(e){return e.get("line")}))})).update("errors",(function(e){return Object(g.default)(e)}))})),a()(e,m.NEW_SPEC_ERR_BATCH,(function(e,t){var n=t.payload;return n=c()(n).call(n,(function(e){return Object(v.fromJS)(i()(y,e,{type:"spec"}))})),e.update("errors",(function(e){var t;return l()(t=e||Object(v.List)()).call(t,Object(v.fromJS)(n))})).update("errors",(function(e){return Object(g.default)(e)}))})),a()(e,m.NEW_AUTH_ERR,(function(e,t){var n=t.payload,r=Object(v.fromJS)(i()({},n));return r=r.set("type","auth"),e.update("errors",(function(e){return(e||Object(v.List)()).push(Object(v.fromJS)(r))})).update("errors",(function(e){return Object(g.default)(e)}))})),a()(e,m.CLEAR,(function(e,t){var n,r=t.payload;if(!r||!e.get("errors"))return e;var a=f()(n=e.get("errors")).call(n,(function(e){var t;return h()(t=e.keySeq()).call(t,(function(t){var n=e.get(t),a=r[t];return!a||n!==a}))}));return e.merge({errors:a})})),a()(e,m.CLEAR_BY,(function(e,t){var n,r=t.payload;if(!r||"function"!=typeof r)return e;var a=f()(n=e.get("errors")).call(n,(function(e){return r(e)}));return e.merge({errors:a})})),e}},function(e,t,n){"use strict";n.r(t),n.d(t,"transform",(function(){return p}));var r=n(4),a=n.n(r),o=n(14),i=n.n(o),s=n(23),c=n.n(s),u=n(21),l=n.n(u);function p(e){return a()(e).call(e,(function(e){var t,n="is not of a type(s)",r=i()(t=e.get("message")).call(t,n);if(r>-1){var a,o,s=c()(a=e.get("message")).call(a,r+n.length).split(",");return e.set("message",c()(o=e.get("message")).call(o,0,r)+function(e){return l()(e).call(e,(function(e,t,n,r){return n===r.length-1&&r.length>1?e+"or "+t:r[n+1]&&r.length>2?e+t+", ":r[n+1]?e+t+" ":e+t}),"should be a")}(s))}return e}))}},function(e,t,n){"use strict";n.r(t),n.d(t,"transform",(function(){return r}));n(4),n(14),n(41),n(1);function r(e,t){t.jsSpec;return e}},function(e,t,n){"use strict";n.r(t),n.d(t,"allErrors",(function(){return o})),n.d(t,"lastError",(function(){return i}));var r=n(1),a=n(20),o=Object(a.createSelector)((function(e){return e}),(function(e){return e.get("errors",Object(r.List)())})),i=Object(a.createSelector)(o,(function(e){return e.last()}))},function(e,t,n){"use strict";n.r(t);var r=n(219),a=n(86),o=n(220);t.default=function(){return{statePlugins:{layout:{reducers:r.default,actions:a,selectors:o}}}}},function(e,t,n){"use strict";n.r(t);var r,a=n(3),o=n.n(a),i=n(2),s=n.n(i),c=n(1),u=n(86);t.default=(r={},o()(r,u.UPDATE_LAYOUT,(function(e,t){return e.set("layout",t.payload)})),o()(r,u.UPDATE_FILTER,(function(e,t){return e.set("filter",t.payload)})),o()(r,u.SHOW,(function(e,t){var n=t.payload.shown,r=Object(c.fromJS)(t.payload.thing);return e.update("shown",Object(c.fromJS)({}),(function(e){return e.set(r,n)}))})),o()(r,u.UPDATE_MODE,(function(e,t){var n,r=t.payload.thing,a=t.payload.mode;return e.setIn(s()(n=["modes"]).call(n,r),(a||"")+"")})),r)},function(e,t,n){"use strict";n.r(t),n.d(t,"current",(function(){return l})),n.d(t,"currentFilter",(function(){return p})),n.d(t,"isShown",(function(){return f})),n.d(t,"whatMode",(function(){return d})),n.d(t,"showSummary",(function(){return h}));var r=n(15),a=n.n(r),o=n(2),i=n.n(o),s=n(20),c=n(5),u=n(1),l=function(e){return e.get("layout")},p=function(e){return e.get("filter")},f=function(e,t,n){return t=Object(c.w)(t),e.get("shown",Object(u.fromJS)({})).get(Object(u.fromJS)(t),n)},d=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return t=Object(c.w)(t),e.getIn(i()(n=["modes"]).call(n,a()(t)),r)},h=Object(s.createSelector)((function(e){return e}),(function(e){return!f(e,"editor")}))},function(e,t,n){"use strict";n.r(t);var r=n(222),a=n(42),o=n(78),i=n(223);t.default=function(){return{statePlugins:{spec:{wrapActions:i,reducers:r.default,actions:a,selectors:o}}}}},function(e,t,n){"use strict";n.r(t);var r,a=n(3),o=n.n(a),i=n(15),s=n.n(i),c=n(2),u=n.n(c),l=n(21),p=n.n(l),f=n(4),d=n.n(f),h=n(22),m=n.n(h),v=n(1),g=n(5),y=n(26),b=n(78),E=n(42);t.default=(r={},o()(r,E.UPDATE_SPEC,(function(e,t){return"string"==typeof t.payload?e.set("spec",t.payload):e})),o()(r,E.UPDATE_URL,(function(e,t){return e.set("url",t.payload+"")})),o()(r,E.UPDATE_JSON,(function(e,t){return e.set("json",Object(g.i)(t.payload))})),o()(r,E.UPDATE_RESOLVED,(function(e,t){return e.setIn(["resolved"],Object(g.i)(t.payload))})),o()(r,E.UPDATE_RESOLVED_SUBTREE,(function(e,t){var n,r=t.payload,a=r.value,o=r.path;return e.setIn(u()(n=["resolvedSubtrees"]).call(n,s()(o)),Object(g.i)(a))})),o()(r,E.UPDATE_PARAM,(function(e,t){var n,r,a=t.payload,o=a.path,i=a.paramName,c=a.paramIn,l=a.param,p=a.value,f=a.isXml,d=l?Object(g.B)(l):u()(n="".concat(c,".")).call(n,i),h=f?"value_xml":"value";return e.setIn(u()(r=["meta","paths"]).call(r,s()(o),["parameters",d,h]),p)})),o()(r,E.UPDATE_EMPTY_PARAM_INCLUSION,(function(e,t){var n,r,a=t.payload,o=a.pathMethod,i=a.paramName,c=a.paramIn,l=a.includeEmptyValue;if(!i||!c)return console.warn("Warning: UPDATE_EMPTY_PARAM_INCLUSION could not generate a paramKey."),e;var p=u()(n="".concat(c,".")).call(n,i);return e.setIn(u()(r=["meta","paths"]).call(r,s()(o),["parameter_inclusions",p]),l)})),o()(r,E.VALIDATE_PARAMS,(function(e,t){var n,r,a=t.payload,o=a.pathMethod,i=a.isOAS3,c=Object(b.specJsonWithResolvedSubtrees)(e).getIn(u()(n=["paths"]).call(n,s()(o))),l=Object(b.parameterValues)(e,o).toJS();return e.updateIn(u()(r=["meta","paths"]).call(r,s()(o),["parameters"]),Object(v.fromJS)({}),(function(t){var n;return p()(n=c.get("parameters",Object(v.List)())).call(n,(function(t,n){var r=Object(g.C)(n,l),a=Object(b.parameterInclusionSettingFor)(e,o,n.get("name"),n.get("in")),s=Object(g.L)(n,r,{bypassRequiredCheck:a,isOAS3:i});return t.setIn([Object(g.B)(n),"errors"],Object(v.fromJS)(s))}),t)}))})),o()(r,E.CLEAR_VALIDATE_PARAMS,(function(e,t){var n,r=t.payload.pathMethod;return e.updateIn(u()(n=["meta","paths"]).call(n,s()(r),["parameters"]),Object(v.fromJS)([]),(function(e){return d()(e).call(e,(function(e){return e.set("errors",Object(v.fromJS)([]))}))}))})),o()(r,E.SET_RESPONSE,(function(e,t){var n,r=t.payload,a=r.res,o=r.path,i=r.method;(n=a.error?m()({error:!0,name:a.err.name,message:a.err.message,statusCode:a.err.statusCode},a.err.response):a).headers=n.headers||{};var s=e.setIn(["responses",o,i],Object(g.i)(n));return y.a.Blob&&a.data instanceof y.a.Blob&&(s=s.setIn(["responses",o,i,"text"],a.data)),s})),o()(r,E.SET_REQUEST,(function(e,t){var n=t.payload,r=n.req,a=n.path,o=n.method;return e.setIn(["requests",a,o],Object(g.i)(r))})),o()(r,E.SET_MUTATED_REQUEST,(function(e,t){var n=t.payload,r=n.req,a=n.path,o=n.method;return e.setIn(["mutatedRequests",a,o],Object(g.i)(r))})),o()(r,E.UPDATE_OPERATION_META_VALUE,(function(e,t){var n,r,a,o,i,c,l=t.payload,p=l.path,f=l.value,d=l.key,h=u()(n=["paths"]).call(n,s()(p)),m=u()(r=["meta","paths"]).call(r,s()(p));return e.getIn(u()(a=["json"]).call(a,s()(h)))||e.getIn(u()(o=["resolved"]).call(o,s()(h)))||e.getIn(u()(i=["resolvedSubtrees"]).call(i,s()(h)))?e.setIn(u()(c=[]).call(c,s()(m),[d]),Object(v.fromJS)(f)):e})),o()(r,E.CLEAR_RESPONSE,(function(e,t){var n=t.payload,r=n.path,a=n.method;return e.deleteIn(["responses",r,a])})),o()(r,E.CLEAR_REQUEST,(function(e,t){var n=t.payload,r=n.path,a=n.method;return e.deleteIn(["requests",r,a])})),o()(r,E.SET_SCHEME,(function(e,t){var n=t.payload,r=n.scheme,a=n.path,o=n.method;return a&&o?e.setIn(["scheme",a,o],r):a||o?void 0:e.setIn(["scheme","_defaultScheme"],r)})),r)},function(e,t,n){"use strict";n.r(t),n.d(t,"updateSpec",(function(){return u})),n.d(t,"updateJsonSpec",(function(){return l})),n.d(t,"executeRequest",(function(){return p})),n.d(t,"validateParams",(function(){return f}));var r=n(17),a=n.n(r),o=n(18),i=n.n(o),s=n(41),c=n.n(s),u=function(e,t){var n=t.specActions;return function(){e.apply(void 0,arguments),n.parseToJson.apply(n,arguments)}},l=function(e,t){var n=t.specActions;return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];e.apply(void 0,r),n.invalidateResolvedSubtreeCache();var s=r[0],u=c()(s,["paths"])||{},l=a()(u);i()(l).call(l,(function(e){c()(u,[e]).$ref&&n.requestResolvedSubtree(["paths",e])})),n.requestResolvedSubtree(["components","securitySchemes"])}},p=function(e,t){var n=t.specActions;return function(t){return n.logRequest(t),e(t)}},f=function(e,t){var n=t.specSelectors;return function(t){return e(t,n.isOAS3())}}},function(e,t,n){"use strict";n.r(t);var r=n(29),a=n.n(r),o=n(134),i=n(5);t.default=function(e){var t=e.getComponents,n=e.getStore,r=e.getSystem,s=o.getComponent,c=o.render,u=o.makeMappedContainer,l=Object(i.v)(a()(s).call(s,null,r,n,t));return{rootInjects:{getComponent:l,makeMappedContainer:Object(i.v)(a()(u).call(u,null,r,n,l,t)),render:a()(c).call(c,null,r,n,s,t)}}}},function(e,t,n){var r=n(96),a=n(209),o=n(76),i=Function.prototype,s=Object.prototype,c=i.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!o(e)||"[object Object]"!=r(e))return!1;var t=a(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},function(e,t,n){"use strict";n.r(t);var r=n(111);t.default=function(){return{fn:r}}},function(e,t,n){"use strict";n.r(t);var r=n(29),a=n.n(r);t.default=function(e){var t=e.configs,n={debug:0,info:1,log:2,warn:3,error:4},r=function(e){return n[e]||-1},o=t.logLevel,i=r(o);function s(e){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];r(e)>=i&&(t=console)[e].apply(t,a)}return s.warn=a()(s).call(s,null,"warn"),s.error=a()(s).call(s,null,"error"),s.info=a()(s).call(s,null,"info"),s.debug=a()(s).call(s,null,"debug"),{rootInjects:{log:s}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"loaded",(function(){return r}));var r=function(e,t){return function(){e.apply(void 0,arguments);var n=t.getConfigs().withCredentials;void 0!==n&&(t.fn.fetch.withCredentials="string"==typeof n?"true"===n:!!n)}}},function(e,t,n){"use strict";n.r(t),n.d(t,"preauthorizeBasic",(function(){return d})),n.d(t,"preauthorizeApiKey",(function(){return h}));var r=n(3),a=n.n(r),o=n(29),i=n.n(o),s=n(2),c=n.n(s),u=n(230),l=n(73),p=n(231),f=n(232);function d(e,t,n,r){var o,i=e.authActions.authorize,s=e.specSelectors,u=s.specJson,l=(0,s.isOAS3)()?["components","securitySchemes"]:["securityDefinitions"],p=u().getIn(c()(o=[]).call(o,l,[t]));return p?i(a()({},t,{value:{username:n,password:r},schema:p.toJS()})):null}function h(e,t,n){var r,o=e.authActions.authorize,i=e.specSelectors,s=i.specJson,u=(0,i.isOAS3)()?["components","securitySchemes"]:["securityDefinitions"],l=s().getIn(c()(r=[]).call(r,u,[t]));return l?o(a()({},t,{value:n,schema:l.toJS()})):null}t.default=function(){return{afterLoad:function(e){this.rootInjects=this.rootInjects||{},this.rootInjects.initOAuth=e.authActions.configureAuth,this.rootInjects.preauthorizeApiKey=i()(h).call(h,null,e),this.rootInjects.preauthorizeBasic=i()(d).call(d,null,e)},statePlugins:{auth:{reducers:u.default,actions:l,selectors:p},spec:{wrapActions:f}}}}},function(e,t,n){"use strict";n.r(t);var r,a=n(3),o=n.n(a),i=n(16),s=n.n(i),c=n(18),u=n.n(c),l=n(22),p=n.n(l),f=n(1),d=n(5),h=n(73);t.default=(r={},o()(r,h.SHOW_AUTH_POPUP,(function(e,t){var n=t.payload;return e.set("showDefinitions",n)})),o()(r,h.AUTHORIZE,(function(e,t){var n,r=t.payload,a=Object(f.fromJS)(r),o=e.get("authorized")||Object(f.Map)();return u()(n=a.entrySeq()).call(n,(function(t){var n=s()(t,2),r=n[0],a=n[1];if(!Object(d.s)(a.getIn))return e.set("authorized",o);var i=a.getIn(["schema","type"]);if("apiKey"===i||"http"===i)o=o.set(r,a);else if("basic"===i){var c=a.getIn(["value","username"]),u=a.getIn(["value","password"]);o=(o=o.setIn([r,"value"],{username:c,header:"Basic "+Object(d.a)(c+":"+u)})).setIn([r,"schema"],a.get("schema"))}})),e.set("authorized",o)})),o()(r,h.AUTHORIZE_OAUTH2,(function(e,t){var n,r=t.payload,a=r.auth,o=r.token;a.token=p()({},o),n=Object(f.fromJS)(a);var i=e.get("authorized")||Object(f.Map)();return i=i.set(n.get("name"),n),e.set("authorized",i)})),o()(r,h.LOGOUT,(function(e,t){var n=t.payload,r=e.get("authorized").withMutations((function(e){u()(n).call(n,(function(t){e.delete(t)}))}));return e.set("authorized",r)})),o()(r,h.CONFIGURE_AUTH,(function(e,t){var n=t.payload;return e.set("configs",n)})),o()(r,h.RESTORE_AUTHORIZATION,(function(e,t){var n=t.payload;return e.set("authorized",Object(f.fromJS)(n.authorized))})),r)},function(e,t,n){"use strict";n.r(t),n.d(t,"shownDefinitions",(function(){return E})),n.d(t,"definitionsToAuthorize",(function(){return x})),n.d(t,"getDefinitionsByNames",(function(){return S})),n.d(t,"definitionsForRequirements",(function(){return w})),n.d(t,"authorized",(function(){return j})),n.d(t,"isAuthorized",(function(){return O})),n.d(t,"getConfigs",(function(){return C}));var r=n(16),a=n.n(r),o=n(18),i=n.n(o),s=n(12),c=n.n(s),u=n(33),l=n.n(u),p=n(14),f=n.n(p),d=n(4),h=n.n(d),m=n(17),v=n.n(m),g=n(20),y=n(1),b=function(e){return e},E=Object(g.createSelector)(b,(function(e){return e.get("showDefinitions")})),x=Object(g.createSelector)(b,(function(){return function(e){var t,n=e.specSelectors.securityDefinitions()||Object(y.Map)({}),r=Object(y.List)();return i()(t=n.entrySeq()).call(t,(function(e){var t=a()(e,2),n=t[0],o=t[1],i=Object(y.Map)();i=i.set(n,o),r=r.push(i)})),r}})),S=function(e,t){return function(e){var n,r=e.specSelectors;console.warn("WARNING: getDefinitionsByNames is deprecated and will be removed in the next major version.");var o=r.securityDefinitions(),s=Object(y.List)();return i()(n=t.valueSeq()).call(n,(function(e){var t,n=Object(y.Map)();i()(t=e.entrySeq()).call(t,(function(e){var t,r,s=a()(e,2),c=s[0],u=s[1],l=o.get(c);"oauth2"===l.get("type")&&u.size&&(t=l.get("scopes"),i()(r=t.keySeq()).call(r,(function(e){u.contains(e)||(t=t.delete(e))})),l=l.set("allowedScopes",t));n=n.set(c,l)})),s=s.push(n)})),s}},w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object(y.List)();return function(e){var n=e.authSelectors.definitionsToAuthorize()||Object(y.List)();return c()(n).call(n,(function(e){return l()(t).call(t,(function(t){return t.get(e.keySeq().first())}))}))}},j=Object(g.createSelector)(b,(function(e){return e.get("authorized")||Object(y.Map)()})),O=function(e,t){return function(e){var n,r=e.authSelectors.authorized();return y.List.isList(t)?!!c()(n=t.toJS()).call(n,(function(e){var t,n;return-1===f()(t=h()(n=v()(e)).call(n,(function(e){return!!r.get(e)}))).call(t,!1)})).length:null}},C=Object(g.createSelector)(b,(function(e){return e.get("configs")}))},function(e,t,n){"use strict";n.r(t),n.d(t,"execute",(function(){return o}));var r=n(25),a=n.n(r),o=function(e,t){var n=t.authSelectors,r=t.specSelectors;return function(t){var o=t.path,i=t.method,s=t.operation,c=t.extras,u={authorized:n.authorized()&&n.authorized().toJS(),definitions:r.securityDefinitions()&&r.securityDefinitions().toJS(),specSecurity:r.security()&&r.security().toJS()};return e(a()({path:o,method:i,operation:s,securities:u},c))}}},function(e,t,n){"use strict";n.r(t);var r=n(5);t.default=function(){return{fn:{shallowEqualKeys:r.H}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return v}));var r=n(22),a=n.n(r),o=n(80),i=n.n(o),s=n(2),c=n.n(s),u=n(14),l=n.n(u),p=n(30),f=n.n(p),d=n(20),h=n(1),m=n(26);function v(e){var t=e.fn;return{statePlugins:{spec:{actions:{download:function(e){return function(n){var r=n.errActions,o=n.specSelectors,s=n.specActions,u=n.getConfigs,l=t.fetch,p=u();function f(t){if(t instanceof Error||t.status>=400)return s.updateLoadingStatus("failed"),r.newThrownErr(a()(new Error((t.message||t.statusText)+" "+e),{source:"fetch"})),void(!t.status&&t instanceof Error&&function(){try{var t;if("URL"in m.a?t=new i.a(e):(t=document.createElement("a")).href=e,"https:"!==t.protocol&&"https:"===m.a.location.protocol){var n=a()(new Error("Possible mixed-content issue? The page was loaded over https:// but a ".concat(t.protocol,"// URL was specified. Check that you are not attempting to load mixed content.")),{source:"fetch"});return void r.newThrownErr(n)}if(t.origin!==m.a.location.origin){var o,s=a()(new Error(c()(o="Possible cross-origin (CORS) issue? The URL origin (".concat(t.origin,") does not match the page (")).call(o,m.a.location.origin,"). Check the server returns the correct 'Access-Control-Allow-*' headers.")),{source:"fetch"});r.newThrownErr(s)}}catch(e){return}}());s.updateLoadingStatus("success"),s.updateSpec(t.text),o.url()!==e&&s.updateUrl(e)}e=e||o.url(),s.updateLoadingStatus("loading"),r.clear({source:"fetch"}),l({url:e,loadSpec:!0,requestInterceptor:p.requestInterceptor||function(e){return e},responseInterceptor:p.responseInterceptor||function(e){return e},credentials:"same-origin",headers:{Accept:"application/json,*/*"}}).then(f,f)}},updateLoadingStatus:function(e){var t,n=[null,"loading","failed","success","failedConfig"];-1===l()(n).call(n,e)&&console.error(c()(t="Error: ".concat(e," is not one of ")).call(t,f()(n)));return{type:"spec_update_loading_status",payload:e}}},reducers:{spec_update_loading_status:function(e,t){return"string"==typeof t.payload?e.set("loadingStatus",t.payload):e}},selectors:{loadingStatus:Object(d.createSelector)((function(e){return e||Object(h.Map)()}),(function(e){return e.get("loadingStatus")||null}))}}}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"downloadConfig",(function(){return a})),n.d(t,"getConfigByUrl",(function(){return o}));var r=n(131),a=function(e){return function(t){return(0,t.fn.fetch)(e)}},o=function(e,t){return function(n){var a=n.specActions;if(e)return a.downloadConfig(e).then(o,o);function o(n){n instanceof Error||n.status>=400?(a.updateLoadingStatus("failedConfig"),a.updateLoadingStatus("failedConfig"),a.updateUrl(""),console.error(n.statusText+" "+e.url),t(null)):t(Object(r.parseYamlConfig)(n.text))}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"get",(function(){return o}));var r=n(13),a=n.n(r),o=function(e,t){return e.getIn(a()(t)?t:[t])}},function(e,t,n){"use strict";n.r(t);var r,a=n(3),o=n.n(a),i=n(1),s=n(112);t.default=(r={},o()(r,s.UPDATE_CONFIGS,(function(e,t){return e.merge(Object(i.fromJS)(t.payload))})),o()(r,s.TOGGLE_CONFIGS,(function(e,t){var n=t.payload,r=e.get(n);return e.set(n,!r)})),r)},function(e,t,n){"use strict";n.r(t);var r=n(239),a=n(240),o=n(241);t.default=function(){return[r.default,{statePlugins:{configs:{wrapActions:{loaded:function(e,t){return function(){e.apply(void 0,arguments);var n=decodeURIComponent(window.location.hash);t.layoutActions.parseDeepLinkHash(n)}}}}},wrapComponents:{operation:a.default,OperationTag:o.default}}]}},function(e,t,n){"use strict";n.r(t),n.d(t,"show",(function(){return C})),n.d(t,"scrollTo",(function(){return _})),n.d(t,"parseDeepLinkHash",(function(){return A})),n.d(t,"readyToScroll",(function(){return k})),n.d(t,"scrollToElement",(function(){return I})),n.d(t,"clearScrollTo",(function(){return P}));var r,a=n(3),o=n.n(a),i=n(16),s=n.n(i),c=n(13),u=n.n(c),l=n(2),p=n.n(l),f=n(23),d=n.n(f),h=n(4),m=n.n(h),v=n(14),g=n.n(v),y=n(135),b=n(397),E=n.n(b),x=n(5),S=n(1),w=n.n(S),j="layout_scroll_to",O="layout_clear_scroll",C=function(e,t){var n=t.getConfigs,r=t.layoutSelectors;return function(){for(var t=arguments.length,a=new Array(t),o=0;o<t;o++)a[o]=arguments[o];if(e.apply(void 0,a),n().deepLinking)try{var i=a[0],c=a[1];i=u()(i)?i:[i];var l=r.urlHashArrayFromIsShownKey(i);if(!l.length)return;var f,d=s()(l,2),h=d[0],m=d[1];if(!c)return Object(y.setHash)("/");if(2===l.length)Object(y.setHash)(Object(x.d)(p()(f="/".concat(encodeURIComponent(h),"/")).call(f,encodeURIComponent(m))));else 1===l.length&&Object(y.setHash)(Object(x.d)("/".concat(encodeURIComponent(h))))}catch(e){console.error(e)}}},_=function(e){return{type:j,payload:u()(e)?e:[e]}},A=function(e){return function(t){var n=t.layoutActions,r=t.layoutSelectors;if((0,t.getConfigs)().deepLinking&&e){var a,o=d()(e).call(e,1);"!"===o[0]&&(o=d()(o).call(o,1)),"/"===o[0]&&(o=d()(o).call(o,1));var i=m()(a=o.split("/")).call(a,(function(e){return e||""})),c=r.isShownKeyFromUrlHashArray(i),u=s()(c,3),l=u[0],p=u[1],f=void 0===p?"":p,h=u[2],v=void 0===h?"":h;if("operations"===l){var y=r.isShownKeyFromUrlHashArray([f]);g()(f).call(f,"_")>-1&&(console.warn("Warning: escaping deep link whitespace with `_` will be unsupported in v4.0, use `%20` instead."),n.show(m()(y).call(y,(function(e){return e.replace(/_/g," ")})),!0)),n.show(y,!0)}(g()(f).call(f,"_")>-1||g()(v).call(v,"_")>-1)&&(console.warn("Warning: escaping deep link whitespace with `_` will be unsupported in v4.0, use `%20` instead."),n.show(m()(c).call(c,(function(e){return e.replace(/_/g," ")})),!0)),n.show(c,!0),n.scrollTo(c)}}},k=function(e,t){return function(n){var r=n.layoutSelectors.getScrollToKey();w.a.is(r,Object(S.fromJS)(e))&&(n.layoutActions.scrollToElement(t),n.layoutActions.clearScrollTo())}},I=function(e,t){return function(n){try{t=t||n.fn.getScrollParent(e),E.a.createScroller(t).to(e)}catch(e){console.error(e)}}},P=function(){return{type:O}};t.default={fn:{getScrollParent:function(e,t){var n=document.documentElement,r=getComputedStyle(e),a="absolute"===r.position,o=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if("fixed"===r.position)return n;for(var i=e;i=i.parentElement;)if(r=getComputedStyle(i),(!a||"static"!==r.position)&&o.test(r.overflow+r.overflowY+r.overflowX))return i;return n}},statePlugins:{layout:{actions:{scrollToElement:I,scrollTo:_,clearScrollTo:P,readyToScroll:k,parseDeepLinkHash:A},selectors:{getScrollToKey:function(e){return e.get("scrollToKey")},isShownKeyFromUrlHashArray:function(e,t){var n=s()(t,2),r=n[0],a=n[1];return a?["operations",r,a]:r?["operations-tag",r]:[]},urlHashArrayFromIsShownKey:function(e,t){var n=s()(t,3),r=n[0],a=n[1],o=n[2];return"operations"==r?[a,o]:"operations-tag"==r?[a]:[]}},reducers:(r={},o()(r,j,(function(e,t){return e.set("scrollToKey",w.a.fromJS(t.payload))})),o()(r,O,(function(e){return e.delete("scrollToKey")})),r),wrapActions:{show:C}}}}},function(e,t,n){"use strict";n.r(t);var r=n(6),a=n.n(r),o=n(7),i=n.n(o),s=n(10),c=n.n(s),u=n(8),l=n.n(u),p=n(9),f=n.n(p),d=n(3),h=n.n(d),m=n(2),v=n.n(m),g=n(0),y=n.n(g);n(27);t.default=function(e,t){return function(n){l()(o,n);var r=f()(o);function o(){var e,n;a()(this,o);for(var i=arguments.length,s=new Array(i),u=0;u<i;u++)s[u]=arguments[u];return n=r.call.apply(r,v()(e=[this]).call(e,s)),h()(c()(n),"onLoad",(function(e){var r=n.props.operation,a=r.toObject(),o=a.tag,i=a.operationId,s=r.toObject().isShownKey;s=s||["operations",o,i],t.layoutActions.readyToScroll(s,e)})),n}return i()(o,[{key:"render",value:function(){return y.a.createElement("span",{ref:this.onLoad},y.a.createElement(e,this.props))}}]),o}(y.a.Component)}},function(e,t,n){"use strict";n.r(t);var r=n(6),a=n.n(r),o=n(7),i=n.n(o),s=n(10),c=n.n(s),u=n(8),l=n.n(u),p=n(9),f=n.n(p),d=n(3),h=n.n(d),m=n(2),v=n.n(m),g=n(0),y=n.n(g);n(11);t.default=function(e,t){return function(n){l()(o,n);var r=f()(o);function o(){var e,n;a()(this,o);for(var i=arguments.length,s=new Array(i),u=0;u<i;u++)s[u]=arguments[u];return n=r.call.apply(r,v()(e=[this]).call(e,s)),h()(c()(n),"onLoad",(function(e){var r=["operations-tag",n.props.tag];t.layoutActions.readyToScroll(r,e)})),n}return i()(o,[{key:"render",value:function(){return y.a.createElement("span",{ref:this.onLoad},y.a.createElement(e,this.props))}}]),o}(y.a.Component)}},function(e,t,n){"use strict";n.r(t);var r=n(243);t.default=function(){return{fn:{opsFilter:r.default}}}},function(e,t,n){"use strict";n.r(t);var r=n(12),a=n.n(r),o=n(14),i=n.n(o);t.default=function(e,t){return a()(e).call(e,(function(e,n){return-1!==i()(n).call(n,t)}))}},function(e,t,n){"use strict";n.r(t);var r=n(169),a=n.n(r),o=!1;t.default=function(){return{statePlugins:{spec:{wrapActions:{updateSpec:function(e){return function(){return o=!0,e.apply(void 0,arguments)}},updateJsonSpec:function(e,t){return function(){var n=t.getConfigs().onComplete;return o&&"function"==typeof n&&(a()(n,0),o=!1),e.apply(void 0,arguments)}}}}}}}},function(e,t,n){"use strict";n.r(t);var r=n(246),a=n(247),o=n(248),i=n(249),s=n(257),c=n(50),u=n(264),l=n(265);t.default=function(){return{components:i.default,wrapComponents:s.default,statePlugins:{spec:{wrapSelectors:r,selectors:o},auth:{wrapSelectors:a},oas3:{actions:c,reducers:l.default,selectors:u}}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"definitions",(function(){return d})),n.d(t,"hasHost",(function(){return h})),n.d(t,"securityDefinitions",(function(){return m})),n.d(t,"host",(function(){return v})),n.d(t,"basePath",(function(){return g})),n.d(t,"consumes",(function(){return y})),n.d(t,"produces",(function(){return b})),n.d(t,"schemes",(function(){return E})),n.d(t,"servers",(function(){return x})),n.d(t,"isOAS3",(function(){return S})),n.d(t,"isSwagger2",(function(){return w}));var r=n(20),a=n(78),o=n(1),i=n(32);function s(e){return function(t,n){return function(){var r=n.getSystem().specSelectors.specJson();return Object(i.isOAS3)(r)?e.apply(void 0,arguments):t.apply(void 0,arguments)}}}var c=function(e){return e||Object(o.Map)()},u=s(Object(r.createSelector)((function(){return null}))),l=Object(r.createSelector)(c,(function(e){return e.get("json",Object(o.Map)())})),p=Object(r.createSelector)(c,(function(e){return e.get("resolved",Object(o.Map)())})),f=function(e){var t=p(e);return t.count()<1&&(t=l(e)),t},d=s(Object(r.createSelector)(f,(function(e){var t=e.getIn(["components","schemas"]);return o.Map.isMap(t)?t:Object(o.Map)()}))),h=s((function(e){return f(e).hasIn(["servers",0])})),m=s(Object(r.createSelector)(a.specJsonWithResolvedSubtrees,(function(e){return e.getIn(["components","securitySchemes"])||null}))),v=u,g=u,y=u,b=u,E=u,x=s(Object(r.createSelector)(f,(function(e){return e.getIn(["servers"])||Object(o.Map)()}))),S=function(e,t){return function(){var e=t.getSystem().specSelectors.specJson();return Object(i.isOAS3)(o.Map.isMap(e)?e:Object(o.Map)())}},w=function(e,t){return function(){var e=t.getSystem().specSelectors.specJson();return Object(i.isSwagger2)(o.Map.isMap(e)?e:Object(o.Map)())}}},function(e,t,n){"use strict";n.r(t),n.d(t,"definitionsToAuthorize",(function(){return b}));var r=n(3),a=n.n(r),o=n(16),i=n.n(o),s=n(2),c=n.n(s),u=n(18),l=n.n(u),p=n(12),f=n.n(p),d=n(21),h=n.n(d),m=n(20),v=n(1),g=n(32);var y,b=(y=Object(m.createSelector)((function(e){return e}),(function(e){return e.specSelectors.securityDefinitions()}),(function(e,t){var n,r=Object(v.List)();return t?(l()(n=t.entrySeq()).call(n,(function(e){var t,n=i()(e,2),o=n[0],s=n[1],c=s.get("type");if("oauth2"===c&&l()(t=s.get("flows").entrySeq()).call(t,(function(e){var t=i()(e,2),n=t[0],c=t[1],u=Object(v.fromJS)({flow:n,authorizationUrl:c.get("authorizationUrl"),tokenUrl:c.get("tokenUrl"),scopes:c.get("scopes"),type:s.get("type")});r=r.push(new v.Map(a()({},o,f()(u).call(u,(function(e){return void 0!==e})))))})),"http"!==c&&"apiKey"!==c||(r=r.push(new v.Map(a()({},o,s)))),"openIdConnect"===c&&s.get("openIdConnectData")){var u=s.get("openIdConnectData"),p=u.get("grant_types_supported")||["authorization_code","implicit"];l()(p).call(p,(function(e){var t,n=u.get("scopes_supported")&&h()(t=u.get("scopes_supported")).call(t,(function(e,t){return e.set(t,"")}),new v.Map),i=Object(v.fromJS)({flow:e,authorizationUrl:u.get("authorization_endpoint"),tokenUrl:u.get("token_endpoint"),scopes:n,type:"oauth2",openIdConnectUrl:s.get("openIdConnectUrl")});r=r.push(new v.Map(a()({},o,f()(i).call(i,(function(e){return void 0!==e})))))}))}})),r):r})),function(e,t){return function(){for(var n=t.getSystem().specSelectors.specJson(),r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];if(Object(g.isOAS3)(n)){var i,s=t.getState().getIn(["spec","resolvedSubtrees","components","securitySchemes"]);return y.apply(void 0,c()(i=[t,s]).call(i,a))}return e.apply(void 0,a)}})},function(e,t,n){"use strict";n.r(t),n.d(t,"servers",(function(){return l})),n.d(t,"isSwagger2",(function(){return p}));var r=n(20),a=n(1),o=n(32);var i,s=function(e){return e||Object(a.Map)()},c=Object(r.createSelector)(s,(function(e){return e.get("json",Object(a.Map)())})),u=Object(r.createSelector)(s,(function(e){return e.get("resolved",Object(a.Map)())})),l=(i=Object(r.createSelector)((function(e){var t=u(e);return t.count()<1&&(t=c(e)),t}),(function(e){return e.getIn(["servers"])||Object(a.Map)()})),function(){return function(e){var t=e.getSystem().specSelectors.specJson();if(Object(o.isOAS3)(t)){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return i.apply(void 0,r)}return null}}),p=function(e,t){return function(){var e=t.getSystem().specSelectors.specJson();return Object(o.isSwagger2)(e)}}},function(e,t,n){"use strict";n.r(t);var r=n(250),a=n(132),o=n(251),i=n(252),s=n(253),c=n(254),u=n(255),l=n(256);t.default={Callbacks:r.default,HttpAuth:u.default,RequestBody:a.default,Servers:i.default,ServersContainer:s.default,RequestBodyEditor:c.default,OperationServers:l.default,operationLink:o.default}},function(e,t,n){"use strict";n.r(t);var r=n(28),a=n.n(r),o=n(16),i=n.n(o),s=n(4),c=n.n(s),u=n(0),l=n.n(u),p=(n(11),n(27),n(1));t.default=function(e){var t,n=e.callbacks,r=e.getComponent,o=e.specPath,s=r("OperationContainer",!0);if(!n)return l.a.createElement("span",null,"No callbacks");var u=c()(t=n.entrySeq()).call(t,(function(t){var n,r=i()(t,2),u=r[0],f=r[1];return l.a.createElement("div",{key:u},l.a.createElement("h2",null,u),c()(n=f.entrySeq()).call(n,(function(t){var n,r=i()(t,2),f=r[0],d=r[1];return"$$ref"===f?null:l.a.createElement("div",{key:f},c()(n=d.entrySeq()).call(n,(function(t){var n=i()(t,2),r=n[0],c=n[1];if("$$ref"===r)return null;var d=Object(p.fromJS)({operation:c});return l.a.createElement(s,a()({},e,{op:d,key:r,tag:"",method:r,path:f,specPath:o.push(u,f,r),allowTryItOut:!1}))})))})))}));return l.a.createElement("div",null,u)}},function(e,t,n){"use strict";n.r(t);var r=n(6),a=n.n(r),o=n(7),i=n.n(o),s=n(8),c=n.n(s),u=n(9),l=n.n(u),p=n(30),f=n.n(p),d=n(4),h=n.n(d),m=n(0),v=n.n(m),g=(n(11),n(27),function(e){c()(n,e);var t=l()(n);function n(){return a()(this,n),t.apply(this,arguments)}return i()(n,[{key:"render",value:function(){var e=this.props,t=e.link,n=e.name,r=(0,e.getComponent)("Markdown",!0),a=t.get("operationId")||t.get("operationRef"),o=t.get("parameters")&&t.get("parameters").toJS(),i=t.get("description");return v.a.createElement("div",{className:"operation-link"},v.a.createElement("div",{className:"description"},v.a.createElement("b",null,v.a.createElement("code",null,n)),i?v.a.createElement(r,{source:i}):null),v.a.createElement("pre",null,"Operation `",a,"`",v.a.createElement("br",null),v.a.createElement("br",null),"Parameters ",function(e,t){var n;if("string"!=typeof t)return"";return h()(n=t.split("\n")).call(n,(function(t,n){return n>0?Array(e+1).join(" ")+t:t})).join("\n")}(0,f()(o,null,2))||"{}",v.a.createElement("br",null)))}}]),n}(m.Component));t.default=g},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return C}));var r=n(16),a=n.n(r),o=n(6),i=n.n(o),s=n(7),c=n.n(s),u=n(10),l=n.n(u),p=n(8),f=n.n(p),d=n(9),h=n.n(d),m=n(3),v=n.n(m),g=n(2),y=n.n(g),b=n(56),E=n.n(b),x=n(4),S=n.n(x),w=n(0),j=n.n(w),O=n(1),C=(n(11),n(27),function(e){f()(n,e);var t=h()(n);function n(){var e,r;i()(this,n);for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return r=t.call.apply(t,y()(e=[this]).call(e,o)),v()(l()(r),"onServerChange",(function(e){r.setServer(e.target.value)})),v()(l()(r),"onServerVariableValueChange",(function(e){var t=r.props,n=t.setServerVariableValue,a=t.currentServer,o=e.target.getAttribute("data-variable"),i=e.target.value;"function"==typeof n&&n({server:a,key:o,val:i})})),v()(l()(r),"setServer",(function(e){(0,r.props.setSelectedServer)(e)})),r}return c()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.servers;e.currentServer||this.setServer(t.first().get("url"))}},{key:"componentWillReceiveProps",value:function(e){var t=e.servers,n=e.setServerVariableValue,r=e.getServerVariable;if(this.props.currentServer!==e.currentServer||this.props.servers!==e.servers){var a=E()(t).call(t,(function(t){return t.get("url")===e.currentServer}));if(!a)return this.setServer(t.first().get("url"));var o=a.get("variables")||Object(O.OrderedMap)();S()(o).call(o,(function(t,a){r(e.currentServer,a)||n({server:e.currentServer,key:a,val:t.get("default")||""})}))}}},{key:"render",value:function(){var e,t,n=this,r=this.props,o=r.servers,i=r.currentServer,s=r.getServerVariable,c=r.getEffectiveServerValue,u=(E()(o).call(o,(function(e){return e.get("url")===i}))||Object(O.OrderedMap)()).get("variables")||Object(O.OrderedMap)(),l=0!==u.size;return j.a.createElement("div",{className:"servers"},j.a.createElement("label",{htmlFor:"servers"},j.a.createElement("select",{onChange:this.onServerChange,value:i},S()(e=o.valueSeq()).call(e,(function(e){return j.a.createElement("option",{value:e.get("url"),key:e.get("url")},e.get("url"),e.get("description")&&" - ".concat(e.get("description")))})).toArray())),l?j.a.createElement("div",null,j.a.createElement("div",{className:"computed-url"},"Computed URL:",j.a.createElement("code",null,c(i))),j.a.createElement("h4",null,"Server variables"),j.a.createElement("table",null,j.a.createElement("tbody",null,S()(t=u.entrySeq()).call(t,(function(e){var t,r=a()(e,2),o=r[0],c=r[1];return j.a.createElement("tr",{key:o},j.a.createElement("td",null,o),j.a.createElement("td",null,c.get("enum")?j.a.createElement("select",{"data-variable":o,onChange:n.onServerVariableValueChange},S()(t=c.get("enum")).call(t,(function(e){return j.a.createElement("option",{selected:e===s(i,o),key:e,value:e},e)}))):j.a.createElement("input",{type:"text",value:s(i,o)||"",onChange:n.onServerVariableValueChange,"data-variable":o})))}))))):null)}}]),n}(j.a.Component))},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return d}));var r=n(6),a=n.n(r),o=n(7),i=n.n(o),s=n(8),c=n.n(s),u=n(9),l=n.n(u),p=n(0),f=n.n(p),d=(n(11),function(e){c()(n,e);var t=l()(n);function n(){return a()(this,n),t.apply(this,arguments)}return i()(n,[{key:"render",value:function(){var e=this.props,t=e.specSelectors,n=e.oas3Selectors,r=e.oas3Actions,a=e.getComponent,o=t.servers(),i=a("Servers");return o&&o.size?f.a.createElement("div",null,f.a.createElement("span",{className:"servers-title"},"Servers"),f.a.createElement(i,{servers:o,currentServer:n.selectedServer(),setSelectedServer:r.setSelectedServer,setServerVariableValue:r.setServerVariableValue,getServerVariable:n.serverVariableValue,getEffectiveServerValue:n.serverEffectiveValue})):null}}]),n}(f.a.Component))},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return x}));var r=n(6),a=n.n(r),o=n(7),i=n.n(o),s=n(10),c=n.n(s),u=n(8),l=n.n(u),p=n(9),f=n.n(p),d=n(3),h=n.n(d),m=n(0),v=n.n(m),g=(n(11),n(54)),y=n.n(g),b=n(5),E=Function.prototype,x=function(e){l()(n,e);var t=f()(n);function n(e,r){var o;return a()(this,n),o=t.call(this,e,r),h()(c()(o),"applyDefaultValue",(function(e){var t=e||o.props,n=t.onChange,r=t.defaultValue;return o.setState({value:r}),n(r)})),h()(c()(o),"onChange",(function(e){o.props.onChange(Object(b.J)(e))})),h()(c()(o),"onDomChange",(function(e){var t=e.target.value;o.setState({value:t},(function(){return o.onChange(t)}))})),o.state={value:Object(b.J)(e.value)||e.defaultValue},e.onChange(e.value),o}return i()(n,[{key:"componentWillReceiveProps",value:function(e){this.props.value!==e.value&&e.value!==this.state.value&&this.setState({value:Object(b.J)(e.value)}),!e.value&&e.defaultValue&&this.state.value&&this.applyDefaultValue(e)}},{key:"render",value:function(){var e=this.props,t=e.getComponent,n=e.errors,r=this.state.value,a=n.size>0,o=t("TextArea");return v.a.createElement("div",{className:"body-param"},v.a.createElement(o,{className:y()("body-param__text",{invalid:a}),title:n.size?n.join(", "):"",value:r,onChange:this.onDomChange}))}}]),n}(m.PureComponent);h()(x,"defaultProps",{onChange:E,userHasEditedBody:!1})},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return w}));var r=n(6),a=n.n(r),o=n(7),i=n.n(o),s=n(10),c=n.n(s),u=n(8),l=n.n(u),p=n(9),f=n.n(p),d=n(3),h=n.n(d),m=n(22),v=n.n(m),g=n(12),y=n.n(g),b=n(4),E=n.n(b),x=n(0),S=n.n(x),w=(n(11),function(e){l()(n,e);var t=f()(n);function n(e,r){var o;a()(this,n),o=t.call(this,e,r),h()(c()(o),"onChange",(function(e){var t=o.props.onChange,n=e.target,r=n.value,a=n.name,i=v()({},o.state.value);a?i[a]=r:i=r,o.setState({value:i},(function(){return t(o.state)}))}));var i=o.props,s=i.name,u=i.schema,l=o.getValue();return o.state={name:s,schema:u,value:l},o}return i()(n,[{key:"getValue",value:function(){var e=this.props,t=e.name,n=e.authorized;return n&&n.getIn([t,"value"])}},{key:"render",value:function(){var e,t,n=this.props,r=n.schema,a=n.getComponent,o=n.errSelectors,i=n.name,s=a("Input"),c=a("Row"),u=a("Col"),l=a("authError"),p=a("Markdown",!0),f=a("JumpToPath",!0),d=(r.get("scheme")||"").toLowerCase(),h=this.getValue(),m=y()(e=o.allErrors()).call(e,(function(e){return e.get("authId")===i}));if("basic"===d){var v,g=h?h.get("username"):null;return S.a.createElement("div",null,S.a.createElement("h4",null,S.a.createElement("code",null,i||r.get("name"))," (http, Basic)",S.a.createElement(f,{path:["securityDefinitions",i]})),g&&S.a.createElement("h6",null,"Authorized"),S.a.createElement(c,null,S.a.createElement(p,{source:r.get("description")})),S.a.createElement(c,null,S.a.createElement("label",null,"Username:"),g?S.a.createElement("code",null," ",g," "):S.a.createElement(u,null,S.a.createElement(s,{type:"text",required:"required",name:"username",onChange:this.onChange,autoFocus:!0}))),S.a.createElement(c,null,S.a.createElement("label",null,"Password:"),g?S.a.createElement("code",null," ****** "):S.a.createElement(u,null,S.a.createElement(s,{autoComplete:"new-password",name:"password",type:"password",onChange:this.onChange}))),E()(v=m.valueSeq()).call(v,(function(e,t){return S.a.createElement(l,{error:e,key:t})})))}return"bearer"===d?S.a.createElement("div",null,S.a.createElement("h4",null,S.a.createElement("code",null,i||r.get("name"))," (http, Bearer)",S.a.createElement(f,{path:["securityDefinitions",i]})),h&&S.a.createElement("h6",null,"Authorized"),S.a.createElement(c,null,S.a.createElement(p,{source:r.get("description")})),S.a.createElement(c,null,S.a.createElement("label",null,"Value:"),h?S.a.createElement("code",null," ****** "):S.a.createElement(u,null,S.a.createElement(s,{type:"text",onChange:this.onChange,autoFocus:!0}))),E()(t=m.valueSeq()).call(t,(function(e,t){return S.a.createElement(l,{error:e,key:t})}))):S.a.createElement("div",null,S.a.createElement("em",null,S.a.createElement("b",null,i)," HTTP authentication: unsupported scheme ","'".concat(d,"'")))}}]),n}(S.a.Component))},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return x}));var r=n(25),a=n.n(r),o=n(6),i=n.n(o),s=n(7),c=n.n(s),u=n(10),l=n.n(u),p=n(8),f=n.n(p),d=n(9),h=n.n(d),m=n(3),v=n.n(m),g=n(2),y=n.n(g),b=n(0),E=n.n(b),x=(n(11),n(27),function(e){f()(n,e);var t=h()(n);function n(){var e,r;i()(this,n);for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];return r=t.call.apply(t,y()(e=[this]).call(e,s)),v()(l()(r),"setSelectedServer",(function(e){var t,n=r.props,a=n.path,o=n.method;return r.forceUpdate(),r.props.setSelectedServer(e,y()(t="".concat(a,":")).call(t,o))})),v()(l()(r),"setServerVariableValue",(function(e){var t,n=r.props,o=n.path,i=n.method;return r.forceUpdate(),r.props.setServerVariableValue(a()(a()({},e),{},{namespace:y()(t="".concat(o,":")).call(t,i)}))})),v()(l()(r),"getSelectedServer",(function(){var e,t=r.props,n=t.path,a=t.method;return r.props.getSelectedServer(y()(e="".concat(n,":")).call(e,a))})),v()(l()(r),"getServerVariable",(function(e,t){var n,a=r.props,o=a.path,i=a.method;return r.props.getServerVariable({namespace:y()(n="".concat(o,":")).call(n,i),server:e},t)})),v()(l()(r),"getEffectiveServerValue",(function(e){var t,n=r.props,a=n.path,o=n.method;return r.props.getEffectiveServerValue({server:e,namespace:y()(t="".concat(a,":")).call(t,o)})})),r}return c()(n,[{key:"render",value:function(){var e=this.props,t=e.operationServers,n=e.pathServers,r=e.getComponent;if(!t&&!n)return null;var a=r("Servers"),o=t||n,i=t?"operation":"path";return E.a.createElement("div",{className:"opblock-section operation-servers"},E.a.createElement("div",{className:"opblock-section-header"},E.a.createElement("div",{className:"tab-header"},E.a.createElement("h4",{className:"opblock-title"},"Servers"))),E.a.createElement("div",{className:"opblock-description-wrapper"},E.a.createElement("h4",{className:"message"},"These ",i,"-level options override the global server options."),E.a.createElement(a,{servers:o,currentServer:this.getSelectedServer(),setSelectedServer:this.setSelectedServer,setServerVariableValue:this.setServerVariableValue,getServerVariable:this.getServerVariable,getEffectiveServerValue:this.getEffectiveServerValue})))}}]),n}(E.a.Component))},function(e,t,n){"use strict";n.r(t);var r=n(258),a=n(259),o=n(260),i=n(261),s=n(262),c=n(263);t.default={Markdown:r.default,AuthItem:a.default,JsonSchema_string:c.default,VersionStamp:o.default,model:s.default,onlineValidatorBadge:i.default}},function(e,t,n){"use strict";n.r(t),n.d(t,"Markdown",(function(){return d}));var r=n(84),a=n.n(r),o=n(0),i=n.n(o),s=(n(11),n(54)),c=n.n(s),u=n(173),l=n(32),p=n(174),f=new u.Remarkable("commonmark");f.block.ruler.enable(["table"]),f.set({linkTarget:"_blank"});var d=function(e){var t=e.source,n=e.className,r=void 0===n?"":n,o=e.getConfigs;if("string"!=typeof t)return null;if(t){var s,u=o().useUnsafeMarkdown,l=f.render(t),d=Object(p.b)(l,{useUnsafeMarkdown:u});return"string"==typeof d&&(s=a()(d).call(d)),i.a.createElement("div",{dangerouslySetInnerHTML:{__html:s},className:c()(r,"renderedMarkdown")})}return null};d.defaultProps={getConfigs:function(){return{useUnsafeMarkdown:!1}}},t.default=Object(l.OAS3ComponentWrapFactory)(d)},function(e,t,n){"use strict";n.r(t);var r=n(49),a=n.n(r),o=n(0),i=n.n(o),s=n(32);t.default=Object(s.OAS3ComponentWrapFactory)((function(e){var t=e.Ori,n=a()(e,["Ori"]),r=n.schema,o=n.getComponent,s=n.errSelectors,c=n.authorized,u=n.onAuthChange,l=n.name,p=o("HttpAuth");return"http"===r.get("type")?i.a.createElement(p,{key:l,schema:r,name:l,errSelectors:s,authorized:c,getComponent:o,onChange:u}):i.a.createElement(t,n)}))},function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),o=n(32);t.default=Object(o.OAS3ComponentWrapFactory)((function(e){var t=e.Ori;return a.a.createElement("span",null,a.a.createElement(t,e),a.a.createElement("small",{className:"version-stamp"},a.a.createElement("pre",{className:"version"},"OAS3")))}))},function(e,t,n){"use strict";n.r(t);var r=n(32),a=n(170);t.default=Object(r.OAS3ComponentWrapFactory)(a.a)},function(e,t,n){"use strict";n.r(t);var r=n(28),a=n.n(r),o=n(6),i=n.n(o),s=n(7),c=n.n(s),u=n(8),l=n.n(u),p=n(9),f=n.n(p),d=n(0),h=n.n(d),m=(n(11),n(32)),v=n(172),g=function(e){l()(n,e);var t=f()(n);function n(){return i()(this,n),t.apply(this,arguments)}return c()(n,[{key:"render",value:function(){var e=this.props,t=e.getConfigs,n=["model-box"],r=null;return!0===e.schema.get("deprecated")&&(n.push("deprecated"),r=h.a.createElement("span",{className:"model-deprecated-warning"},"Deprecated:")),h.a.createElement("div",{className:n.join(" ")},r,h.a.createElement(v.a,a()({},this.props,{getConfigs:t,depth:1,expandDepth:this.props.expandDepth||0})))}}]),n}(d.Component);t.default=Object(m.OAS3ComponentWrapFactory)(g)},function(e,t,n){"use strict";n.r(t);var r=n(49),a=n.n(r),o=n(0),i=n.n(o),s=n(32);t.default=Object(s.OAS3ComponentWrapFactory)((function(e){var t=e.Ori,n=a()(e,["Ori"]),r=n.schema,o=n.getComponent,s=n.errors,c=n.onChange,u=r&&r.get?r.get("format"):null,l=r&&r.get?r.get("type"):null,p=o("Input");return l&&"string"===l&&u&&("binary"===u||"base64"===u)?i.a.createElement(p,{type:"file",className:s.length?"invalid":"",title:s.length?s:"",onChange:function(e){c(e.target.files[0])},disabled:t.isDisabled}):i.a.createElement(t,n)}))},function(e,t,n){"use strict";n.r(t),n.d(t,"selectedServer",(function(){return x})),n.d(t,"requestBodyValue",(function(){return S})),n.d(t,"shouldRetainRequestBodyValue",(function(){return w})),n.d(t,"hasUserEditedBody",(function(){return j})),n.d(t,"requestBodyInclusionSetting",(function(){return O})),n.d(t,"requestBodyErrors",(function(){return C})),n.d(t,"activeExamplesMember",(function(){return _})),n.d(t,"requestContentType",(function(){return A})),n.d(t,"responseContentType",(function(){return k})),n.d(t,"serverVariableValue",(function(){return I})),n.d(t,"serverVariables",(function(){return P})),n.d(t,"serverEffectiveValue",(function(){return T})),n.d(t,"validateBeforeExecute",(function(){return R})),n.d(t,"validateShallowRequired",(function(){return N}));var r=n(15),a=n.n(r),o=n(2),i=n.n(o),s=n(4),c=n.n(s),u=n(18),l=n.n(u),p=n(17),f=n.n(p),d=n(14),h=n.n(d),m=n(1),v=n(32),g=n(132),y=n(5);function b(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(t){var r=t.getSystem().specSelectors.specJson();return Object(v.isOAS3)(r)?e.apply(void 0,n):null}}}var E,x=b((function(e,t){var n=t?[t,"selectedServer"]:["selectedServer"];return e.getIn(n)||""})),S=b((function(e,t,n){return e.getIn(["requestData",t,n,"bodyValue"])||null})),w=b((function(e,t,n){return e.getIn(["requestData",t,n,"retainBodyValue"])||!1})),j=function(e,t,n){return function(e){var r=e.getSystem(),a=r.oas3Selectors,o=r.specSelectors,i=o.specJson();if(Object(v.isOAS3)(i)){var s=!1,c=a.requestContentType(t,n),u=a.requestBodyValue(t,n);if(m.Map.isMap(u)&&(u=Object(y.J)(u.mapEntries((function(e){return m.Map.isMap(e[1])?[e[0],e[1].get("value")]:e})).toJS())),m.List.isList(u)&&(u=Object(y.J)(u)),c){var l=Object(g.getDefaultRequestBodyValue)(o.specResolvedSubtree(["paths",t,n,"requestBody"]),c,a.activeExamplesMember(t,n,"requestBody","requestBody"));s=!!u&&u!==l}return s}return null}},O=b((function(e,t,n){return e.getIn(["requestData",t,n,"bodyInclusion"])||Object(m.Map)()})),C=b((function(e,t,n){return e.getIn(["requestData",t,n,"errors"])||null})),_=b((function(e,t,n,r,a){return e.getIn(["examples",t,n,r,a,"activeExample"])||null})),A=b((function(e,t,n){return e.getIn(["requestData",t,n,"requestContentType"])||null})),k=b((function(e,t,n){return e.getIn(["requestData",t,n,"responseContentType"])||null})),I=b((function(e,t,n){var r;if("string"!=typeof t){var a=t.server,o=t.namespace;r=o?[o,"serverVariableValues",a,n]:["serverVariableValues",a,n]}else{r=["serverVariableValues",t,n]}return e.getIn(r)||null})),P=b((function(e,t){var n;if("string"!=typeof t){var r=t.server,a=t.namespace;n=a?[a,"serverVariableValues",r]:["serverVariableValues",r]}else{n=["serverVariableValues",t]}return e.getIn(n)||Object(m.OrderedMap)()})),T=b((function(e,t){var n,r;if("string"!=typeof t){var a=t.server,o=t.namespace;r=a,n=o?e.getIn([o,"serverVariableValues",r]):e.getIn(["serverVariableValues",r])}else r=t,n=e.getIn(["serverVariableValues",r]);n=n||Object(m.OrderedMap)();var i=r;return c()(n).call(n,(function(e,t){i=i.replace(new RegExp("{".concat(t,"}"),"g"),e)})),i})),R=(E=function(e,t){return function(e,t){var n;return t=t||[],!!e.getIn(i()(n=["requestData"]).call(n,a()(t),["bodyValue"]))}(e,t)},function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){var n,r,o=e.getSystem().specSelectors.specJson(),s=i()(n=[]).call(n,t)[1]||[];return!o.getIn(i()(r=["paths"]).call(r,a()(s),["requestBody","required"]))||E.apply(void 0,t)}}),N=function(e,t){var n,r=t.oas3RequiredRequestBodyContentType,a=t.oas3RequestContentType,o=t.oas3RequestBodyValue,i=[];if(!m.Map.isMap(o))return i;var s=[];return l()(n=f()(r.requestContentType)).call(n,(function(e){if(e===a){var t=r.requestContentType[e];l()(t).call(t,(function(e){h()(s).call(s,e)<0&&s.push(e)}))}})),l()(s).call(s,(function(e){o.getIn([e,"value"])||i.push(e)})),i}},function(e,t,n){"use strict";n.r(t);var r,a=n(3),o=n.n(a),i=n(280),s=n.n(i),c=n(16),u=n.n(c),l=n(102),p=n.n(l),f=n(23),d=n.n(f),h=n(18),m=n.n(h),v=n(21),g=n.n(v),y=n(1),b=n(50);t.default=(r={},o()(r,b.UPDATE_SELECTED_SERVER,(function(e,t){var n=t.payload,r=n.selectedServerUrl,a=n.namespace,o=a?[a,"selectedServer"]:["selectedServer"];return e.setIn(o,r)})),o()(r,b.UPDATE_REQUEST_BODY_VALUE,(function(e,t){var n=t.payload,r=n.value,a=n.pathMethod,o=u()(a,2),i=o[0],c=o[1];if(!y.Map.isMap(r))return e.setIn(["requestData",i,c,"bodyValue"],r);var l,f=e.getIn(["requestData",i,c,"bodyValue"])||Object(y.Map)();y.Map.isMap(f)||(f=Object(y.Map)());var h=p()(r).call(r),v=s()(h),g=d()(v).call(v,0);return m()(g).call(g,(function(e){var t=r.getIn([e]);f.has(e)&&y.Map.isMap(t)||(l=f.setIn([e,"value"],t))})),e.setIn(["requestData",i,c,"bodyValue"],l)})),o()(r,b.UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG,(function(e,t){var n=t.payload,r=n.value,a=n.pathMethod,o=u()(a,2),i=o[0],s=o[1];return e.setIn(["requestData",i,s,"retainBodyValue"],r)})),o()(r,b.UPDATE_REQUEST_BODY_INCLUSION,(function(e,t){var n=t.payload,r=n.value,a=n.pathMethod,o=n.name,i=u()(a,2),s=i[0],c=i[1];return e.setIn(["requestData",s,c,"bodyInclusion",o],r)})),o()(r,b.UPDATE_ACTIVE_EXAMPLES_MEMBER,(function(e,t){var n=t.payload,r=n.name,a=n.pathMethod,o=n.contextType,i=n.contextName,s=u()(a,2),c=s[0],l=s[1];return e.setIn(["examples",c,l,o,i,"activeExample"],r)})),o()(r,b.UPDATE_REQUEST_CONTENT_TYPE,(function(e,t){var n=t.payload,r=n.value,a=n.pathMethod,o=u()(a,2),i=o[0],s=o[1];return e.setIn(["requestData",i,s,"requestContentType"],r)})),o()(r,b.UPDATE_RESPONSE_CONTENT_TYPE,(function(e,t){var n=t.payload,r=n.value,a=n.path,o=n.method;return e.setIn(["requestData",a,o,"responseContentType"],r)})),o()(r,b.UPDATE_SERVER_VARIABLE_VALUE,(function(e,t){var n=t.payload,r=n.server,a=n.namespace,o=n.key,i=n.val,s=a?[a,"serverVariableValues",r,o]:["serverVariableValues",r,o];return e.setIn(s,i)})),o()(r,b.SET_REQUEST_BODY_VALIDATE_ERROR,(function(e,t){var n=t.payload,r=n.path,a=n.method,o=n.validationErrors,i=[];if(i.push("Required field is not provided"),o.missingBodyValue)return e.setIn(["requestData",r,a,"errors"],Object(y.fromJS)(i));if(o.missingRequiredKeys&&o.missingRequiredKeys.length>0){var s=o.missingRequiredKeys;return e.updateIn(["requestData",r,a,"bodyValue"],Object(y.fromJS)({}),(function(e){return g()(s).call(s,(function(e,t){return e.setIn([t,"errors"],Object(y.fromJS)(i))}),e)}))}return console.warn("unexpected result: SET_REQUEST_BODY_VALIDATE_ERROR"),e})),o()(r,b.CLEAR_REQUEST_BODY_VALIDATE_ERROR,(function(e,t){var n=t.payload,r=n.path,a=n.method,o=e.getIn(["requestData",r,a,"bodyValue"]);if(!y.Map.isMap(o))return e.setIn(["requestData",r,a,"errors"],Object(y.fromJS)([]));var i=p()(o).call(o),c=s()(i),u=d()(c).call(c,0);return u?e.updateIn(["requestData",r,a,"bodyValue"],Object(y.fromJS)({}),(function(e){return g()(u).call(u,(function(e,t){return e.setIn([t,"errors"],Object(y.fromJS)([]))}),e)})):e})),o()(r,b.CLEAR_REQUEST_BODY_VALUE,(function(e,t){var n=t.payload.pathMethod,r=u()(n,2),a=r[0],o=r[1],i=e.getIn(["requestData",a,o,"bodyValue"]);return i?y.Map.isMap(i)?e.setIn(["requestData",a,o,"bodyValue"],Object(y.Map)()):e.setIn(["requestData",a,o,"bodyValue"],""):e})),r)},function(e,t,n){"use strict";n.r(t);var r,a=n(18),o=n.n(a),i=n(102),s=n.n(i),c=n(5),u=n(764),l={};o()(r=s()(u).call(u)).call(r,(function(e){if("./index.js"!==e){var t=u(e);l[Object(c.E)(e)]=t.default?t.default:t}})),t.default=l},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"path",(function(){return Mn})),n.d(r,"query",(function(){return Dn})),n.d(r,"header",(function(){return Bn})),n.d(r,"cookie",(function(){return Ln}));var a=n(2),o=n.n(a),i=n(37),s=n.n(i),c=n(66),u=n.n(c),l=n(18),p=n.n(l),f=n(12),d=n.n(f),h=n(45),m=n.n(h),v=n(388),g=n.n(v),y=n(17),b=n.n(y),E=n(4),x=n.n(E),S=n(85),w=n.n(S),j=n(30),O=n.n(j),C=n(33),_=n.n(C),A=n(13),k=n.n(A),I=n(19),P=n.n(I),T=n(16),R=n.n(T),N=n(164),M=n.n(N),D=n(21),q=n.n(D),B=n(71),L=n.n(B),U=n(35),V=n.n(U),z=n(14),F=n.n(z),J=(n(721),n(175)),W=n.n(J),H=n(65),$=n.n(H),Y=n(165),K=n.n(Y),G=n(55),Z=n.n(G),X=n(166),Q=n(56),ee=n.n(Q),te=n(6),ne=n.n(te),re=n(7),ae=n.n(re),oe=n(389),ie=n.n(oe),se=n(159),ce=n.n(se),ue=n(8),le=n.n(ue),pe=n(9),fe=n.n(pe),de=n(390),he=function(e){var t=function(e,t){return{name:e,value:t}};return Z()(e.prototype.set)||Z()(e.prototype.get)||Z()(e.prototype.getAll)||Z()(e.prototype.has)?e:function(e){le()(r,e);var n=fe()(r);function r(e){var t;return ne()(this,r),(t=n.call(this,e)).entryList=[],t}return ae()(r,[{key:"append",value:function(e,n,a){return this.entryList.push(t(e,n)),ie()(ce()(r.prototype),"append",this).call(this,e,n,a)}},{key:"set",value:function(e,n){var r,a=t(e,n);this.entryList=d()(r=this.entryList).call(r,(function(t){return t.name!==e})),this.entryList.push(a)}},{key:"get",value:function(e){var t,n=ee()(t=this.entryList).call(t,(function(t){return t.name===e}));return void 0===n?null:n}},{key:"getAll",value:function(e){var t,n;return x()(t=d()(n=this.entryList).call(n,(function(t){return t.name===e}))).call(t,(function(e){return e.value}))}},{key:"has",value:function(e){var t;return _()(t=this.entryList).call(t,(function(t){return t.name===e}))}}]),r}(e)}(n.n(de).a),me=n(23),ve=n.n(me),ge=n(15),ye=n.n(ge),be=n(166).Buffer,Ee=function(e){return F()(":/?#[]@!$&'()*+,;=").call(":/?#[]@!$&'()*+,;=",e)>-1},xe=function(e){return/^[a-z0-9\-._~]+$/i.test(e)};function Se(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.escape,a=arguments.length>2?arguments[2]:void 0;return"number"==typeof e&&(e=e.toString()),"string"==typeof e&&e.length&&r?a?JSON.parse(e):x()(t=ye()(e)).call(t,(function(e){var t,n;return xe(e)||Ee(e)&&"unsafe"===r?e:x()(t=x()(n=be.from(e).toJSON().data||[]).call(n,(function(e){var t;return ve()(t="0".concat(e.toString(16).toUpperCase())).call(t,-2)}))).call(t,(function(e){return"%".concat(e)})).join("")})).join(""):e}function we(e){var t=e.value;return k()(t)?function(e){var t,n=e.key,r=e.value,a=e.style,i=e.explode,s=e.escape,c=function(e){return Se(e,{escape:s})};if("simple"===a)return x()(r).call(r,(function(e){return c(e)})).join(",");if("label"===a)return".".concat(x()(r).call(r,(function(e){return c(e)})).join("."));if("matrix"===a)return q()(t=x()(r).call(r,(function(e){return c(e)}))).call(t,(function(e,t){var r,a,s;return!e||i?o()(a=o()(s="".concat(e||"",";")).call(s,n,"=")).call(a,t):o()(r="".concat(e,",")).call(r,t)}),"");if("form"===a){var u=i?"&".concat(n,"="):",";return x()(r).call(r,(function(e){return c(e)})).join(u)}if("spaceDelimited"===a){var l=i?"".concat(n,"="):"";return x()(r).call(r,(function(e){return c(e)})).join(" ".concat(l))}if("pipeDelimited"===a){var p=i?"".concat(n,"="):"";return x()(r).call(r,(function(e){return c(e)})).join("|".concat(p))}return}(e):"object"===P()(t)?function(e){var t=e.key,n=e.value,r=e.style,a=e.explode,i=e.escape,s=function(e){return Se(e,{escape:i})},c=b()(n);if("simple"===r)return q()(c).call(c,(function(e,t){var r,i,c,u=s(n[t]),l=a?"=":",",p=e?"".concat(e,","):"";return o()(r=o()(i=o()(c="".concat(p)).call(c,t)).call(i,l)).call(r,u)}),"");if("label"===r)return q()(c).call(c,(function(e,t){var r,i,c,u=s(n[t]),l=a?"=":".",p=e?"".concat(e,"."):".";return o()(r=o()(i=o()(c="".concat(p)).call(c,t)).call(i,l)).call(r,u)}),"");if("matrix"===r&&a)return q()(c).call(c,(function(e,t){var r,a,i=s(n[t]),c=e?"".concat(e,";"):";";return o()(r=o()(a="".concat(c)).call(a,t,"=")).call(r,i)}),"");if("matrix"===r)return q()(c).call(c,(function(e,r){var a,i,c=s(n[r]),u=e?"".concat(e,","):";".concat(t,"=");return o()(a=o()(i="".concat(u)).call(i,r,",")).call(a,c)}),"");if("form"===r)return q()(c).call(c,(function(e,t){var r,i,c,u,l=s(n[t]),p=e?o()(r="".concat(e)).call(r,a?"&":","):"",f=a?"=":",";return o()(i=o()(c=o()(u="".concat(p)).call(u,t)).call(c,f)).call(i,l)}),"");return}(e):function(e){var t,n=e.key,r=e.value,a=e.style,i=e.escape,s=function(e){return Se(e,{escape:i})};if("simple"===a)return s(r);if("label"===a)return".".concat(s(r));if("matrix"===a)return o()(t=";".concat(n,"=")).call(t,s(r));if("form"===a)return s(r);if("deepObject"===a)return s(r,{},!0);return}(e)}var je={serializeRes:ke,mergeInQueryOrForm:Ue};function Oe(e){return Ce.apply(this,arguments)}function Ce(){return(Ce=u()(s.a.mark((function e(t){var n,r,a,o,i,c,u=arguments;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:{},"object"===P()(t)&&(t=(n=t).url),n.headers=n.headers||{},je.mergeInQueryOrForm(n),n.headers&&p()(r=b()(n.headers)).call(r,(function(e){var t=n.headers[e];"string"==typeof t&&(n.headers[e]=t.replace(/\n+/g," "))})),!n.requestInterceptor){e.next=12;break}return e.next=8,n.requestInterceptor(n);case 8:if(e.t0=e.sent,e.t0){e.next=11;break}e.t0=n;case 11:n=e.t0;case 12:return a=n.headers["content-type"]||n.headers["Content-Type"],/multipart\/form-data/i.test(a)&&(delete n.headers["content-type"],delete n.headers["Content-Type"]),e.prev=14,e.next=17,(n.userFetch||fetch)(n.url,n);case 17:return o=e.sent,e.next=20,je.serializeRes(o,t,n);case 20:if(o=e.sent,!n.responseInterceptor){e.next=28;break}return e.next=24,n.responseInterceptor(o);case 24:if(e.t1=e.sent,e.t1){e.next=27;break}e.t1=o;case 27:o=e.t1;case 28:e.next=39;break;case 30:if(e.prev=30,e.t2=e.catch(14),o){e.next=34;break}throw e.t2;case 34:throw(i=new Error(o.statusText)).status=o.status,i.statusCode=o.status,i.responseError=e.t2,i;case 39:if(o.ok){e.next=45;break}throw(c=new Error(o.statusText)).status=o.status,c.statusCode=o.status,c.response=o,c;case 45:return e.abrupt("return",o);case 46:case"end":return e.stop()}}),e,null,[[14,30]])})))).apply(this,arguments)}var _e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(e)};function Ae(e,t){return t&&(0===F()(t).call(t,"application/json")||F()(t).call(t,"+json")>0)?JSON.parse(e):$.a.safeLoad(e)}function ke(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.loadSpec,a=void 0!==r&&r,o={ok:e.ok,url:e.url||t,status:e.status,statusText:e.statusText,headers:Pe(e.headers)},i=o.headers["content-type"],s=a||_e(i),c=s?e.text:e.blob||e.buffer;return c.call(e).then((function(e){if(o.text=e,o.data=e,s)try{var t=Ae(e,i);o.body=t,o.obj=t}catch(e){o.parseError=e}return o}))}function Ie(e){return V()(e).call(e,", ")?e.split(", "):e}function Pe(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Z()(L()(t))?q()(e=M()(L()(t).call(t))).call(e,(function(e,t){var n=R()(t,2),r=n[0],a=n[1];return e[r]=Ie(a),e}),{}):{}}function Te(e,t){return t||"undefined"==typeof navigator||(t=navigator),t&&"ReactNative"===t.product?!(!e||"object"!==P()(e)||"string"!=typeof e.uri):"undefined"!=typeof File&&e instanceof File||("undefined"!=typeof Blob&&e instanceof Blob||(void 0!==X.Buffer&&e instanceof X.Buffer||null!==e&&"object"===P()(e)&&"function"==typeof e.pipe))}function Re(e,t){return k()(e)&&_()(e).call(e,(function(e){return Te(e,t)}))}var Ne={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Me={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function De(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.collectionFormat,a=t.allowEmptyValue,o=t.serializationOption,i=t.encoding,s="object"!==P()(t)||k()(t)?t:t.value,c=n?function(e){return e.toString()}:function(e){return encodeURIComponent(e)},u=c(e);if(void 0===s&&a)return[[u,""]];if(Te(s)||Re(s))return[[u,s]];if(o)return qe(e,s,n,o);if(i){var l;if(_()(l=[P()(i.style),P()(i.explode),P()(i.allowReserved)]).call(l,(function(e){return"undefined"!==e})))return qe(e,s,n,K()(i,["style","explode","allowReserved"]));if(i.contentType){if("application/json"===i.contentType){var p="string"==typeof s?s:O()(s);return[[u,c(p)]]}return[[u,c(s.toString())]]}return"object"!==P()(s)?[[u,c(s)]]:k()(s)&&w()(s).call(s,(function(e){return"object"!==P()(e)}))?[[u,x()(s).call(s,c).join(",")]]:[[u,c(O()(s))]]}return"object"!==P()(s)?[[u,c(s)]]:k()(s)?"multi"===r?[[u,x()(s).call(s,c)]]:[[u,x()(s).call(s,c).join(Me[r||"csv"])]]:[[u,""]]}function qe(e,t,n,r){var a,i,s,c=r.style||"form",u=void 0===r.explode?"form"===c:r.explode,l=!n&&(r&&r.allowReserved?"unsafe":"reserved"),p=function(e){return Se(e,{escape:l})},f=n?function(e){return e}:function(e){return Se(e,{escape:l})};return"object"!==P()(t)?[[f(e),p(t)]]:k()(t)?u?[[f(e),x()(t).call(t,p)]]:[[f(e),x()(t).call(t,p).join(Ne[c])]]:"deepObject"===c?x()(i=b()(t)).call(i,(function(n){var r;return[f(o()(r="".concat(e,"[")).call(r,n,"]")),p(t[n])]})):u?x()(s=b()(t)).call(s,(function(e){return[f(e),p(t[e])]})):[[f(e),x()(a=b()(t)).call(a,(function(e){var n;return[o()(n="".concat(f(e),",")).call(n,p(t[e]))]})).join(",")]]}function Be(e){var t;return q()(t=g()(e)).call(t,(function(e,t){var n,r=R()(t,2),a=r[0],o=r[1],i=m()(De(a,o,!0));try{for(i.s();!(n=i.n()).done;){var s=R()(n.value,2),c=s[0],u=s[1];if(k()(u)){var l,p=m()(u);try{for(p.s();!(l=p.n()).done;){var f=l.value;e.append(c,f)}}catch(e){p.e(e)}finally{p.f()}}else e.append(c,u)}}catch(e){i.e(e)}finally{i.f()}return e}),new he)}function Le(e){var t,n=q()(t=b()(e)).call(t,(function(t,n){var r,a=m()(De(n,e[n]));try{for(a.s();!(r=a.n()).done;){var o=R()(r.value,2),i=o[0],s=o[1];t[i]=s}}catch(e){a.e(e)}finally{a.f()}return t}),{});return W.a.stringify(n,{encode:!1,indices:!1})||""}function Ue(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url,n=void 0===t?"":t,r=e.query,a=e.form,o=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=d()(t).call(t,(function(e){return e})).join("&");return r?"?".concat(r):""};if(a){var i,s=_()(i=b()(a)).call(i,(function(e){var t=a[e].value;return Te(t)||Re(t)})),c=e.headers["content-type"]||e.headers["Content-Type"];s||/multipart\/form-data/i.test(c)?e.body=Be(e.form):e.body=Le(a),delete e.form}if(r){var u=n.split("?"),l=R()(u,2),f=l[0],h=l[1],m="";if(h){var v=W.a.parse(h),g=b()(r);p()(g).call(g,(function(e){return delete v[e]})),m=W.a.stringify(v,{encode:!0})}var y=o(m,Le(r));e.url=f+y,delete e.query}return e}var Ve=n(391),ze=n.n(Ve),Fe=n(25),Je=n.n(Fe),We=n(57),He=n.n(We),$e=n(29),Ye=n.n($e),Ke=n(275),Ge=n.n(Ke),Ze=n(22),Xe=n.n(Ze),Qe=n(161),et=n.n(Qe),tt=n(276),nt=n.n(tt),rt=n(3),at=n.n(rt),ot=n(114),it=n(70),st=n.n(it),ct=n(392),ut=n.n(ct),lt={add:function(e,t){return{op:"add",path:e,value:t}},replace:ft,remove:function(e){return{op:"remove",path:e}},merge:function(e,t){return{type:"mutation",op:"merge",path:e,value:t}},mergeDeep:function(e,t){return{type:"mutation",op:"mergeDeep",path:e,value:t}},context:function(e,t){return{type:"context",path:e,value:t}},getIn:function(e,t){return q()(t).call(t,(function(e,t){return void 0!==t&&e?e[t]:e}),e)},applyPatch:function(e,t,n){if(n=n||{},"merge"===(t=Je()(Je()({},t),{},{path:t.path&&pt(t.path)})).op){var r=Ot(e,t.path);Xe()(r,t.value),ot.applyPatch(e,[ft(t.path,r)])}else if("mergeDeep"===t.op){var a=Ot(e,t.path);for(var i in t.value){var s=t.value[i],c=k()(s);if(c){var u=a[i]||[];a[i]=o()(u).call(u,s)}else if(bt(s)&&!c){var l=Je()({},a[i]);for(var p in s){if(Object.prototype.hasOwnProperty.call(l,p)){l=st()(ut()(l),s);break}Xe()(l,at()({},p,s[p]))}a[i]=l}else a[i]=s}}else if("add"===t.op&&""===t.path&&bt(t.value)){var f,d=q()(f=b()(t.value)).call(f,(function(e,n){return e.push({op:"add",path:"/".concat(pt(n)),value:t.value[n]}),e}),[]);ot.applyPatch(e,d)}else if("replace"===t.op&&""===t.path){var h=t.value;n.allowMetaPatches&&t.meta&&wt(t)&&(k()(t.value)||bt(t.value))&&(h=Je()(Je()({},h),t.meta)),e=h}else if(ot.applyPatch(e,[t]),n.allowMetaPatches&&t.meta&&wt(t)&&(k()(t.value)||bt(t.value))){var m=Ot(e,t.path),v=Je()(Je()({},m),t.meta);ot.applyPatch(e,[ft(t.path,v)])}return e},parentPathMatch:function(e,t){if(!k()(t))return!1;for(var n=0,r=t.length;n<r;n+=1)if(t[n]!==e[n])return!1;return!0},flatten:gt,fullyNormalizeArray:function(e){return yt(gt(vt(e)))},normalizeArray:vt,isPromise:function(e){return bt(e)&&Et(e.then)},forEachNew:function(e,t){try{return dt(e,mt,t)}catch(e){return e}},forEachNewPrimitive:function(e,t){try{return dt(e,ht,t)}catch(e){return e}},isJsonPatch:xt,isContextPatch:function(e){return jt(e)&&"context"===e.type},isPatch:jt,isMutation:St,isAdditiveMutation:wt,isGenerator:function(e){return"[object GeneratorFunction]"===Object.prototype.toString.call(e)},isFunction:Et,isObject:bt,isError:function(e){return e instanceof Error}};function pt(e){return k()(e)?e.length<1?"":"/".concat(x()(e).call(e,(function(e){return(e+"").replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")):e}function ft(e,t,n){return{op:"replace",path:e,value:t,meta:n}}function dt(e,t,n){var r;return yt(gt(x()(r=d()(e).call(e,wt)).call(r,(function(e){return t(e.value,n,e.path)}))||[]))}function ht(e,t,n){return n=n||[],k()(e)?x()(e).call(e,(function(e,r){return ht(e,t,o()(n).call(n,r))})):bt(e)?x()(r=b()(e)).call(r,(function(r){return ht(e[r],t,o()(n).call(n,r))})):t(e,n[n.length-1],n);var r}function mt(e,t,n){var r=[];if((n=n||[]).length>0){var a=t(e,n[n.length-1],n);a&&(r=o()(r).call(r,a))}if(k()(e)){var i=x()(e).call(e,(function(e,r){return mt(e,t,o()(n).call(n,r))}));i&&(r=o()(r).call(r,i))}else if(bt(e)){var s,c=x()(s=b()(e)).call(s,(function(r){return mt(e[r],t,o()(n).call(n,r))}));c&&(r=o()(r).call(r,c))}return r=gt(r)}function vt(e){return k()(e)?e:[e]}function gt(e){var t,n,r;return(n=o()(t=[])).call.apply(n,o()(r=[t]).call(r,ye()(x()(e).call(e,(function(e){return k()(e)?gt(e):e})))))}function yt(e){return d()(e).call(e,(function(e){return void 0!==e}))}function bt(e){return e&&"object"===P()(e)}function Et(e){return e&&"function"==typeof e}function xt(e){if(jt(e)){var t=e.op;return"add"===t||"remove"===t||"replace"===t}return!1}function St(e){return xt(e)||jt(e)&&"mutation"===e.type}function wt(e){return St(e)&&("add"===e.op||"replace"===e.op||"merge"===e.op||"mergeDeep"===e.op)}function jt(e){return e&&"object"===P()(e)}function Ot(e,t){try{return ot.getValueByPointer(e,t)}catch(e){return console.error(e),{}}}var Ct=n(393),_t=n.n(Ct),At=n(394),kt=n(277),It=n.n(kt),Pt=n(72),Tt=n.n(Pt);function Rt(e,t){function n(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];this.message=n[0],t&&t.apply(this,n)}return n.prototype=new Error,n.prototype.name=e,n.prototype.constructor=n,n}var Nt=n(395),Mt=n.n(Nt),Dt=n(163),qt=n.n(Dt),Bt=["properties"],Lt=["properties"],Ut=["definitions","parameters","responses","securityDefinitions","components/schemas","components/responses","components/parameters","components/securitySchemes"],Vt=["schema/example","items/example"];function zt(e){var t=e[e.length-1],n=e[e.length-2],r=e.join("/");return F()(Bt).call(Bt,t)>-1&&-1===F()(Lt).call(Lt,n)||F()(Ut).call(Ut,r)>-1||_()(Vt).call(Vt,(function(e){return F()(r).call(r,e)>-1}))}function Ft(e,t){var n,r=e.split("#"),a=R()(r,2),i=a[0],s=a[1],c=Tt.a.resolve(i||"",t||"");return s?o()(n="".concat(c,"#")).call(n,s):c}var Jt="application/json, application/yaml",Wt=new RegExp("^([a-z]+://|//)","i"),Ht=Rt("JSONRefError",(function(e,t,n){this.originalError=n,Xe()(this,t||{})})),$t={},Yt=new _t.a,Kt=[function(e){return"paths"===e[0]&&"responses"===e[3]&&"examples"===e[5]},function(e){return"paths"===e[0]&&"responses"===e[3]&&"content"===e[5]&&"example"===e[7]},function(e){return"paths"===e[0]&&"responses"===e[3]&&"content"===e[5]&&"examples"===e[7]&&"value"===e[9]},function(e){return"paths"===e[0]&&"requestBody"===e[3]&&"content"===e[4]&&"example"===e[6]},function(e){return"paths"===e[0]&&"requestBody"===e[3]&&"content"===e[4]&&"examples"===e[6]&&"value"===e[8]},function(e){return"paths"===e[0]&&"parameters"===e[2]&&"example"===e[4]},function(e){return"paths"===e[0]&&"parameters"===e[3]&&"example"===e[5]},function(e){return"paths"===e[0]&&"parameters"===e[2]&&"examples"===e[4]&&"value"===e[6]},function(e){return"paths"===e[0]&&"parameters"===e[3]&&"examples"===e[5]&&"value"===e[7]},function(e){return"paths"===e[0]&&"parameters"===e[2]&&"content"===e[4]&&"example"===e[6]},function(e){return"paths"===e[0]&&"parameters"===e[2]&&"content"===e[4]&&"examples"===e[6]&&"value"===e[8]},function(e){return"paths"===e[0]&&"parameters"===e[3]&&"content"===e[4]&&"example"===e[7]},function(e){return"paths"===e[0]&&"parameters"===e[3]&&"content"===e[5]&&"examples"===e[7]&&"value"===e[9]}],Gt={key:"$ref",plugin:function(e,t,n,r){var a=r.getInstance(),i=ve()(n).call(n,0,-1);if(!zt(i)&&(s=i,!_()(Kt).call(Kt,(function(e){return e(s)})))){var s,c=r.getContext(n).baseDoc;if("string"!=typeof e)return new Ht("$ref: must be a string (JSON-Ref)",{$ref:e,baseDoc:c,fullPath:n});var u,l,p,f=tn(e),d=f[0],h=f[1]||"";try{u=c||d?Qt(d,c):null}catch(t){return en(t,{pointer:h,$ref:e,basePath:u,fullPath:n})}if(function(e,t,n,r){var a,i,s=Yt.get(r);s||(s={},Yt.set(r,s));var c=function(e){if(0===e.length)return"";return"/".concat(x()(e).call(e,cn).join("/"))}(n),u=o()(a="".concat(t||"<specmap-base>","#")).call(a,e),l=c.replace(/allOf\/\d+\/?/g,""),p=r.contextTree.get([]).baseDoc;if(t==p&&un(l,e))return!0;var f="";if(_()(n).call(n,(function(e){var t,n;return f=o()(t="".concat(f,"/")).call(t,cn(e)),s[f]&&_()(n=s[f]).call(n,(function(e){return un(e,u)||un(u,e)}))})))return!0;return void(s[l]=o()(i=s[l]||[]).call(i,u))}(h,u,i,r)&&!a.useCircularStructures){var m=Ft(e,u);return e===m?null:lt.replace(n,m)}if(null==u?(p=on(h),void 0===(l=r.get(p))&&(l=new Ht("Could not resolve reference: ".concat(e),{pointer:h,$ref:e,baseDoc:c,fullPath:n}))):l=null!=(l=nn(u,h)).__value?l.__value:l.catch((function(t){throw en(t,{pointer:h,$ref:e,baseDoc:c,fullPath:n})})),l instanceof Error)return[lt.remove(n),l];var v=Ft(e,u),g=lt.replace(i,l,{$$ref:v});if(u&&u!==c)return[g,lt.context(i,{baseDoc:u})];try{if(!function(e,t){var n,r=[e];return q()(n=t.path).call(n,(function(e,t){return r.push(e[t]),e[t]}),e),a(t.value);function a(e){var t;return lt.isObject(e)&&(F()(r).call(r,e)>=0||_()(t=b()(e)).call(t,(function(t){return a(e[t])})))}}(r.state,g)||a.useCircularStructures)return g}catch(e){return null}}}},Zt=Xe()(Gt,{docCache:$t,absoluteify:Qt,clearCache:function(e){var t;void 0!==e?delete $t[e]:p()(t=b()($t)).call(t,(function(e){delete $t[e]}))},JSONRefError:Ht,wrapError:en,getDoc:rn,split:tn,extractFromDoc:nn,fetchJSON:function(e){return Object(At.fetch)(e,{headers:{Accept:Jt},loadSpec:!0}).then((function(e){return e.text()})).then((function(e){return $.a.safeLoad(e)}))},extract:an,jsonPointerToArray:on,unescapeJsonPointerToken:sn}),Xt=Zt;function Qt(e,t){if(!Wt.test(e)){var n;if(!t)throw new Ht(o()(n="Tried to resolve a relative URL, without having a basePath. path: '".concat(e,"' basePath: '")).call(n,t,"'"));return Tt.a.resolve(t,e)}return e}function en(e,t){var n,r;e&&e.response&&e.response.body?n=o()(r="".concat(e.response.body.code," ")).call(r,e.response.body.message):n=e.message;return new Ht("Could not resolve reference: ".concat(n),t,e)}function tn(e){return(e+"").split("#")}function nn(e,t){var n=$t[e];if(n&&!lt.isPromise(n))try{var r=an(t,n);return Xe()(He.a.resolve(r),{__value:r})}catch(e){return He.a.reject(e)}return rn(e).then((function(e){return an(t,e)}))}function rn(e){var t=$t[e];return t?lt.isPromise(t)?t:He.a.resolve(t):($t[e]=Zt.fetchJSON(e).then((function(t){return $t[e]=t,t})),$t[e])}function an(e,t){var n=on(e);if(n.length<1)return t;var r=lt.getIn(t,n);if(void 0===r)throw new Ht("Could not resolve pointer: ".concat(e," does not exist in document"),{pointer:e});return r}function on(e){var t;if("string"!=typeof e)throw new TypeError("Expected a string, got a ".concat(P()(e)));return"/"===e[0]&&(e=e.substr(1)),""===e?[]:x()(t=e.split("/")).call(t,sn)}function sn(e){return"string"!=typeof e?e:It.a.unescape(e.replace(/~1/g,"/").replace(/~0/g,"~"))}function cn(e){return It.a.escape(e.replace(/~/g,"~0").replace(/\//g,"~1"))}function un(e,t){if(!(n=t)||"/"===n||"#"===n)return!0;var n,r=e.charAt(t.length),a=ve()(t).call(t,-1);return 0===F()(e).call(e,t)&&(!r||"/"===r||"#"===r)&&"#"!==a}var ln=n(87),pn=n.n(ln),fn={key:"allOf",plugin:function(e,t,n,r,a){if(!a.meta||!a.meta.$$ref){var i=ve()(n).call(n,0,-1);if(!zt(i)){if(!k()(e)){var s=new TypeError("allOf must be an array");return s.fullPath=n,s}var c=!1,u=a.value;if(p()(i).call(i,(function(e){u&&(u=u[e])})),u=Je()({},u),!pn()(u)){delete u.allOf;var l,f=[];if(f.push(r.replace(i,{})),p()(e).call(e,(function(e,t){if(!r.isObject(e)){if(c)return null;c=!0;var a=new TypeError("Elements in allOf must be objects");return a.fullPath=n,f.push(a)}f.push(r.mergeDeep(i,e));var s=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.specmap,i=r.getBaseUrlForNodePath,s=void 0===i?function(e){var n;return a.getContext(o()(n=[]).call(n,ye()(t),ye()(e))).baseDoc}:i,c=r.targetKeys,u=void 0===c?["$ref","$$ref"]:c,l=[];return p()(n=Mt()(e)).call(n,(function(){if(V()(u).call(u,this.key)&&qt()(this.node)){var e=this.path,n=o()(t).call(t,this.path),r=Ft(this.node,s(e));l.push(a.replace(n,r))}})),l}(e,ve()(n).call(n,0,-1),{getBaseUrlForNodePath:function(e){var a;return r.getContext(o()(a=[]).call(a,ye()(n),[t],ye()(e))).baseDoc},specmap:r});f.push.apply(f,ye()(s))})),f.push(r.mergeDeep(i,u)),!u.$$ref)f.push(r.remove(o()(l=[]).call(l,i,"$$ref")));return f}}}}},dn={key:"parameters",plugin:function(e,t,n,r){if(k()(e)&&e.length){var a=Xe()([],e),o=ve()(n).call(n,0,-1),i=Je()({},lt.getIn(r.spec,o));return p()(e).call(e,(function(e,t){try{a[t].default=r.parameterMacro(i,e)}catch(e){var o=new Error(e);return o.fullPath=n,o}})),lt.replace(n,a)}return lt.replace(n,e)}},hn={key:"properties",plugin:function(e,t,n,r){var a=Je()({},e);for(var o in e)try{a[o].default=r.modelPropertyMacro(a[o])}catch(e){var i=new Error(e);return i.fullPath=n,i}return lt.replace(n,a)}},mn=function(){function e(t){ne()(this,e),this.root=vn(t||{})}return ae()(e,[{key:"set",value:function(e,t){var n=this.getParent(e,!0);if(n){var r=e[e.length-1],a=n.children;a[r]?gn(a[r],t,n):a[r]=vn(t,n)}else gn(this.root,t,null)}},{key:"get",value:function(e){if((e=e||[]).length<1)return this.root.value;for(var t,n,r=this.root,a=0;a<e.length&&(n=e[a],(t=r.children)[n]);a+=1)r=t[n];return r&&r.protoValue}},{key:"getParent",value:function(e,t){var n;return!e||e.length<1?null:e.length<2?this.root:q()(n=ve()(e).call(e,0,-1)).call(n,(function(e,n){if(!e)return e;var r=e.children;return!r[n]&&t&&(r[n]=vn(null,e)),r[n]}),this.root)}}]),e}();function vn(e,t){return gn({children:{}},e,t)}function gn(e,t,n){var r;return e.value=t||{},e.protoValue=n?Je()(Je()({},n.protoValue),e.value):e.value,p()(r=b()(e.children)).call(r,(function(t){var n=e.children[t];e.children[t]=gn(n,n.value,e)})),e}var yn=function(){function e(t){var n,r,a,o,i,s,c=this;ne()(this,e),Xe()(this,{spec:"",debugLevel:"info",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new mn,showDebug:!1,allPatches:[],pluginProp:"specMap",libMethods:Xe()(Ge()(this),lt,{getInstance:function(){return c}}),allowMetaPatches:!1},t),this.get=Ye()(n=this._get).call(n,this),this.getContext=Ye()(r=this._getContext).call(r,this),this.hasRun=Ye()(a=this._hasRun).call(a,this),this.wrappedPlugins=d()(o=x()(i=this.plugins).call(i,Ye()(s=this.wrapPlugin).call(s,this))).call(o,lt.isFunction),this.patches.push(lt.add([],this.spec)),this.patches.push(lt.context([],this.context)),this.updatePatches(this.patches)}return ae()(e,[{key:"debug",value:function(e){if(this.debugLevel===e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];(t=console).log.apply(t,r)}}},{key:"verbose",value:function(e){if("verbose"===this.debugLevel){for(var t,n,r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];(t=console).log.apply(t,o()(n=["[".concat(e,"] ")]).call(n,a))}}},{key:"wrapPlugin",value:function(e,t){var n,r,a,i=this.pathDiscriminator,c=null;return e[this.pluginProp]?(c=e,n=e[this.pluginProp]):lt.isFunction(e)?n=e:lt.isObject(e)&&(r=e,a=function(e,t){return!k()(e)||w()(e).call(e,(function(e,n){return e===t[n]}))},n=s.a.mark((function e(t,n){var c,u,l,p,f,h;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:h=function(e,t,l){var p,f,d,m,v,g,y,E,x,S,w,j,O;return s.a.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(lt.isObject(e)){s.next=6;break}if(r.key!==t[t.length-1]){s.next=4;break}return s.next=4,r.plugin(e,r.key,t,n);case 4:s.next=30;break;case 6:p=t.length-1,f=t[p],d=F()(t).call(t,"properties"),m="properties"===f&&p===d,v=n.allowMetaPatches&&u[e.$$ref],g=0,y=b()(e);case 12:if(!(g<y.length)){s.next=30;break}if(E=y[g],x=e[E],S=o()(t).call(t,E),w=lt.isObject(x),j=e.$$ref,v){s.next=22;break}if(!w){s.next=22;break}return n.allowMetaPatches&&j&&(u[j]=!0),s.delegateYield(h(x,S,l),"t0",22);case 22:if(m||E!==r.key){s.next=27;break}if(O=a(i,t),i&&!O){s.next=27;break}return s.next=27,r.plugin(x,E,S,n,l);case 27:g++,s.next=12;break;case 30:case"end":return s.stop()}}),c)},c=s.a.mark(h),u={},l=m()(d()(t).call(t,lt.isAdditiveMutation)),e.prev=4,l.s();case 6:if((p=l.n()).done){e.next=11;break}return f=p.value,e.delegateYield(h(f.value,f.path,f),"t0",9);case 9:e.next=6;break;case 11:e.next=16;break;case 13:e.prev=13,e.t1=e.catch(4),l.e(e.t1);case 16:return e.prev=16,l.f(),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[4,13,16,19]])}))),Xe()(Ye()(n).call(n,c),{pluginName:e.name||t,isGenerator:lt.isGenerator(n)})}},{key:"nextPlugin",value:function(){var e=this;return et()(this.wrappedPlugins,(function(t){return e.getMutationsForPlugin(t).length>0}))}},{key:"nextPromisedPatch",value:function(){var e;if(this.promisedPatches.length>0)return He.a.race(x()(e=this.promisedPatches).call(e,(function(e){return e.value})))}},{key:"getPluginHistory",value:function(e){var t=this.constructor.getPluginName(e);return this.pluginHistory[t]||[]}},{key:"getPluginRunCount",value:function(e){return this.getPluginHistory(e).length}},{key:"getPluginHistoryTip",value:function(e){var t=this.getPluginHistory(e);return t&&t[t.length-1]||{}}},{key:"getPluginMutationIndex",value:function(e){var t=this.getPluginHistoryTip(e).mutationIndex;return"number"!=typeof t?-1:t}},{key:"updatePluginHistory",value:function(e,t){var n=this.constructor.getPluginName(e);this.pluginHistory[n]=this.pluginHistory[n]||[],this.pluginHistory[n].push(t)}},{key:"updatePatches",value:function(e){var t,n=this;p()(t=lt.normalizeArray(e)).call(t,(function(e){if(e instanceof Error)n.errors.push(e);else try{if(!lt.isObject(e))return void n.debug("updatePatches","Got a non-object patch",e);if(n.showDebug&&n.allPatches.push(e),lt.isPromise(e.value))return n.promisedPatches.push(e),void n.promisedPatchThen(e);if(lt.isContextPatch(e))return void n.setContext(e.path,e.value);if(lt.isMutation(e))return void n.updateMutations(e)}catch(e){console.error(e),n.errors.push(e)}}))}},{key:"updateMutations",value:function(e){"object"===P()(e.value)&&!k()(e.value)&&this.allowMetaPatches&&(e.value=Je()({},e.value));var t=lt.applyPatch(this.state,e,{allowMetaPatches:this.allowMetaPatches});t&&(this.mutations.push(e),this.state=t)}},{key:"removePromisedPatch",value:function(e){var t,n,r=F()(t=this.promisedPatches).call(t,e);r<0?this.debug("Tried to remove a promisedPatch that isn't there!"):ze()(n=this.promisedPatches).call(n,r,1)}},{key:"promisedPatchThen",value:function(e){var t=this;return e.value=e.value.then((function(n){var r=Je()(Je()({},e),{},{value:n});t.removePromisedPatch(e),t.updatePatches(r)})).catch((function(n){t.removePromisedPatch(e),t.updatePatches(n)})),e.value}},{key:"getMutations",value:function(e,t){var n;return e=e||0,"number"!=typeof t&&(t=this.mutations.length),ve()(n=this.mutations).call(n,e,t)}},{key:"getCurrentMutations",value:function(){return this.getMutationsForPlugin(this.getCurrentPlugin())}},{key:"getMutationsForPlugin",value:function(e){var t=this.getPluginMutationIndex(e);return this.getMutations(t+1)}},{key:"getCurrentPlugin",value:function(){return this.currentPlugin}},{key:"getLib",value:function(){return this.libMethods}},{key:"_get",value:function(e){return lt.getIn(this.state,e)}},{key:"_getContext",value:function(e){return this.contextTree.get(e)}},{key:"setContext",value:function(e,t){return this.contextTree.set(e,t)}},{key:"_hasRun",value:function(e){return this.getPluginRunCount(this.getCurrentPlugin())>(e||0)}},{key:"dispatch",value:function(){var e,t=this,n=this,r=this.nextPlugin();if(!r){var a=this.nextPromisedPatch();if(a)return a.then((function(){return t.dispatch()})).catch((function(){return t.dispatch()}));var i={spec:this.state,errors:this.errors};return this.showDebug&&(i.patches=this.allPatches),He.a.resolve(i)}if(n.pluginCount=n.pluginCount||{},n.pluginCount[r]=(n.pluginCount[r]||0)+1,n.pluginCount[r]>100)return He.a.resolve({spec:n.state,errors:o()(e=n.errors).call(e,new Error("We've reached a hard limit of ".concat(100," plugin runs")))});if(r!==this.currentPlugin&&this.promisedPatches.length){var s,c=x()(s=this.promisedPatches).call(s,(function(e){return e.value}));return He.a.all(x()(c).call(c,(function(e){return e.then(nt.a,nt.a)}))).then((function(){return t.dispatch()}))}return function(){n.currentPlugin=r;var e=n.getCurrentMutations(),t=n.mutations.length-1;try{if(r.isGenerator){var a,o=m()(r(e,n.getLib()));try{for(o.s();!(a=o.n()).done;){u(a.value)}}catch(e){o.e(e)}finally{o.f()}}else{u(r(e,n.getLib()))}}catch(e){console.error(e),u([Xe()(Ge()(e),{plugin:r})])}finally{n.updatePluginHistory(r,{mutationIndex:t})}return n.dispatch()}();function u(e){e&&(e=lt.fullyNormalizeArray(e),n.updatePatches(e,r))}}}],[{key:"getPluginName",value:function(e){return e.pluginName}},{key:"getPatchesOfType",value:function(e,t){return d()(e).call(e,t)}}]),e}();var bn={refs:Xt,allOf:fn,parameters:dn,properties:hn},En=n(52);function xn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.requestInterceptor,r=t.responseInterceptor,a=e.withCredentials?"include":"same-origin";return function(t){return e({url:t,loadSpec:!0,requestInterceptor:n,responseInterceptor:r,headers:{Accept:Jt},credentials:a}).then((function(e){return e.body}))}}function Sn(e){var t=e.fetch,n=e.spec,r=e.url,a=e.mode,o=e.allowMetaPatches,i=void 0===o||o,c=e.pathDiscriminator,l=e.modelPropertyMacro,p=e.parameterMacro,f=e.requestInterceptor,d=e.responseInterceptor,h=e.skipNormalization,m=e.useCircularStructures,v=e.http,g=e.baseDoc;return g=g||r,v=t||v||Oe,n?y(n):xn(v,{requestInterceptor:f,responseInterceptor:d})(g).then(y);function y(e){g&&(bn.refs.docCache[g]=e),bn.refs.fetchJSON=xn(v,{requestInterceptor:f,responseInterceptor:d});var t,n=[bn.refs];return"function"==typeof p&&n.push(bn.parameters),"function"==typeof l&&n.push(bn.properties),"strict"!==a&&n.push(bn.allOf),(t={spec:e,context:{baseDoc:g},plugins:n,allowMetaPatches:i,pathDiscriminator:c,parameterMacro:p,modelPropertyMacro:l,useCircularStructures:m},new yn(t).dispatch()).then(h?function(){var e=u()(s.a.mark((function e(t){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}():En.d)}}var wn=n(49),jn=n.n(wn),On=n(41),Cn=n.n(On),_n=n(225),An=n.n(_n),kn=n(47),In=n.n(kn),Pn=n(396),Tn=n.n(Pn),Rn={body:function(e){var t=e.req,n=e.value;t.body=n},header:function(e){var t=e.req,n=e.parameter,r=e.value;t.headers=t.headers||{},void 0!==r&&(t.headers[n.name]=r)},query:function(e){var t,n=e.req,r=e.value,a=e.parameter;n.query=n.query||{},!1===r&&"boolean"===a.type&&(r="false");0===r&&F()(t=["number","integer"]).call(t,a.type)>-1&&(r="0");if(r)n.query[a.name]={collectionFormat:a.collectionFormat,value:r};else if(a.allowEmptyValue&&void 0!==r){var o=a.name;n.query[o]=n.query[o]||{},n.query[o].allowEmptyValue=!0}},path:function(e){var t=e.req,n=e.value,r=e.parameter;t.url=t.url.split("{".concat(r.name,"}")).join(encodeURIComponent(n))},formData:function(e){var t=e.req,n=e.value,r=e.parameter;(n||r.allowEmptyValue)&&(t.form=t.form||{},t.form[r.name]={value:n,allowEmptyValue:r.allowEmptyValue,collectionFormat:r.collectionFormat})}};function Nn(e,t){return V()(t).call(t,"application/json")?"string"==typeof e?e:O()(e):e.toString()}function Mn(e){var t=e.req,n=e.value,r=e.parameter,a=r.name,o=r.style,i=r.explode,s=r.content;if(s){var c=b()(s)[0];t.url=t.url.split("{".concat(a,"}")).join(Se(Nn(n,c),{escape:!0}))}else{var u=we({key:r.name,value:n,style:o||"simple",explode:i||!1,escape:!0});t.url=t.url.split("{".concat(a,"}")).join(u)}}function Dn(e){var t=e.req,n=e.value,r=e.parameter;if(t.query=t.query||{},r.content){var a=b()(r.content)[0];t.query[r.name]=Nn(n,a)}else if(!1===n&&(n="false"),0===n&&(n="0"),n)t.query[r.name]={value:n,serializationOption:K()(r,["style","explode","allowReserved"])};else if(r.allowEmptyValue&&void 0!==n){var o=r.name;t.query[o]=t.query[o]||{},t.query[o].allowEmptyValue=!0}}var qn=["accept","authorization","content-type"];function Bn(e){var t=e.req,n=e.parameter,r=e.value;if(t.headers=t.headers||{},!(F()(qn).call(qn,n.name.toLowerCase())>-1))if(n.content){var a=b()(n.content)[0];t.headers[n.name]=Nn(r,a)}else void 0!==r&&(t.headers[n.name]=we({key:n.name,value:r,style:n.style||"simple",explode:void 0!==n.explode&&n.explode,escape:!1}))}function Ln(e){var t=e.req,n=e.parameter,r=e.value;t.headers=t.headers||{};var a=P()(r);if(n.content){var i,s=b()(n.content)[0];t.headers.Cookie=o()(i="".concat(n.name,"=")).call(i,Nn(r,s))}else if("undefined"!==a){var c="object"===a&&!k()(r)&&n.explode?"":"".concat(n.name,"=");t.headers.Cookie=c+we({key:n.name,value:r,escape:!1,style:n.style||"form",explode:void 0!==n.explode&&n.explode})}}var Un=n(167),Vn=n.n(Un),zn=n(168),Fn=n.n(zn);function Jn(e,t){var n=e.operation,r=e.requestBody,a=e.securities,i=e.spec,s=e.attachContentTypeForEmptyPayload,c=e.requestContentType;t=function(e){var t=e.request,n=e.securities,r=void 0===n?{}:n,a=e.operation,i=void 0===a?{}:a,s=e.spec,c=Vn()({},t),u=r.authorized,l=void 0===u?{}:u,f=i.security||s.security||[],d=l&&!!b()(l).length,h=Cn()(s,["components","securitySchemes"])||{};if(c.headers=c.headers||{},c.query=c.query||{},!b()(r).length||!d||!f||k()(i.security)&&!i.security.length)return t;return p()(f).call(f,(function(e){var t;p()(t=b()(e)).call(t,(function(e){var t=l[e],n=h[e];if(t){var r=t.value||t,a=n.type;if(t)if("apiKey"===a)"query"===n.in&&(c.query[n.name]=r),"header"===n.in&&(c.headers[n.name]=r),"cookie"===n.in&&(c.cookies[n.name]=r);else if("http"===a){if(/^basic$/i.test(n.scheme)){var i,s=r.username||"",u=r.password||"",p=Fn()(o()(i="".concat(s,":")).call(i,u));c.headers.Authorization="Basic ".concat(p)}/^bearer$/i.test(n.scheme)&&(c.headers.Authorization="Bearer ".concat(r))}else if("oauth2"===a||"openIdConnect"===a){var f,d=t.token||{},m=d[n["x-tokenName"]||"access_token"],v=d.token_type;v&&"bearer"!==v.toLowerCase()||(v="Bearer"),c.headers.Authorization=o()(f="".concat(v," ")).call(f,m)}}}))})),c}({request:t,securities:a,operation:n,spec:i});var u=n.requestBody||{},l=b()(u.content||{}),f=c&&F()(l).call(l,c)>-1;if(r||s){if(c&&f)t.headers["Content-Type"]=c;else if(!c){var d=l[0];d&&(t.headers["Content-Type"]=d,c=d)}}else c&&f&&(t.headers["Content-Type"]=c);if(r)if(c){if(F()(l).call(l,c)>-1)if("application/x-www-form-urlencoded"===c||"multipart/form-data"===c)if("object"===P()(r)){var h,m=(u.content[c]||{}).encoding||{};t.form={},p()(h=b()(r)).call(h,(function(e){t.form[e]={value:r[e],encoding:m[e]||{}}}))}else t.form=r;else t.body=r}else t.body=r;return t}function Wn(e,t){var n,r,a=e.spec,i=e.operation,s=e.securities,c=e.requestContentType,u=e.attachContentTypeForEmptyPayload;if((t=function(e){var t=e.request,n=e.securities,r=void 0===n?{}:n,a=e.operation,i=void 0===a?{}:a,s=e.spec,c=Vn()({},t),u=r.authorized,l=void 0===u?{}:u,f=r.specSecurity,d=void 0===f?[]:f,h=i.security||d,m=l&&!!b()(l).length,v=s.securityDefinitions;if(c.headers=c.headers||{},c.query=c.query||{},!b()(r).length||!m||!h||k()(i.security)&&!i.security.length)return t;return p()(h).call(h,(function(e){var t;p()(t=b()(e)).call(t,(function(e){var t=l[e];if(t){var n=t.token,r=t.value||t,a=v[e],i=a.type,s=a["x-tokenName"]||"access_token",u=n&&n[s],p=n&&n.token_type;if(t)if("apiKey"===i){var f="query"===a.in?"query":"headers";c[f]=c[f]||{},c[f][a.name]=r}else if("basic"===i)if(r.header)c.headers.authorization=r.header;else{var d,h=r.username||"",m=r.password||"";r.base64=Fn()(o()(d="".concat(h,":")).call(d,m)),c.headers.authorization="Basic ".concat(r.base64)}else if("oauth2"===i&&u){var g;p=p&&"bearer"!==p.toLowerCase()?p:"Bearer",c.headers.authorization=o()(g="".concat(p," ")).call(g,u)}}}))})),c}({request:t,securities:s,operation:i,spec:a})).body||t.form||u)if(c)t.headers["Content-Type"]=c;else if(k()(i.consumes)){var l=R()(i.consumes,1);t.headers["Content-Type"]=l[0]}else if(k()(a.consumes)){var f=R()(a.consumes,1);t.headers["Content-Type"]=f[0]}else i.parameters&&d()(n=i.parameters).call(n,(function(e){return"file"===e.type})).length?t.headers["Content-Type"]="multipart/form-data":i.parameters&&d()(r=i.parameters).call(r,(function(e){return"formData"===e.in})).length&&(t.headers["Content-Type"]="application/x-www-form-urlencoded");else if(c){var h,m,v=i.parameters&&d()(h=i.parameters).call(h,(function(e){return"body"===e.in})).length>0,g=i.parameters&&d()(m=i.parameters).call(m,(function(e){return"formData"===e.in})).length>0;(v||g)&&(t.headers["Content-Type"]=c)}return t}var Hn=function(e){return k()(e)?e:[]},$n=Rt("OperationNotFoundError",(function(e,t,n){this.originalError=n,Xe()(this,t||{})})),Yn={buildRequest:Gn};function Kn(e){var t=e.http,n=e.fetch,r=e.spec,a=e.operationId,o=e.pathName,i=e.method,s=e.parameters,c=e.securities,u=jn()(e,["http","fetch","spec","operationId","pathName","method","parameters","securities"]),l=t||n||Oe;o&&i&&!a&&(a=Object(En.c)(o,i));var p=Yn.buildRequest(Je()({spec:r,operationId:a,parameters:s,securities:c,http:l},u));return p.body&&(An()(p.body)||In()(p.body))&&(p.body=O()(p.body)),l(p)}function Gn(e){var t,n,a=e.spec,i=e.operationId,s=e.responseContentType,c=e.scheme,u=e.requestInterceptor,l=e.responseInterceptor,f=e.contextUrl,h=e.userFetch,m=e.server,v=e.serverVariables,g=e.http,y=e.parameters,E=e.parameterBuilders,S=Object(En.b)(a);E||(E=S?r:Rn);var w={url:"",credentials:g&&g.withCredentials?"include":"same-origin",headers:{},cookies:{}};u&&(w.requestInterceptor=u),l&&(w.responseInterceptor=l),h&&(w.userFetch=h);var j=Object(En.a)(a,i);if(!j)throw new $n("Operation ".concat(i," not found"));var O,C=j.operation,_=void 0===C?{}:C,A=j.method,I=j.pathName;if(w.url+=(O={spec:a,scheme:c,contextUrl:f,server:m,serverVariables:v,pathName:I,method:A},Object(En.b)(O.spec)?function(e){var t=e.spec,n=e.pathName,r=e.method,a=e.server,i=e.contextUrl,s=e.serverVariables,c=void 0===s?{}:s,u=Cn()(t,["paths",n,(r||"").toLowerCase(),"servers"])||Cn()(t,["paths",n,"servers"])||Cn()(t,["servers"]),l="",f=null;if(a&&u&&u.length){var d=x()(u).call(u,(function(e){return e.url}));F()(d).call(d,a)>-1&&(l=a,f=u[F()(d).call(d,a)])}if(!l&&u&&u.length){l=u[0].url;var h=R()(u,1);f=h[0]}if(F()(l).call(l,"{")>-1){var m=function(e){for(var t,n=[],r=/{([^}]+)}/g;t=r.exec(e);)n.push(t[1]);return n}(l);p()(m).call(m,(function(e){if(f.variables&&f.variables[e]){var t=f.variables[e],n=c[e]||t.default,r=new RegExp("{".concat(e,"}"),"g");l=l.replace(r,n)}}))}return function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=n&&r?Tt.a.parse(Tt.a.resolve(r,n)):Tt.a.parse(n),i=Tt.a.parse(r),s=Zn(a.protocol)||Zn(i.protocol)||"",c=a.host||i.host,u=a.pathname||"";return"/"===(e=s&&c?o()(t="".concat(s,"://")).call(t,c+u):u)[e.length-1]?ve()(e).call(e,0,-1):e}(l,i)}(O):function(e){var t,n,r=e.spec,a=e.scheme,i=e.contextUrl,s=void 0===i?"":i,c=Tt.a.parse(s),u=k()(r.schemes)?r.schemes[0]:null,l=a||u||Zn(c.protocol)||"http",p=r.host||c.host||"",f=r.basePath||"";return"/"===(t=l&&p?o()(n="".concat(l,"://")).call(n,p+f):f)[t.length-1]?ve()(t).call(t,0,-1):t}(O)),!i)return delete w.cookies,w;w.url+=I,w.method="".concat(A).toUpperCase(),y=y||{};var P=a.paths[I]||{};s&&(w.headers.accept=s);var T=function(e){var t,n={};p()(e).call(e,(function(e){n[e.in]||(n[e.in]={}),n[e.in][e.name]=e}));var r=[];return p()(t=b()(n)).call(t,(function(e){var t;p()(t=b()(n[e])).call(t,(function(t){r.push(n[e][t])}))})),r}(o()(t=o()(n=[]).call(n,Hn(_.parameters))).call(t,Hn(P.parameters)));p()(T).call(T,(function(e){var t,n,r=E[e.in];if("body"===e.in&&e.schema&&e.schema.properties&&(t=y),void 0===(t=e&&e.name&&y[e.name]))t=e&&e.name&&y[o()(n="".concat(e.in,".")).call(n,e.name)];else if(function(e,t){return d()(t).call(t,(function(t){return t.name===e}))}(e.name,T).length>1){var i;console.warn(o()(i="Parameter '".concat(e.name,"' is ambiguous because the defined spec has more than one parameter with the name: '")).call(i,e.name,"' and the passed-in parameter values did not define an 'in' value."))}if(null!==t){if(void 0!==e.default&&void 0===t&&(t=e.default),void 0===t&&e.required&&!e.allowEmptyValue)throw new Error("Required parameter ".concat(e.name," is not provided"));if(S&&e.schema&&"object"===e.schema.type&&"string"==typeof t)try{t=JSON.parse(t)}catch(e){throw new Error("Could not parse object parameter value string as JSON")}r&&r({req:w,parameter:e,value:t,operation:_,spec:a})}}));var N=Je()(Je()({},e),{},{operation:_});if((w=S?Jn(N,w):Wn(N,w)).cookies&&b()(w.cookies).length){var M,D=q()(M=b()(w.cookies)).call(M,(function(e,t){var n=w.cookies[t];return e+(e?"&":"")+Tn.a.serialize(t,n)}),"");w.headers.Cookie=D}return w.cookies&&delete w.cookies,Ue(w),w}var Zn=function(e){return e?e.replace(/\W/g,""):null};function Xn(e,t){return Qn.apply(this,arguments)}function Qn(){return(Qn=u()(s.a.mark((function e(t,n){var r,a,o,i,c,u,l,p,f,d,h,m,v=arguments;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.length>2&&void 0!==v[2]?v[2]:{},a=r.returnEntireTree,o=r.baseDoc,i=r.requestInterceptor,c=r.responseInterceptor,u=r.parameterMacro,l=r.modelPropertyMacro,p=r.useCircularStructures,f={pathDiscriminator:n,baseDoc:o,requestInterceptor:i,responseInterceptor:c,parameterMacro:u,modelPropertyMacro:l,useCircularStructures:p},d=Object(En.d)({spec:t}),h=d.spec,e.next=6,Sn(Je()(Je()({},f),{},{spec:h,allowMetaPatches:!0,skipNormalization:!0}));case 6:return m=e.sent,!a&&k()(n)&&n.length&&(m.spec=Cn()(m.spec,n)||null),e.abrupt("return",m);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var er=n(228);t.default=function(e){var t,n,r,a=e.configs,i=e.getConfigs;return{fn:{fetch:(t=Oe,n=a.preFetch,r=a.postFetch,r=r||function(e){return e},n=n||function(e){return e},function(e){return"string"==typeof e&&(e={url:e}),je.mergeInQueryOrForm(e),e=n(e),r(t(e))}),buildRequest:Gn,execute:Kn,resolve:Sn,resolveSubtree:function(e,t,n){var r;if(void 0===n){var a=i();n={modelPropertyMacro:a.modelPropertyMacro,parameterMacro:a.parameterMacro,requestInterceptor:a.requestInterceptor,responseInterceptor:a.responseInterceptor}}for(var s=arguments.length,c=new Array(s>3?s-3:0),u=3;u<s;u++)c[u-3]=arguments[u];return Xn.apply(void 0,o()(r=[e,t,n]).call(r,c))},serializeRes:ke,opId:En.e},statePlugins:{configs:{wrapActions:er}}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return u}));var r=n(131),a=n(112),o=n(235),i=n(236),s=n(237),c={getLocalConfig:function(){return Object(r.parseYamlConfig)('---\nurl: "https://petstore.swagger.io/v2/swagger.json"\ndom_id: "#swagger-ui"\nvalidatorUrl: "https://validator.swagger.io/validator"\n')}};function u(){return{statePlugins:{spec:{actions:o,selectors:c},configs:{reducers:s.default,actions:a,selectors:i}}}}},function(e,t,n){var r=n(330),a=n(151),o=n(612),i=n(47),s=n(344);e.exports=function(e,t,n){var c=i(e)?r:o;return n&&s(e,t,n)&&(t=void 0),c(e,a(t,3))}},function(e,t){e.exports=require("memoizee")},function(e,t,n){e.exports=n(658)},function(e,t,n){e.exports=n(663)},function(e,t,n){var r=n(360);e.exports=function(e,t,n){return null==e?e:r(e,t,n)}},function(e,t){e.exports=require("react-redux")},function(e,t,n){e.exports=n(733)},function(e,t){e.exports=function(){}},function(e,t){e.exports=require("querystring-browser")},function(e,t,n){var r=n(739),a=n(321),o=n(341),i=n(77);e.exports=function(e,t,n){return e=i(e),n=null==n?0:r(o(n),0,e.length),t=a(t),e.slice(n,n+t.length)==t}},function(e,t){e.exports=require("react-debounce-input")},function(e,t,n){var r=n(312),a=n(304),o=n(145),i=n(315);e.exports=function(e){return r(e)||a(e)||o(e)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(24),a=n(34),o=n(116),i=n(40),s=n(61),c=n(68),u=n(118),l=n(179),p=n(121),f=n(36),d=n(120),h=f("isConcatSpreadable"),m=9007199254740991,v="Maximum allowed index exceeded",g=d>=51||!a((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),y=p("concat"),b=function(e){if(!i(e))return!1;var t=e[h];return void 0!==t?!!t:o(e)};r({target:"Array",proto:!0,forced:!g||!y},{concat:function(e){var t,n,r,a,o,i=s(this),p=l(i,0),f=0;for(t=-1,r=arguments.length;t<r;t++)if(b(o=-1===t?i:arguments[t])){if(f+(a=c(o.length))>m)throw TypeError(v);for(n=0;n<a;n++,f++)n in o&&u(p,f,o[n])}else{if(f>=m)throw TypeError(v);u(p,f++,o)}return p.length=f,p}})},function(e,t,n){var r=n(44),a=n(34),o=n(178);e.exports=!r&&!a((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(34),a=/#|\.prototype\./,o=function(e,t){var n=s[i(e)];return n==u||n!=c&&("function"==typeof t?r(t):!!t)},i=o.normalize=function(e){return String(e).replace(a,".").toLowerCase()},s=o.data={},c=o.NATIVE="N",u=o.POLYFILL="P";e.exports=o},function(e,t,n){var r=n(182);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){"use strict";var r=n(24),a=n(38),o=n(62),i=n(81),s=n(44),c=n(182),u=n(284),l=n(34),p=n(48),f=n(116),d=n(40),h=n(46),m=n(61),v=n(58),g=n(140),y=n(90),b=n(92),E=n(122),x=n(187),S=n(416),w=n(188),j=n(89),O=n(60),C=n(138),_=n(59),A=n(93),k=n(180),I=n(144),P=n(123),T=n(141),R=n(36),N=n(189),M=n(43),D=n(82),q=n(69),B=n(75).forEach,L=I("hidden"),U="Symbol",V=R("toPrimitive"),z=q.set,F=q.getterFor(U),J=Object.prototype,W=a.Symbol,H=o("JSON","stringify"),$=j.f,Y=O.f,K=S.f,G=C.f,Z=k("symbols"),X=k("op-symbols"),Q=k("string-to-symbol-registry"),ee=k("symbol-to-string-registry"),te=k("wks"),ne=a.QObject,re=!ne||!ne.prototype||!ne.prototype.findChild,ae=s&&l((function(){return 7!=b(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=$(J,t);r&&delete J[t],Y(e,t,n),r&&e!==J&&Y(J,t,r)}:Y,oe=function(e,t){var n=Z[e]=b(W.prototype);return z(n,{type:U,tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},se=function(e,t,n){e===J&&se(X,t,n),h(e);var r=g(t,!0);return h(n),p(Z,r)?(n.enumerable?(p(e,L)&&e[L][r]&&(e[L][r]=!1),n=b(n,{enumerable:y(0,!1)})):(p(e,L)||Y(e,L,y(1,{})),e[L][r]=!0),ae(e,r,n)):Y(e,r,n)},ce=function(e,t){h(e);var n=v(t),r=E(n).concat(fe(n));return B(r,(function(t){s&&!ue.call(n,t)||se(e,t,n[t])})),e},ue=function(e){var t=g(e,!0),n=G.call(this,t);return!(this===J&&p(Z,t)&&!p(X,t))&&(!(n||!p(this,t)||!p(Z,t)||p(this,L)&&this[L][t])||n)},le=function(e,t){var n=v(e),r=g(t,!0);if(n!==J||!p(Z,r)||p(X,r)){var a=$(n,r);return!a||!p(Z,r)||p(n,L)&&n[L][r]||(a.enumerable=!0),a}},pe=function(e){var t=K(v(e)),n=[];return B(t,(function(e){p(Z,e)||p(P,e)||n.push(e)})),n},fe=function(e){var t=e===J,n=K(t?X:v(e)),r=[];return B(n,(function(e){!p(Z,e)||t&&!p(J,e)||r.push(Z[e])})),r};(c||(A((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=T(e),n=function(e){this===J&&n.call(X,e),p(this,L)&&p(this[L],t)&&(this[L][t]=!1),ae(this,t,y(1,e))};return s&&re&&ae(J,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return F(this).tag})),A(W,"withoutSetter",(function(e){return oe(T(e),e)})),C.f=ue,O.f=se,j.f=le,x.f=S.f=pe,w.f=fe,N.f=function(e){return oe(R(e),e)},s&&(Y(W.prototype,"description",{configurable:!0,get:function(){return F(this).description}}),i||A(J,"propertyIsEnumerable",ue,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!c,sham:!c},{Symbol:W}),B(E(te),(function(e){M(e)})),r({target:U,stat:!0,forced:!c},{for:function(e){var t=String(e);if(p(Q,t))return Q[t];var n=W(t);return Q[t]=n,ee[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(p(ee,e))return ee[e]},useSetter:function(){re=!0},useSimple:function(){re=!1}}),r({target:"Object",stat:!0,forced:!c,sham:!s},{create:function(e,t){return void 0===t?b(e):ce(b(e),t)},defineProperty:se,defineProperties:ce,getOwnPropertyDescriptor:le}),r({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:pe,getOwnPropertySymbols:fe}),r({target:"Object",stat:!0,forced:l((function(){w.f(1)}))},{getOwnPropertySymbols:function(e){return w.f(m(e))}}),H)&&r({target:"JSON",stat:!0,forced:!c||l((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,a=[e],o=1;arguments.length>o;)a.push(arguments[o++]);if(r=t,(d(t)||void 0!==e)&&!ie(e))return f(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),a[1]=t,H.apply(null,a)}});W.prototype[V]||_(W.prototype,V,W.prototype.valueOf),D(W,U),P[L]=!0},function(e,t,n){var r=n(48),a=n(58),o=n(184).indexOf,i=n(123);e.exports=function(e,t){var n,s=a(e),c=0,u=[];for(n in s)!r(i,n)&&r(s,n)&&u.push(n);for(;t.length>c;)r(s,n=t[c++])&&(~o(u,n)||u.push(n));return u}},function(e,t,n){var r=n(62);e.exports=r("document","documentElement")},function(e,t,n){var r=n(38),a=n(289),o=r.WeakMap;e.exports="function"==typeof o&&/native code/.test(a(o))},function(e,t,n){var r=n(181),a=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return a.call(e)}),e.exports=r.inspectSource},function(e,t,n){n(43)("iterator")},function(e,t,n){var r=n(117),a=n(104),o=function(e){return function(t,n){var o,i,s=String(a(t)),c=r(n),u=s.length;return c<0||c>=u?e?"":void 0:(o=s.charCodeAt(c))<55296||o>56319||c+1===u||(i=s.charCodeAt(c+1))<56320||i>57343?e?s.charAt(c):o:e?s.slice(c,c+2):i-56320+(o-55296<<10)+65536}};e.exports={codeAt:o(!1),charAt:o(!0)}},function(e,t,n){"use strict";var r=n(293).IteratorPrototype,a=n(92),o=n(90),i=n(82),s=n(94),c=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=a(r,{next:o(1,n)}),i(e,u,!1,!0),s[u]=c,e}},function(e,t,n){"use strict";var r,a,o,i=n(34),s=n(124),c=n(59),u=n(48),l=n(36),p=n(81),f=l("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(a=s(s(o)))!==Object.prototype&&(r=a):d=!0);var h=null==r||i((function(){var e={};return r[f].call(e)!==e}));h&&(r={}),p&&!h||u(r,f)||c(r,f,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:d}},function(e,t,n){var r=n(34);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(448),a=Array.prototype;e.exports=function(e){var t=e.filter;return e===a||e instanceof Array&&t===a.filter?r:t}},function(e,t,n){n(451);var r=n(31);e.exports=r.Object.keys},function(e,t,n){n(456);var r=n(31).Object,a=e.exports=function(e,t,n){return r.defineProperty(e,t,n)};r.defineProperty.sham&&(a.sham=!0)},function(e,t,n){"use strict";var r=n(67),a=n(40),o=[].slice,i={},s=function(e,t,n){if(!(t in i)){for(var r=[],a=0;a<t;a++)r[a]="a["+a+"]";i[t]=Function("C,a","return new C("+r.join(",")+")")}return i[t](e,n)};e.exports=Function.bind||function(e){var t=r(this),n=o.call(arguments,1),i=function(){var r=n.concat(o.call(arguments));return this instanceof i?s(t,r.length,r):t.apply(e,r)};return a(t.prototype)&&(i.prototype=t.prototype),i}},function(e,t,n){n(462);var r=n(31);e.exports=r.Object.assign},function(e,t,n){"use strict";var r=n(44),a=n(34),o=n(122),i=n(188),s=n(138),c=n(61),u=n(139),l=Object.assign,p=Object.defineProperty;e.exports=!l||a((function(){if(r&&1!==l({b:1},l(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),a="abcdefghijklmnopqrst";return e[n]=7,a.split("").forEach((function(e){t[e]=e})),7!=l({},e)[n]||o(l({},t)).join("")!=a}))?function(e,t){for(var n=c(e),a=arguments.length,l=1,p=i.f,f=s.f;a>l;)for(var d,h=u(arguments[l++]),m=p?o(h).concat(p(h)):o(h),v=m.length,g=0;v>g;)d=m[g++],r&&!f.call(h,d)||(n[d]=h[d]);return n}:l},function(e,t,n){var r=n(464),a=Array.prototype;e.exports=function(e){var t=e.slice;return e===a||e instanceof Array&&t===a.slice?r:t}},function(e,t,n){n(467);var r=n(31);e.exports=r.Array.isArray},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(137),a=n(305),o=n(306);e.exports=function(e){if(void 0!==r&&a(Object(e)))return o(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(483)},function(e,t,n){e.exports=n(485)},function(e,t,n){n(83),n(486);var r=n(31);e.exports=r.Array.from},function(e,t,n){"use strict";var r=n(91),a=n(61),o=n(487),i=n(310),s=n(68),c=n(118),u=n(126);e.exports=function(e){var t,n,l,p,f,d,h=a(e),m="function"==typeof this?this:Array,v=arguments.length,g=v>1?arguments[1]:void 0,y=void 0!==g,b=u(h),E=0;if(y&&(g=r(g,v>2?arguments[2]:void 0,2)),null==b||m==Array&&i(b))for(n=new m(t=s(h.length));t>E;E++)d=y?g(h[E],E):h[E],c(n,E,d);else for(f=(p=b.call(h)).next,n=new m;!(l=f.call(p)).done;E++)d=y?o(p,g,[l.value,E],!0):l.value,c(n,E,d);return n.length=E,n}},function(e,t,n){var r=n(46);e.exports=function(e){var t=e.return;if(void 0!==t)return r(t.call(e)).value}},function(e,t,n){var r=n(36),a=n(94),o=r("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(a.Array===e||i[o]===e)}},function(e,t,n){var r=n(36)("iterator"),a=!1;try{var o=0,i={next:function(){return{done:!!o++}},return:function(){a=!0}};i[r]=function(){return this},Array.from(i,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!a)return!1;var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},function(e,t,n){var r=n(195);e.exports=function(e){if(r(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(492)},function(e,t,n){var r=n(46),a=n(126);e.exports=function(e){var t=a(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return r(t.call(e))}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){n(63);var r=n(498),a=n(74),o=Array.prototype,i={DOMTokenList:!0,NodeList:!0};e.exports=function(e){var t=e.forEach;return e===o||e instanceof Array&&t===o.forEach||i.hasOwnProperty(a(e))?r:t}},function(e,t,n){var r=n(516);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(36)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){var r=n(518),a=Array.prototype;e.exports=function(e){var t=e.indexOf;return e===a||e instanceof Array&&t===a.indexOf?r:t}},function(e,t){e.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(e,t,n){var r=n(105),a=n(323),o=n(47),i=n(146),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return a(t,e)+"";if(i(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n}},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(177))},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}},function(e,t){e.exports=function(e,t,n){var r=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(a);++r<a;)o[r]=e[r+t];return o}},function(e,t){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return n.test(e)}},function(e,t){e.exports=function(e,t,n,r){var a=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(579),a=n(76);e.exports=function e(t,n,o,i,s){return t===n||(null==t||null==n||!a(t)&&!a(n)?t!=t&&n!=n:r(t,n,o,i,e,s))}},function(e,t,n){var r=n(580),a=n(330),o=n(583);e.exports=function(e,t,n,i,s,c){var u=1&n,l=e.length,p=t.length;if(l!=p&&!(u&&p>l))return!1;var f=c.get(e),d=c.get(t);if(f&&d)return f==t&&d==e;var h=-1,m=!0,v=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++h<l;){var g=e[h],y=t[h];if(i)var b=u?i(y,g,h,t,e,c):i(g,y,h,e,t,c);if(void 0!==b){if(b)continue;m=!1;break}if(v){if(!a(t,(function(e,t){if(!o(v,t)&&(g===e||s(g,e,n,i,c)))return v.push(t)}))){m=!1;break}}else if(g!==y&&!s(g,y,n,i,c)){m=!1;break}}return c.delete(e),c.delete(t),m}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t,n){var r=n(64).Uint8Array;e.exports=r},function(e,t,n){var r=n(333),a=n(200),o=n(98);e.exports=function(e){return r(e,o,a)}},function(e,t,n){var r=n(199),a=n(47);e.exports=function(e,t,n){var o=t(e);return a(e)?o:r(o,n(e))}},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(589),a=n(152),o=n(47),i=n(153),s=n(154),c=n(202),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=o(e),l=!n&&a(e),p=!n&&!l&&i(e),f=!n&&!l&&!p&&c(e),d=n||l||p||f,h=d?r(e.length,String):[],m=h.length;for(var v in e)!t&&!u.call(e,v)||d&&("length"==v||p&&("offset"==v||"parent"==v)||f&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||s(v,m))||h.push(v);return h}},function(e,t,n){var r=n(127),a=n(593),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return a(e);var t=[];for(var n in Object(e))o.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(51);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},function(e,t,n){var r=n(602),a=n(603);e.exports=function(e,t){return null!=e&&a(e,t,r)}},function(e,t,n){var r=n(609);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},function(e,t,n){var r=n(610),a=n(51),o=n(146),i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):i.test(e)?NaN:+e}},function(e,t,n){var r=n(613),a=n(616)(r);e.exports=a},function(e,t,n){var r=n(101),a=n(99),o=n(154),i=n(51);e.exports=function(e,t,n){if(!i(n))return!1;var s=typeof t;return!!("number"==s?a(n)&&o(t,n.length):"string"==s&&t in n)&&r(n[t],e)}},function(e,t,n){e.exports=n(625)},function(e,t,n){e.exports=n(626)},function(e,t,n){e.exports=n(630)},function(e,t,n){e.exports=n(644)},function(e,t,n){n(350),n(143),n(648),n(357),n(358),n(652),n(83),n(63);var r=n(31);e.exports=r.Promise},function(e,t,n){"use strict";var r=n(24),a=n(124),o=n(192),i=n(92),s=n(59),c=n(90),u=n(100),l=function(e,t){var n=this;if(!(n instanceof l))return new l(e,t);o&&(n=o(new Error(void 0),a(n))),void 0!==t&&s(n,"message",String(t));var r=[];return u(e,r.push,{that:r}),s(n,"errors",r),n};l.prototype=i(Error.prototype,{constructor:c(5,l),message:c(5,""),name:c(5,"AggregateError")}),r({global:!0},{AggregateError:l})},function(e,t,n){var r=n(38);e.exports=r.Promise},function(e,t,n){"use strict";var r=n(62),a=n(60),o=n(36),i=n(44),s=o("species");e.exports=function(e){var t=r(e),n=a.f;i&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(46),a=n(67),o=n(36)("species");e.exports=function(e,t){var n,i=r(e).constructor;return void 0===i||null==(n=r(i)[o])?t:a(n)}},function(e,t,n){var r,a,o,i=n(38),s=n(34),c=n(91),u=n(287),l=n(178),p=n(355),f=n(119),d=i.location,h=i.setImmediate,m=i.clearImmediate,v=i.process,g=i.MessageChannel,y=i.Dispatch,b=0,E={},x="onreadystatechange",S=function(e){if(E.hasOwnProperty(e)){var t=E[e];delete E[e],t()}},w=function(e){return function(){S(e)}},j=function(e){S(e.data)},O=function(e){i.postMessage(e+"",d.protocol+"//"+d.host)};h&&m||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return E[++b]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(b),b},m=function(e){delete E[e]},f?r=function(e){v.nextTick(w(e))}:y&&y.now?r=function(e){y.now(w(e))}:g&&!p?(o=(a=new g).port2,a.port1.onmessage=j,r=c(o.postMessage,o,1)):i.addEventListener&&"function"==typeof postMessage&&!i.importScripts&&d&&"file:"!==d.protocol&&!s(O)?(r=O,i.addEventListener("message",j,!1)):r=x in l("script")?function(e){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),S(e)}}:function(e){setTimeout(w(e),0)}),e.exports={set:h,clear:m}},function(e,t,n){var r=n(142);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},function(e,t,n){var r=n(46),a=n(40),o=n(130);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";var r=n(24),a=n(67),o=n(130),i=n(156),s=n(100);r({target:"Promise",stat:!0},{allSettled:function(e){var t=this,n=o.f(t),r=n.resolve,c=n.reject,u=i((function(){var n=a(t.resolve),o=[],i=0,c=1;s(e,(function(e){var a=i++,s=!1;o.push(void 0),c++,n.call(t,e).then((function(e){s||(s=!0,o[a]={status:"fulfilled",value:e},--c||r(o))}),(function(e){s||(s=!0,o[a]={status:"rejected",reason:e},--c||r(o))}))})),--c||r(o)}));return u.error&&c(u.value),n.promise}})},function(e,t,n){"use strict";var r=n(24),a=n(67),o=n(62),i=n(130),s=n(156),c=n(100),u="No one promise resolved";r({target:"Promise",stat:!0},{any:function(e){var t=this,n=i.f(t),r=n.resolve,l=n.reject,p=s((function(){var n=a(t.resolve),i=[],s=0,p=1,f=!1;c(e,(function(e){var a=s++,c=!1;i.push(void 0),p++,n.call(t,e).then((function(e){c||f||(f=!0,r(e))}),(function(e){c||f||(c=!0,i[a]=e,--p||l(new(o("AggregateError"))(i,u)))}))})),--p||l(new(o("AggregateError"))(i,u))}));return p.error&&l(p.value),n.promise}})},function(e,t,n){var r=n(44),a=n(122),o=n(58),i=n(138).f,s=function(e){return function(t){for(var n,s=o(t),c=a(s),u=c.length,l=0,p=[];u>l;)n=c[l++],r&&!i.call(s,n)||p.push(e?[n,s[n]]:s[n]);return p}};e.exports={entries:s(!0),values:s(!1)}},function(e,t,n){var r=n(157),a=n(106),o=n(154),i=n(51),s=n(107);e.exports=function(e,t,n,c){if(!i(e))return e;for(var u=-1,l=(t=a(t,e)).length,p=l-1,f=e;null!=f&&++u<l;){var d=s(t[u]),h=n;if("__proto__"===d||"constructor"===d||"prototype"===d)return e;if(u!=p){var m=f[d];void 0===(h=c?c(m,d,f):void 0)&&(h=i(m)?m:o(t[u+1])?[]:{})}r(f,d,h),f=f[d]}return e}},function(e,t,n){var r=n(362);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(97),a=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=a},function(e,t,n){n(671);var r=n(31).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){e.exports=n(673)},function(e,t,n){e.exports=n(676)},function(e,t,n){var r=n(198),a=n(685),o=n(157),i=n(686),s=n(687),c=n(690),u=n(691),l=n(692),p=n(693),f=n(332),d=n(368),h=n(128),m=n(694),v=n(695),g=n(700),y=n(47),b=n(153),E=n(702),x=n(51),S=n(704),w=n(98),j=n(208),O="[object Arguments]",C="[object Function]",_="[object Object]",A={};A[O]=A["[object Array]"]=A["[object ArrayBuffer]"]=A["[object DataView]"]=A["[object Boolean]"]=A["[object Date]"]=A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Map]"]=A["[object Number]"]=A[_]=A["[object RegExp]"]=A["[object Set]"]=A["[object String]"]=A["[object Symbol]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A["[object Error]"]=A[C]=A["[object WeakMap]"]=!1,e.exports=function e(t,n,k,I,P,T){var R,N=1&n,M=2&n,D=4&n;if(k&&(R=P?k(t,I,P,T):k(t)),void 0!==R)return R;if(!x(t))return t;var q=y(t);if(q){if(R=m(t),!N)return u(t,R)}else{var B=h(t),L=B==C||"[object GeneratorFunction]"==B;if(b(t))return c(t,N);if(B==_||B==O||L&&!P){if(R=M||L?{}:g(t),!N)return M?p(t,s(R,t)):l(t,i(R,t))}else{if(!A[B])return P?t:{};R=v(t,B,N)}}T||(T=new r);var U=T.get(t);if(U)return U;T.set(t,R),S(t)?t.forEach((function(r){R.add(e(r,n,k,r,t,T))})):E(t)&&t.forEach((function(r,a){R.set(a,e(r,n,k,a,t,T))}));var V=q?void 0:(D?M?d:f:M?j:w)(t);return a(V||t,(function(r,a){V&&(r=t[a=r]),o(R,a,e(r,n,k,a,t,T))})),R}},function(e,t,n){var r=n(199),a=n(209),o=n(200),i=n(334),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,o(e)),e=a(e);return t}:i;e.exports=s},function(e,t,n){var r=n(333),a=n(367),o=n(208);e.exports=function(e){return r(e,o,a)}},function(e,t,n){var r=n(710),a=n(370),o=n(371);e.exports=function(e){return o(a(e,void 0,r),e+"")}},function(e,t,n){var r=n(713),a=Math.max;e.exports=function(e,t,n){return t=a(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,s=a(o.length-t,0),c=Array(s);++i<s;)c[i]=o[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=o[i];return u[t]=n(c),r(e,this,u)}}},function(e,t,n){var r=n(714),a=n(716)(r);e.exports=a},function(e,t,n){"use strict";var r=n(24),a=n(38),o=n(158),i=n(34),s=n(59),c=n(100),u=n(108),l=n(40),p=n(82),f=n(60).f,d=n(75).forEach,h=n(44),m=n(69),v=m.set,g=m.getterFor;e.exports=function(e,t,n){var m,y=-1!==e.indexOf("Map"),b=-1!==e.indexOf("Weak"),E=y?"set":"add",x=a[e],S=x&&x.prototype,w={};if(h&&"function"==typeof x&&(b||S.forEach&&!i((function(){(new x).entries().next()})))){m=t((function(t,n){v(u(t,m,e),{type:e,collection:new x}),null!=n&&c(n,t[E],{that:t,AS_ENTRIES:y})}));var j=g(e);d(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in S)||b&&"clear"==e||s(m.prototype,e,(function(n,r){var a=j(this).collection;if(!t&&b&&!l(n))return"get"==e&&void 0;var o=a[e](0===n?0:n,r);return t?this:o}))})),b||f(m.prototype,"size",{configurable:!0,get:function(){return j(this).collection.size}})}else m=n.getConstructor(t,e,y,E),o.REQUIRED=!0;return p(m,e,!1,!0),w[e]=m,r({global:!0,forced:!0},w),b||n.setStrong(m,e,y),m}},function(e,t,n){var r=n(34),a=n(36),o=n(81),i=a("iterator");e.exports=!r((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),o&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[i]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host}))},function(e,t,n){"use strict";n(125);var r=n(24),a=n(62),o=n(373),i=n(93),s=n(129),c=n(82),u=n(292),l=n(69),p=n(108),f=n(48),d=n(91),h=n(74),m=n(46),v=n(40),g=n(92),y=n(90),b=n(314),E=n(126),x=n(36),S=a("fetch"),w=a("Headers"),j=x("iterator"),O="URLSearchParams",C="URLSearchParamsIterator",_=l.set,A=l.getterFor(O),k=l.getterFor(C),I=/\+/g,P=Array(4),T=function(e){return P[e-1]||(P[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},R=function(e){try{return decodeURIComponent(e)}catch(t){return e}},N=function(e){var t=e.replace(I," "),n=4;try{return decodeURIComponent(t)}catch(e){for(;n;)t=t.replace(T(n--),R);return t}},M=/[!'()~]|%20/g,D={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},q=function(e){return D[e]},B=function(e){return encodeURIComponent(e).replace(M,q)},L=function(e,t){if(t)for(var n,r,a=t.split("&"),o=0;o<a.length;)(n=a[o++]).length&&(r=n.split("="),e.push({key:N(r.shift()),value:N(r.join("="))}))},U=function(e){this.entries.length=0,L(this.entries,e)},V=function(e,t){if(e<t)throw TypeError("Not enough arguments")},z=u((function(e,t){_(this,{type:C,iterator:b(A(e).entries),kind:t})}),"Iterator",(function(){var e=k(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n})),F=function(){p(this,F,O);var e,t,n,r,a,o,i,s,c,u=arguments.length>0?arguments[0]:void 0,l=this,d=[];if(_(l,{type:O,entries:d,updateURL:function(){},updateSearchParams:U}),void 0!==u)if(v(u))if("function"==typeof(e=E(u)))for(n=(t=e.call(u)).next;!(r=n.call(t)).done;){if((i=(o=(a=b(m(r.value))).next).call(a)).done||(s=o.call(a)).done||!o.call(a).done)throw TypeError("Expected sequence with length 2");d.push({key:i.value+"",value:s.value+""})}else for(c in u)f(u,c)&&d.push({key:c,value:u[c]+""});else L(d,"string"==typeof u?"?"===u.charAt(0)?u.slice(1):u:u+"")},J=F.prototype;s(J,{append:function(e,t){V(arguments.length,2);var n=A(this);n.entries.push({key:e+"",value:t+""}),n.updateURL()},delete:function(e){V(arguments.length,1);for(var t=A(this),n=t.entries,r=e+"",a=0;a<n.length;)n[a].key===r?n.splice(a,1):a++;t.updateURL()},get:function(e){V(arguments.length,1);for(var t=A(this).entries,n=e+"",r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){V(arguments.length,1);for(var t=A(this).entries,n=e+"",r=[],a=0;a<t.length;a++)t[a].key===n&&r.push(t[a].value);return r},has:function(e){V(arguments.length,1);for(var t=A(this).entries,n=e+"",r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){V(arguments.length,1);for(var n,r=A(this),a=r.entries,o=!1,i=e+"",s=t+"",c=0;c<a.length;c++)(n=a[c]).key===i&&(o?a.splice(c--,1):(o=!0,n.value=s));o||a.push({key:i,value:s}),r.updateURL()},sort:function(){var e,t,n,r=A(this),a=r.entries,o=a.slice();for(a.length=0,n=0;n<o.length;n++){for(e=o[n],t=0;t<n;t++)if(a[t].key>e.key){a.splice(t,0,e);break}t===n&&a.push(e)}r.updateURL()},forEach:function(e){for(var t,n=A(this).entries,r=d(e,arguments.length>1?arguments[1]:void 0,3),a=0;a<n.length;)r((t=n[a++]).value,t.key,this)},keys:function(){return new z(this,"keys")},values:function(){return new z(this,"values")},entries:function(){return new z(this,"entries")}},{enumerable:!0}),i(J,j,J.entries),i(J,"toString",(function(){for(var e,t=A(this).entries,n=[],r=0;r<t.length;)e=t[r++],n.push(B(e.key)+"="+B(e.value));return n.join("&")}),{enumerable:!0}),c(F,O),r({global:!0,forced:!o},{URLSearchParams:F}),o||"function"!=typeof S||"function"!=typeof w||r({global:!0,enumerable:!0,forced:!0},{fetch:function(e){var t,n,r,a=[e];return arguments.length>1&&(v(t=arguments[1])&&(n=t.body,h(n)===O&&((r=t.headers?new w(t.headers):new w).has("content-type")||r.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),t=g(t,{body:y(0,String(n)),headers:y(0,r)}))),a.push(t)),S.apply(this,a)}}),e.exports={URLSearchParams:F,getState:A}},function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwcHgiICBoZWlnaHQ9IjIwMHB4IiAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiIGNsYXNzPSJsZHMtcm9sbGluZyIgc3R5bGU9ImJhY2tncm91bmQtaW1hZ2U6IG5vbmU7IGJhY2tncm91bmQtcG9zaXRpb246IGluaXRpYWwgaW5pdGlhbDsgYmFja2dyb3VuZC1yZXBlYXQ6IGluaXRpYWwgaW5pdGlhbDsiPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIGZpbGw9Im5vbmUiIG5nLWF0dHItc3Ryb2tlPSJ7e2NvbmZpZy5jb2xvcn19IiBuZy1hdHRyLXN0cm9rZS13aWR0aD0ie3tjb25maWcud2lkdGh9fSIgbmctYXR0ci1yPSJ7e2NvbmZpZy5yYWRpdXN9fSIgbmctYXR0ci1zdHJva2UtZGFzaGFycmF5PSJ7e2NvbmZpZy5kYXNoYXJyYXl9fSIgc3Ryb2tlPSIjNTU1NTU1IiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij48YW5pbWF0ZVRyYW5zZm9ybSBhdHRyaWJ1dGVOYW1lPSJ0cmFuc2Zvcm0iIHR5cGU9InJvdGF0ZSIgY2FsY01vZGU9ImxpbmVhciIgdmFsdWVzPSIwIDUwIDUwOzM2MCA1MCA1MCIga2V5VGltZXM9IjA7MSIgZHVyPSIxcyIgYmVnaW49IjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSI+PC9hbmltYXRlVHJhbnNmb3JtPjwvY2lyY2xlPjwvc3ZnPgo="},function(e,t){e.exports=require("redux-immutable")},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function a(e){return null===e?"null":void 0===e?"undefined":"object"===(void 0===e?"undefined":r(e))?Array.isArray(e)?"array":"object":void 0===e?"undefined":r(e)}function o(e){return"object"===a(e)?s(e):"array"===a(e)?i(e):e}function i(e){return e.map(o)}function s(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=o(e[n]));return t}function c(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={arrayBehaviour:n.arrayBehaviour||"replace"},o=t.map((function(e){return e||{}})),u=e||{},l=0;l<o.length;l++)for(var p=o[l],f=Object.keys(p),d=0;d<f.length;d++){var h=f[d],m=p[h],v=a(m),g=a(u[h]);if("object"===v)if("undefined"!==g){var y="object"===g?u[h]:{};u[h]=c({},[y,s(m)],r)}else u[h]=s(m);else if("array"===v)if("array"===g){var b=i(m);u[h]="merge"===r.arrayBehaviour?u[h].concat(b):b}else u[h]=i(m);else u[h]=m}return u}e.exports=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return c(e,n)},e.exports.noMutate=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c({},t)},e.exports.withOptions=function(e,t,n){return c(e,t,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeUrl=void 0;var r=/^(%20|\s)*(javascript|data|vbscript)/im,a=/[^\x20-\x7EÀ-ž]/gim,o=/^([^:]+):/gm,i=[".","/"];t.sanitizeUrl=function(e){if(!e)return"about:blank";var t=e.replace(a,"").trim();if(function(e){return i.indexOf(e[0])>-1}(t))return t;var n=t.match(o);if(!n)return t;var s=n[0];return r.test(s)?"about:blank":t}},function(e,t,n){var r=n(534),a=n(542)((function(e,t,n){return t=t.toLowerCase(),e+(n?r(t):t)}));e.exports=a},function(e,t,n){(function(t){var r=n(618),a=n(619).Stream;function o(e,t,n){n=n||0;var a,i,s=(a=t,new Array(n||0).join(a||"")),c=e;if("object"==typeof e&&((c=e[i=Object.keys(e)[0]])&&c._elem))return c._elem.name=i,c._elem.icount=n,c._elem.indent=t,c._elem.indents=s,c._elem.interrupt=c,c._elem;var u,l=[],p=[];function f(e){Object.keys(e).forEach((function(t){l.push(function(e,t){return e+'="'+r(t)+'"'}(t,e[t]))}))}switch(typeof c){case"object":if(null===c)break;c._attr&&f(c._attr),c._cdata&&p.push(("<![CDATA["+c._cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")+"]]>"),c.forEach&&(u=!1,p.push(""),c.forEach((function(e){"object"==typeof e?"_attr"==Object.keys(e)[0]?f(e._attr):p.push(o(e,t,n+1)):(p.pop(),u=!0,p.push(r(e)))})),u||p.push(""));break;default:p.push(r(c))}return{name:i,interrupt:!1,attributes:l,content:p,icount:n,indents:s,indent:t}}function i(e,t,n){if("object"!=typeof t)return e(!1,t);var r=t.interrupt?1:t.content.length;function a(){for(;t.content.length;){var a=t.content.shift();if(void 0!==a){if(o(a))return;i(e,a)}}e(!1,(r>1?t.indents:"")+(t.name?"</"+t.name+">":"")+(t.indent&&!n?"\n":"")),n&&n()}function o(t){return!!t.interrupt&&(t.interrupt.append=e,t.interrupt.end=a,t.interrupt=!1,e(!0),!0)}if(e(!1,t.indents+(t.name?"<"+t.name:"")+(t.attributes.length?" "+t.attributes.join(" "):"")+(r?t.name?">":"":t.name?"/>":"")+(t.indent&&r>1?"\n":"")),!r)return e(!1,t.indent?"\n":"");o(t)||a()}e.exports=function(e,n){"object"!=typeof n&&(n={indent:n});var r,s,c=n.stream?new a:null,u="",l=!1,p=n.indent?!0===n.indent?" ":n.indent:"",f=!0;function d(e){f?t.nextTick(e):e()}function h(e,t){if(void 0!==t&&(u+=t),e&&!l&&(c=c||new a,l=!0),e&&l){var n=u;d((function(){c.emit("data",n)})),u=""}}function m(e,t){i(h,o(e,p,p?1:0),t)}function v(){if(c){var e=u;d((function(){c.emit("data",e),c.emit("end"),c.readable=!1,c.emit("close")}))}}return d((function(){f=!1})),n.declaration&&(r=n.declaration,s={version:"1.0",encoding:r.encoding||"UTF-8"},r.standalone&&(s.standalone=r.standalone),m({"?xml":{_attr:s}}),u=u.replace("/>","?>")),e&&e.forEach?e.forEach((function(t,n){var r;n+1===e.length&&(r=v),m(t,r)})):m(e,v),c?(c.readable=!0,c):u},e.exports.element=e.exports.Element=function(){var e=Array.prototype.slice.call(arguments),t={_elem:o(e),push:function(e){if(!this.append)throw new Error("not assigned to a parent!");var t=this,n=this._elem.indent;i(this.append,o(e,n,this._elem.icount+(n?1:0)),(function(){t.append(!0)}))},close:function(e){void 0!==e&&this.push(e),this.end&&this.end()}};return t}}).call(this,n(617))},function(e,t){e.exports=require("css.escape")},function(e,t){e.exports=require("randombytes")},function(e,t){e.exports=require("sha.js")},function(e,t,n){var r=n(326),a=n(343),o=n(151),i=n(624),s=n(47);e.exports=function(e,t,n){var c=s(e)?r:i,u=arguments.length<3;return c(e,o(t,4),n,u,a)}},function(e,t,n){var r=n(51),a=n(666),o=n(342),i=Math.max,s=Math.min;e.exports=function(e,t,n){var c,u,l,p,f,d,h=0,m=!1,v=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=u;return c=u=void 0,h=t,p=e.apply(r,n)}function b(e){return h=e,f=setTimeout(x,t),m?y(e):p}function E(e){var n=e-d;return void 0===d||n>=t||n<0||v&&e-h>=l}function x(){var e=a();if(E(e))return S(e);f=setTimeout(x,function(e){var n=t-(e-d);return v?s(n,l-(e-h)):n}(e))}function S(e){return f=void 0,g&&c?y(e):(c=u=void 0,p)}function w(){var e=a(),n=E(e);if(c=arguments,u=this,d=e,n){if(void 0===f)return b(d);if(v)return clearTimeout(f),f=setTimeout(x,t),y(d)}return void 0===f&&(f=setTimeout(x,t)),p}return t=o(t)||0,r(n)&&(m=!!n.leading,l=(v="maxWait"in n)?i(o(n.maxWait)||0,t):l,g="trailing"in n?!!n.trailing:g),w.cancel=function(){void 0!==f&&clearTimeout(f),h=0,c=d=u=f=void 0},w.flush=function(){return void 0===f?p:S(a())},w}},function(e,t){e.exports=require("react-dom")},function(e,t,n){var r=n(323),a=n(366),o=n(706),i=n(106),s=n(109),c=n(709),u=n(369),l=n(368),p=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=i(t,e),u||(u=t.length>1),t})),s(e,l(e),n),u&&(n=a(n,7,c));for(var p=t.length;p--;)o(n,t[p]);return n}));e.exports=p},function(e,t,n){e.exports=n(717)},function(e,t,n){var r=n(724),a=n(347),o=n(728);function i(t,n,s){return"undefined"!=typeof Reflect&&r?(e.exports=i=r,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=i=function(e,t,n){var r=o(e,t);if(r){var i=a(r,t);return i.get?i.get.call(n):i.value}},e.exports.default=e.exports,e.exports.__esModule=!0),i(t,n,s||t)}e.exports=i,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=require("isomorphic-form-data")},function(e,t,n){e.exports=n(729)},function(e,t,n){var r=n(366);e.exports=function(e){return r(e,5)}},function(e,t,n){e.exports=n(734)},function(e,t){e.exports=require("cross-fetch")},function(e,t){e.exports=require("traverse")},function(e,t){e.exports=require("cookie")},function(e,t){e.exports=require("zenscroll")},function(e,t,n){e.exports=n(749)},function(e,t){e.exports=function(e){const t={literal:"true false null"},n=[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],r=[e.QUOTE_STRING_MODE,e.C_NUMBER_MODE],a={end:",",endsWithParent:!0,excludeEnd:!0,contains:r,keywords:t},o={begin:/\{/,end:/\}/,contains:[{className:"attr",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE],illegal:"\\n"},e.inherit(a,{begin:/:/})].concat(n),illegal:"\\S"},i={begin:"\\[",end:"\\]",contains:[e.inherit(a)],illegal:"\\S"};return r.push(o,i),n.forEach((function(e){r.push(e)})),{name:"JSON",contains:r,keywords:t,illegal:"\\S"}}},function(e,t){const n="[A-Za-z$_][0-9A-Za-z$_]*",r=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],o=[].concat(["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],["arguments","this","super","console","window","document","localStorage","module","global"],["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer"],["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"]);function i(e){return s("(?=",e,")")}function s(...e){return e.map((e=>{return(t=e)?"string"==typeof t?t:t.source:null;var t})).join("")}e.exports=function(e){const t=n,c="<>",u="</>",l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,r=e.input[n];"<"!==r?">"===r&&(((e,{after:t})=>{const n="</"+e[0].slice(1);return-1!==e.input.indexOf(n,t)})(e,{after:n})||t.ignoreMatch()):t.ignoreMatch()}},p={$pattern:n,keyword:r.join(" "),literal:a.join(" "),built_in:o.join(" ")},f="\\.([0-9](_?[0-9])*)",d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${d})((${f})|\\.)?|(${f}))[eE][+-]?([0-9](_?[0-9])*)\\b`},{begin:`\\b(${d})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:p,contains:[]},v={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},g={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},b={className:"comment",variants:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+",contains:[{className:"type",begin:"\\{",end:"\\}",relevance:0},{className:"variable",begin:t+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v,g,y,h,e.REGEXP_MODE];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:p,contains:["self"].concat(E)});const x=[].concat(b,m.contains),S=x.concat([{begin:/\(/,end:/\)/,keywords:p,contains:["self"].concat(x)}]),w={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:S};return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:p,exports:{PARAMS_CONTAINS:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,v,g,y,b,h,{begin:s(/[{,\n]\s*/,i(s(/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,t+"\\s*:"))),relevance:0,contains:[{className:"attr",begin:t+i("\\s*:"),relevance:0}]},{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",contains:[b,e.REGEXP_MODE,{className:"function",begin:"(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:p,contains:S}]}]},{begin:/,/,relevance:0},{className:"",begin:/\s/,end:/\s*/,skip:!0},{variants:[{begin:c,end:u},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}],relevance:0},{className:"function",beginKeywords:"function",end:/[{;]/,excludeEnd:!0,keywords:p,contains:["self",e.inherit(e.TITLE_MODE,{begin:t}),w],illegal:/%/},{beginKeywords:"while if switch catch for"},{className:"function",begin:e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,contains:[w,e.inherit(e.TITLE_MODE,{begin:t})]},{variants:[{begin:"\\."+t},{begin:"\\$"+t}],relevance:0},{className:"class",beginKeywords:"class",end:/[{;=]/,excludeEnd:!0,illegal:/[:"[\]]/,contains:[{beginKeywords:"extends"},e.UNDERSCORE_TITLE_MODE]},{begin:/\b(?=constructor)/,end:/[{;]/,excludeEnd:!0,contains:[e.inherit(e.TITLE_MODE,{begin:t}),"self",w]},{begin:"(get|set)\\s+(?="+t+"\\()",end:/\{/,keywords:"get set",contains:[e.inherit(e.TITLE_MODE,{begin:t}),{begin:/\(\)/},w]},{begin:/\$[(.]/}]}}},function(e,t){function n(e){return e?"string"==typeof e?e:e.source:null}function r(e){return a("(?=",e,")")}function a(...e){return e.map((e=>n(e))).join("")}function o(...e){return"("+e.map((e=>n(e))).join("|")+")"}e.exports=function(e){const t=a(/[A-Z_]/,a("(",/[A-Z0-9_.-]+:/,")?"),/[A-Z0-9_.-]*/),n={className:"symbol",begin:"&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;"},i={begin:"\\s",contains:[{className:"meta-keyword",begin:"#?[a-z_][a-z1-9_-]+",illegal:"\\n"}]},s=e.inherit(i,{begin:"\\(",end:"\\)"}),c=e.inherit(e.APOS_STRING_MODE,{className:"meta-string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"meta-string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:"[A-Za-z0-9\\._:-]+",relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[n]},{begin:/'/,end:/'/,contains:[n]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,contains:[{className:"meta",begin:"<![a-z]",end:">",relevance:10,contains:[i,u,c,s,{begin:"\\[",end:"\\]",contains:[{className:"meta",begin:"<![a-z]",end:">",contains:[i,s,u,c]}]}]},e.COMMENT("\x3c!--","--\x3e",{relevance:10}),{begin:"<!\\[CDATA\\[",end:"\\]\\]>",relevance:10},n,{className:"meta",begin:/<\?xml/,end:/\?>/,relevance:10},{className:"tag",begin:"<style(?=\\s|>)",end:">",keywords:{name:"style"},contains:[l],starts:{end:"</style>",returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:"<script(?=\\s|>)",end:">",keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:a(/</,r(a(t,o(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:l}]},{className:"tag",begin:a(/<\//,r(a(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0}]}]}}},function(e,t){e.exports=function(e){var t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},a=e.inherit(r,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),o={className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},i={end:",",endsWithParent:!0,excludeEnd:!0,contains:[],keywords:t,relevance:0},s={begin:/\{/,end:/\}/,contains:[i],illegal:"\\n",relevance:0},c={begin:"\\[",end:"\\]",contains:[i],illegal:"\\n",relevance:0},u=[{className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)"}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},o,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},s,c,r],l=[...u];return l.pop(),l.push(a),i.contains=l,{name:"YAML",case_insensitive:!0,aliases:["yml","YAML"],contains:u}}},function(e,t){e.exports=function(e){var t="HTTP/[0-9\\.]+";return{name:"HTTP",aliases:["https"],illegal:"\\S",contains:[{begin:"^"+t,end:"$",contains:[{className:"number",begin:"\\b\\d{3}\\b"}]},{begin:"^[A-Z]+ (.*?) "+t+"$",returnBegin:!0,end:"$",contains:[{className:"string",begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0},{begin:t},{className:"keyword",begin:"[A-Z]+"}]},{className:"attribute",begin:"^\\w",end:": ",excludeEnd:!0,illegal:"\\n|\\s|=",starts:{end:"$",relevance:0}},{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}}]}}},function(e,t){function n(...e){return e.map((e=>{return(t=e)?"string"==typeof t?t:t.source:null;var t})).join("")}e.exports=function(e){const t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:n(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},i={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t,a]};a.contains.push(i);const s={begin:/\$\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t]},c=e.SHEBANG({binary:`(${["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"].join("|")})`,relevance:10}),u={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z._-]+\b/,keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp"},contains:[c,e.SHEBANG(),u,s,e.HASH_COMMENT_MODE,o,i,{className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}}},function(e,t){e.exports=require("js-file-download")},function(e,t,n){e.exports=n(756)},function(e,t,n){e.exports=n(759)},function(e,t){e.exports=require("xml-but-prettier")},function(e,t,n){var r=n(77);e.exports=function(e){return r(e).toLowerCase()}},function(e,t){e.exports=require("react-immutable-pure-component")},function(e,t){e.exports=require("autolinker")},function(e,t,n){e.exports=n(765)},function(e,t,n){var r=n(414);n(434),n(435),n(436),n(437),n(438),e.exports=r},function(e,t,n){n(281),n(143),n(285),n(418),n(419),n(420),n(421),n(290),n(422),n(423),n(424),n(425),n(426),n(427),n(428),n(429),n(430),n(431),n(432),n(433);var r=n(31);e.exports=r.Symbol},function(e,t,n){var r=n(38),a=n(59);e.exports=function(e,t){try{a(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(58),a=n(187).f,o={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return i&&"[object Window]"==o.call(e)?function(e){try{return a(e)}catch(e){return i.slice()}}(e):a(r(e))}},function(e,t,n){"use strict";var r=n(190),a=n(74);e.exports=r?{}.toString:function(){return"[object "+a(this)+"]"}},function(e,t,n){n(43)("asyncIterator")},function(e,t){},function(e,t,n){n(43)("hasInstance")},function(e,t,n){n(43)("isConcatSpreadable")},function(e,t,n){n(43)("match")},function(e,t,n){n(43)("matchAll")},function(e,t,n){n(43)("replace")},function(e,t,n){n(43)("search")},function(e,t,n){n(43)("species")},function(e,t,n){n(43)("split")},function(e,t,n){n(43)("toPrimitive")},function(e,t,n){n(43)("toStringTag")},function(e,t,n){n(43)("unscopables")},function(e,t,n){var r=n(38);n(82)(r.JSON,"JSON",!0)},function(e,t){},function(e,t){},function(e,t,n){n(43)("asyncDispose")},function(e,t,n){n(43)("dispose")},function(e,t,n){n(43)("observable")},function(e,t,n){n(43)("patternMatch")},function(e,t,n){n(43)("replaceAll")},function(e,t,n){e.exports=n(440)},function(e,t,n){var r=n(441);e.exports=r},function(e,t,n){n(290),n(83),n(63);var r=n(189);e.exports=r.f("iterator")},function(e,t,n){var r=n(40);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(445);e.exports=r},function(e,t,n){var r=n(446),a=Array.prototype;e.exports=function(e){var t=e.concat;return e===a||e instanceof Array&&t===a.concat?r:t}},function(e,t,n){n(281);var r=n(39);e.exports=r("Array").concat},function(e,t,n){var r=n(295);e.exports=r},function(e,t,n){n(449);var r=n(39);e.exports=r("Array").filter},function(e,t,n){"use strict";var r=n(24),a=n(75).filter;r({target:"Array",proto:!0,forced:!n(121)("filter")},{filter:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(296);e.exports=r},function(e,t,n){var r=n(24),a=n(61),o=n(122);r({target:"Object",stat:!0,forced:n(34)((function(){o(1)}))},{keys:function(e){return o(a(e))}})},function(e,t,n){var r=n(453);e.exports=r},function(e,t,n){n(454);var r=n(31);r.JSON||(r.JSON={stringify:JSON.stringify}),e.exports=function(e,t,n){return r.JSON.stringify.apply(null,arguments)}},function(e,t,n){var r=n(24),a=n(62),o=n(34),i=a("JSON","stringify"),s=/[\uD800-\uDFFF]/g,c=/^[\uD800-\uDBFF]$/,u=/^[\uDC00-\uDFFF]$/,l=function(e,t,n){var r=n.charAt(t-1),a=n.charAt(t+1);return c.test(e)&&!u.test(a)||u.test(e)&&!c.test(r)?"\\u"+e.charCodeAt(0).toString(16):e},p=o((function(){return'"\\udf06\\ud834"'!==i("\udf06\ud834")||'"\\udead"'!==i("\udead")}));i&&r({target:"JSON",stat:!0,forced:p},{stringify:function(e,t,n){var r=i.apply(null,arguments);return"string"==typeof r?r.replace(s,l):r}})},function(e,t,n){var r=n(297);e.exports=r},function(e,t,n){var r=n(24),a=n(44);r({target:"Object",stat:!0,forced:!a,sham:!a},{defineProperty:n(60).f})},function(e,t,n){var r=n(458);e.exports=r},function(e,t,n){var r=n(459),a=Function.prototype;e.exports=function(e){var t=e.bind;return e===a||e instanceof Function&&t===a.bind?r:t}},function(e,t,n){n(460);var r=n(39);e.exports=r("Function").bind},function(e,t,n){n(24)({target:"Function",proto:!0},{bind:n(298)})},function(e,t,n){var r=n(299);e.exports=r},function(e,t,n){var r=n(24),a=n(300);r({target:"Object",stat:!0,forced:Object.assign!==a},{assign:a})},function(e,t,n){var r=n(301);e.exports=r},function(e,t,n){n(465);var r=n(39);e.exports=r("Array").slice},function(e,t,n){"use strict";var r=n(24),a=n(40),o=n(116),i=n(185),s=n(68),c=n(58),u=n(118),l=n(36),p=n(121)("slice"),f=l("species"),d=[].slice,h=Math.max;r({target:"Array",proto:!0,forced:!p},{slice:function(e,t){var n,r,l,p=c(this),m=s(p.length),v=i(e,m),g=i(void 0===t?m:t,m);if(o(p)&&("function"!=typeof(n=p.constructor)||n!==Array&&!o(n.prototype)?a(n)&&null===(n=n[f])&&(n=void 0):n=void 0,n===Array||void 0===n))return d.call(p,v,g);for(r=new(void 0===n?Array:n)(h(g-v,0)),l=0;v<g;v++,l++)v in p&&u(r,l,p[v]);return r.length=l,r}})},function(e,t,n){var r=n(302);e.exports=r},function(e,t,n){n(24)({target:"Array",stat:!0},{isArray:n(116)})},function(e,t,n){var r=n(469);e.exports=r},function(e,t,n){var r=n(470),a=Array.prototype;e.exports=function(e){var t=e.reduce;return e===a||e instanceof Array&&t===a.reduce?r:t}},function(e,t,n){n(471);var r=n(39);e.exports=r("Array").reduce},function(e,t,n){"use strict";var r=n(24),a=n(472).left,o=n(95),i=n(120),s=n(119);r({target:"Array",proto:!0,forced:!o("reduce")||!s&&i>79&&i<83},{reduce:function(e){return a(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(67),a=n(61),o=n(139),i=n(68),s=function(e){return function(t,n,s,c){r(n);var u=a(t),l=o(u),p=i(u.length),f=e?p-1:0,d=e?-1:1;if(s<2)for(;;){if(f in l){c=l[f],f+=d;break}if(f+=d,e?f<0:p<=f)throw TypeError("Reduce of empty array with no initial value")}for(;e?f>=0:p>f;f+=d)f in l&&(c=n(c,l[f],f,u));return c}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){var r=n(474);e.exports=r},function(e,t,n){var r=n(475),a=Array.prototype;e.exports=function(e){var t=e.map;return e===a||e instanceof Array&&t===a.map?r:t}},function(e,t,n){n(476);var r=n(39);e.exports=r("Array").map},function(e,t,n){"use strict";var r=n(24),a=n(75).map;r({target:"Array",proto:!0,forced:!n(121)("map")},{map:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";(function(e){var r=n(478),a=n(479),o=n(480);function i(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=f(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|h(t,n),a=(e=s(e,r)).write(t,n);a!==r&&(e=e.slice(0,a));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|d(t.length);return 0===(e=s(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?s(e,0):f(e,t);if("Buffer"===t.type&&o(t.data))return f(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function p(e,t){if(l(t),e=s(e,t<0?0:0|d(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function f(e,t){var n=t.length<0?0:0|d(t.length);e=s(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function d(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function h(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function v(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,a);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,a){var o,i=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;i=2,s/=2,c/=2,n/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(a){var l=-1;for(o=n;o<s;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*i}else-1!==l&&(o-=o-l),l=-1}else for(n+c>s&&(n=s-c),o=n;o>=0;o--){for(var p=!0,f=0;f<c;f++)if(u(e,o+f)!==u(t,f)){p=!1;break}if(p)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var a=e.length-n;r?(r=Number(r))>a&&(r=a):r=a;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var i=0;i<r;++i){var s=parseInt(t.substr(2*i,2),16);if(isNaN(s))return i;e[n+i]=s}return i}function E(e,t,n,r){return F(V(t,e.length-n),e,n,r)}function x(e,t,n,r){return F(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return x(e,t,n,r)}function w(e,t,n,r){return F(z(t),e,n,r)}function j(e,t,n,r){return F(function(e,t){for(var n,r,a,o=[],i=0;i<e.length&&!((t-=2)<0);++i)r=(n=e.charCodeAt(i))>>8,a=n%256,o.push(a),o.push(r);return o}(t,e.length-n),e,n,r)}function O(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a<n;){var o,i,s,c,u=e[a],l=null,p=u>239?4:u>223?3:u>191?2:1;if(a+p<=n)switch(p){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[a+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[a+1],i=e[a+2],128==(192&o)&&128==(192&i)&&(c=(15&u)<<12|(63&o)<<6|63&i)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[a+1],i=e[a+2],s=e[a+3],128==(192&o)&&128==(192&i)&&128==(192&s)&&(c=(15&u)<<18|(63&o)<<12|(63&i)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,p=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),a+=p}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=i(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return p(null,e)},c.allocUnsafeSlow=function(e){return p(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,a=0,o=Math.min(n,r);a<o;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){var i=e[n];if(!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,a),a+=i.length}return r},c.byteLength=h,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)v(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?C(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,a){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(a>>>=0)-(r>>>=0),i=(n>>>=0)-(t>>>=0),s=Math.min(o,i),u=this.slice(r,a),l=e.slice(t,n),p=0;p<s;++p)if(u[p]!==l[p]){o=u[p],i=l[p];break}return o<i?-1:i<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var a=this.length-t;if((void 0===n||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":return x(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;a<n;++a)r+=String.fromCharCode(127&e[a]);return r}function k(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;a<n;++a)r+=String.fromCharCode(e[a]);return r}function I(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var a="",o=t;o<n;++o)a+=U(e[o]);return a}function P(e,t,n){for(var r=e.slice(t,n),a="",o=0;o<r.length;o+=2)a+=String.fromCharCode(r[o]+256*r[o+1]);return a}function T(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,a,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,o=Math.min(e.length-n,2);a<o;++a)e[n+a]=(t&255<<8*(r?a:1-a))>>>8*(r?a:1-a)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,o=Math.min(e.length-n,4);a<o;++a)e[n+a]=t>>>8*(r?a:3-a)&255}function D(e,t,n,r,a,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,r,o){return o||D(e,0,n,4),a.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,o){return o||D(e,0,n,8),a.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var a=t-e;n=new c(a,void 0);for(var o=0;o<a;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=this[e],a=1,o=0;++o<t&&(a*=256);)r+=this[e+o]*a;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=this[e+--t],a=1;t>0&&(a*=256);)r+=this[e+--t]*a;return r},c.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=this[e],a=1,o=0;++o<t&&(a*=256);)r+=this[e+o]*a;return r>=(a*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||T(e,t,this.length);for(var r=t,a=1,o=this[e+--r];r>0&&(a*=256);)o+=this[e+--r]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),a.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),a.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),a.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),a.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,o=0;for(this[t]=255&e;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var a=n-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);R(this,e,t,n,a-1,-a)}var o=0,i=1,s=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);R(this,e,t,n,a-1,-a)}var o=n-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var a,o=r-n;if(this===e&&n<t&&t<r)for(a=o-1;a>=0;--a)e[a+t]=this[a+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var a=e.charCodeAt(0);a<256&&(e=a)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var i=c.isBuffer(e)?e:V(new c(e,r).toString()),s=i.length;for(o=0;o<n-t;++o)this[o+t]=i[o%s]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){var n;t=t||1/0;for(var r=e.length,a=null,o=[],i=0;i<r;++i){if((n=e.charCodeAt(i))>55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(i+1===r){(t-=3)>-1&&o.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function z(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,n,r){for(var a=0;a<r&&!(a+n>=t.length||a>=e.length);++a)t[a+n]=e[a];return a}}).call(this,n(177))},function(e,t){e.exports=require("base64-js")},function(e,t){e.exports=require("ieee754")},function(e,t){e.exports=require("isarray")},function(e,t,n){var r=n(195),a=n(303);e.exports=function(e){if(r(e))return a(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(302);e.exports=r},function(e,t,n){n(63),n(83);var r=n(484);e.exports=r},function(e,t,n){var r=n(74),a=n(36),o=n(94),i=a("iterator");e.exports=function(e){var t=Object(e);return void 0!==t[i]||"@@iterator"in t||o.hasOwnProperty(r(t))}},function(e,t,n){var r=n(307);e.exports=r},function(e,t,n){var r=n(24),a=n(308);r({target:"Array",stat:!0,forced:!n(311)((function(e){Array.from(e)}))},{from:a})},function(e,t,n){var r=n(46),a=n(309);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){throw a(e),t}}},function(e,t,n){e.exports=n(489)},function(e,t,n){var r=n(301);e.exports=r},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(137),a=n(305),o=n(313);e.exports=function(e,t){if(void 0!==r&&a(Object(e))){var n=[],i=!0,s=!1,c=void 0;try{for(var u,l=o(e);!(i=(u=l.next()).done)&&(n.push(u.value),!t||n.length!==t);i=!0);}catch(e){s=!0,c=e}finally{try{i||null==l.return||l.return()}finally{if(s)throw c}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){n(63),n(83);var r=n(314);e.exports=r},function(e,t,n){e.exports=n(494)},function(e,t,n){n(63),n(83);var r=n(126);e.exports=r},function(e,t,n){n(63);var r=n(496),a=n(74),o=Array.prototype,i={DOMTokenList:!0,NodeList:!0};e.exports=function(e){var t=e.entries;return e===o||e instanceof Array&&t===o.entries||i.hasOwnProperty(a(e))?r:t}},function(e,t,n){var r=n(497);e.exports=r},function(e,t,n){n(125);var r=n(39);e.exports=r("Array").entries},function(e,t,n){var r=n(499);e.exports=r},function(e,t,n){n(500);var r=n(39);e.exports=r("Array").forEach},function(e,t,n){"use strict";var r=n(24),a=n(501);r({target:"Array",proto:!0,forced:[].forEach!=a},{forEach:a})},function(e,t,n){"use strict";var r=n(75).forEach,a=n(95)("forEach");e.exports=a?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},function(e,t,n){var r=n(503);e.exports=r},function(e,t,n){var r=n(504),a=Array.prototype;e.exports=function(e){var t=e.sort;return e===a||e instanceof Array&&t===a.sort?r:t}},function(e,t,n){n(505);var r=n(39);e.exports=r("Array").sort},function(e,t,n){"use strict";var r=n(24),a=n(67),o=n(61),i=n(34),s=n(95),c=[],u=c.sort,l=i((function(){c.sort(void 0)})),p=i((function(){c.sort(null)})),f=s("sort");r({target:"Array",proto:!0,forced:l||!p||!f},{sort:function(e){return void 0===e?u.call(o(this)):u.call(o(this),a(e))}})},function(e,t,n){var r=n(507);e.exports=r},function(e,t,n){var r=n(508),a=Array.prototype;e.exports=function(e){var t=e.some;return e===a||e instanceof Array&&t===a.some?r:t}},function(e,t,n){n(509);var r=n(39);e.exports=r("Array").some},function(e,t,n){"use strict";var r=n(24),a=n(75).some;r({target:"Array",proto:!0,forced:!n(95)("some")},{some:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(511);e.exports=r},function(e,t,n){var r=n(512),a=n(514),o=Array.prototype,i=String.prototype;e.exports=function(e){var t=e.includes;return e===o||e instanceof Array&&t===o.includes?r:"string"==typeof e||e===i||e instanceof String&&t===i.includes?a:t}},function(e,t,n){n(513);var r=n(39);e.exports=r("Array").includes},function(e,t,n){"use strict";var r=n(24),a=n(184).includes,o=n(193);r({target:"Array",proto:!0},{includes:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),o("includes")},function(e,t,n){n(515);var r=n(39);e.exports=r("String").includes},function(e,t,n){"use strict";var r=n(24),a=n(317),o=n(104);r({target:"String",proto:!0,forced:!n(318)("includes")},{includes:function(e){return!!~String(o(this)).indexOf(a(e),arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(40),a=n(115),o=n(36)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"==a(e))}},function(e,t,n){var r=n(319);e.exports=r},function(e,t,n){n(519);var r=n(39);e.exports=r("Array").indexOf},function(e,t,n){"use strict";var r=n(24),a=n(184).indexOf,o=n(95),i=[].indexOf,s=!!i&&1/[1].indexOf(1,-0)<0,c=o("indexOf");r({target:"Array",proto:!0,forced:s||!c},{indexOf:function(e){return s?i.apply(this,arguments)||0:a(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(521);e.exports=r},function(e,t,n){var r=n(522),a=Array.prototype;e.exports=function(e){var t=e.find;return e===a||e instanceof Array&&t===a.find?r:t}},function(e,t,n){n(523);var r=n(39);e.exports=r("Array").find},function(e,t,n){"use strict";var r=n(24),a=n(75).find,o=n(193),i="find",s=!0;i in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s},{find:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}}),o(i)},function(e,t,n){var r=n(525);e.exports=r},function(e,t,n){var r=n(526),a=String.prototype;e.exports=function(e){var t=e.startsWith;return"string"==typeof e||e===a||e instanceof String&&t===a.startsWith?r:t}},function(e,t,n){n(527);var r=n(39);e.exports=r("String").startsWith},function(e,t,n){"use strict";var r,a=n(24),o=n(89).f,i=n(68),s=n(317),c=n(104),u=n(318),l=n(81),p="".startsWith,f=Math.min,d=u("startsWith");a({target:"String",proto:!0,forced:!!(l||d||(r=o(String.prototype,"startsWith"),!r||r.writable))&&!d},{startsWith:function(e){var t=String(c(this));s(e);var n=i(f(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return p?p.call(t,r,n):t.slice(n,n+r.length)===r}})},function(e,t,n){var r=n(529);e.exports=r},function(e,t,n){var r=n(530),a=String.prototype;e.exports=function(e){var t=e.trim;return"string"==typeof e||e===a||e instanceof String&&t===a.trim?r:t}},function(e,t,n){n(531);var r=n(39);e.exports=r("String").trim},function(e,t,n){"use strict";var r=n(24),a=n(532).trim;r({target:"String",proto:!0,forced:n(533)("trim")},{trim:function(){return a(this)}})},function(e,t,n){var r=n(104),a="["+n(320)+"]",o=RegExp("^"+a+a+"*"),i=RegExp(a+a+"*$"),s=function(e){return function(t){var n=String(r(t));return 1&e&&(n=n.replace(o,"")),2&e&&(n=n.replace(i,"")),n}};e.exports={start:s(1),end:s(2),trim:s(3)}},function(e,t,n){var r=n(34),a=n(320);e.exports=function(e){return r((function(){return!!a[e]()||"
"!="
"[e]()||a[e].name!==e}))}},function(e,t,n){var r=n(77),a=n(211);e.exports=function(e){return a(r(e).toLowerCase())}},function(e,t,n){var r=n(105),a=Object.prototype,o=a.hasOwnProperty,i=a.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var a=i.call(e);return r&&(t?e[s]=n:delete e[s]),a}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r=n(538),a=n(325),o=n(539),i=n(77);e.exports=function(e){return function(t){t=i(t);var n=a(t)?o(t):void 0,s=n?n[0]:t.charAt(0),c=n?r(n,1).join(""):t.slice(1);return s[e]()+c}}},function(e,t,n){var r=n(324);e.exports=function(e,t,n){var a=e.length;return n=void 0===n?a:n,!t&&n>=a?e:r(e,t,n)}},function(e,t,n){var r=n(540),a=n(325),o=n(541);e.exports=function(e){return a(e)?o(e):r(e)}},function(e,t){e.exports=function(e){return e.split("")}},function(e,t){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",a="\\ud83c[\\udffb-\\udfff]",o="[^\\ud800-\\udfff]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",c="(?:"+r+"|"+a+")"+"?",u="[\\ufe0e\\ufe0f]?",l=u+c+("(?:\\u200d(?:"+[o,i,s].join("|")+")"+u+c+")*"),p="(?:"+[o+r+"?",r,i,s,n].join("|")+")",f=RegExp(a+"(?="+a+")|"+p+l,"g");e.exports=function(e){return e.match(f)||[]}},function(e,t,n){var r=n(326),a=n(543),o=n(546),i=RegExp("['’]","g");e.exports=function(e){return function(t){return r(o(a(t).replace(i,"")),e,"")}}},function(e,t,n){var r=n(544),a=n(77),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,i=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=a(e))&&e.replace(o,r).replace(i,"")}},function(e,t,n){var r=n(545)({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"});e.exports=r},function(e,t){e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},function(e,t,n){var r=n(547),a=n(548),o=n(77),i=n(549);e.exports=function(e,t,n){return e=o(e),void 0===(t=n?void 0:t)?a(e)?i(e):r(e):e.match(t)||[]}},function(e,t){var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(n)||[]}},function(e,t){var n=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return n.test(e)}},function(e,t){var n="\\u2700-\\u27bf",r="a-z\\xdf-\\xf6\\xf8-\\xff",a="A-Z\\xc0-\\xd6\\xd8-\\xde",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",i="["+o+"]",s="\\d+",c="[\\u2700-\\u27bf]",u="["+r+"]",l="[^\\ud800-\\udfff"+o+s+n+r+a+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",d="["+a+"]",h="(?:"+u+"|"+l+")",m="(?:"+d+"|"+l+")",v="(?:['’](?:d|ll|m|re|s|t|ve))?",g="(?:['’](?:D|LL|M|RE|S|T|VE))?",y="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",b="[\\ufe0e\\ufe0f]?",E=b+y+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",p,f].join("|")+")"+b+y+")*"),x="(?:"+[c,p,f].join("|")+")"+E,S=RegExp([d+"?"+u+"+"+v+"(?="+[i,d,"$"].join("|")+")",m+"+"+g+"(?="+[i,d+h,"$"].join("|")+")",d+"?"+h+"+"+v,d+"+"+g,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s,x].join("|"),"g");e.exports=function(e){return e.match(S)||[]}},function(e,t,n){var r=n(551),a=n(148),o=n(197);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||a),string:new r}}},function(e,t,n){var r=n(552),a=n(557),o=n(558),i=n(559),s=n(560);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=a,c.prototype.get=o,c.prototype.has=i,c.prototype.set=s,e.exports=c},function(e,t,n){var r=n(147);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t,n){var r=n(55),a=n(554),o=n(51),i=n(327),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,p=u.hasOwnProperty,f=RegExp("^"+l.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||a(e))&&(r(e)?f:s).test(i(e))}},function(e,t,n){var r,a=n(555),o=(r=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!o&&o in e}},function(e,t,n){var r=n(64)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(147),a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return a.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(147),a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:a.call(t,e)}},function(e,t,n){var r=n(147);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(149),a=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():a.call(t,n,1),--this.size,!0)}},function(e,t,n){var r=n(149);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(149);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(149);e.exports=function(e,t){var n=this.__data__,a=r(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}},function(e,t,n){var r=n(150);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(150);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(150);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(150);e.exports=function(e,t){var n=r(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}},function(e,t,n){var r=n(151),a=n(99),o=n(98);e.exports=function(e){return function(t,n,i){var s=Object(t);if(!a(t)){var c=r(n,3);t=o(t),n=function(e){return c(s[e],e,s)}}var u=e(t,n,i);return u>-1?s[c?t[u]:u]:void 0}}},function(e,t,n){var r=n(573),a=n(598),o=n(339);e.exports=function(e){var t=a(e);return 1==t.length&&t[0][2]?o(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(198),a=n(328);e.exports=function(e,t,n,o){var i=n.length,s=i,c=!o;if(null==e)return!s;for(e=Object(e);i--;){var u=n[i];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<s;){var l=(u=n[i])[0],p=e[l],f=u[1];if(c&&u[2]){if(void 0===p&&!(l in e))return!1}else{var d=new r;if(o)var h=o(p,f,l,e,t,d);if(!(void 0===h?a(f,p,3,o,d):h))return!1}}return!0}},function(e,t,n){var r=n(148);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(148),a=n(197),o=n(196);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var i=n.__data__;if(!a||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new o(i)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(198),a=n(329),o=n(584),i=n(587),s=n(128),c=n(47),u=n(153),l=n(202),p="[object Arguments]",f="[object Array]",d="[object Object]",h=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,m,v,g){var y=c(e),b=c(t),E=y?f:s(e),x=b?f:s(t),S=(E=E==p?d:E)==d,w=(x=x==p?d:x)==d,j=E==x;if(j&&u(e)){if(!u(t))return!1;y=!0,S=!1}if(j&&!S)return g||(g=new r),y||l(e)?a(e,t,n,m,v,g):o(e,t,E,n,m,v,g);if(!(1&n)){var O=S&&h.call(e,"__wrapped__"),C=w&&h.call(t,"__wrapped__");if(O||C){var _=O?e.value():e,A=C?t.value():t;return g||(g=new r),v(_,A,n,m,g)}}return!!j&&(g||(g=new r),i(e,t,n,m,v,g))}},function(e,t,n){var r=n(196),a=n(581),o=n(582);function i(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}i.prototype.add=i.prototype.push=a,i.prototype.has=o,e.exports=i},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){var r=n(105),a=n(331),o=n(101),i=n(329),s=n(585),c=n(586),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,p,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!p(new a(e),new a(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var d=s;case"[object Set]":var h=1&r;if(d||(d=c),e.size!=t.size&&!h)return!1;var m=f.get(e);if(m)return m==t;r|=2,f.set(e,t);var v=i(d(e),d(t),r,u,p,f);return f.delete(e),v;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(332),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,o,i,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var p=l;p--;){var f=u[p];if(!(c?f in t:a.call(t,f)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var m=!0;s.set(e,t),s.set(t,e);for(var v=c;++p<l;){var g=e[f=u[p]],y=t[f];if(o)var b=c?o(y,g,f,t,e,s):o(g,y,f,e,t,s);if(!(void 0===b?g===y||i(g,y,n,o,s):b)){m=!1;break}v||(v="constructor"==f)}if(m&&!v){var E=e.constructor,x=t.constructor;E==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof E&&E instanceof E&&"function"==typeof x&&x instanceof x||(m=!1)}return s.delete(e),s.delete(t),m}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,a=0,o=[];++n<r;){var i=e[n];t(i,n,e)&&(o[a++]=i)}return o}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(96),a=n(76);e.exports=function(e){return a(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(96),a=n(203),o=n(76),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&a(e.length)&&!!i[r(e)]}},function(e,t,n){var r=n(337)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(97)(n(64),"DataView");e.exports=r},function(e,t,n){var r=n(97)(n(64),"Promise");e.exports=r},function(e,t,n){var r=n(97)(n(64),"Set");e.exports=r},function(e,t,n){var r=n(97)(n(64),"WeakMap");e.exports=r},function(e,t,n){var r=n(338),a=n(98);e.exports=function(e){for(var t=a(e),n=t.length;n--;){var o=t[n],i=e[o];t[n]=[o,i,r(i)]}return t}},function(e,t,n){var r=n(328),a=n(41),o=n(340),i=n(206),s=n(338),c=n(339),u=n(107);e.exports=function(e,t){return i(e)&&s(t)?c(u(e),t):function(n){var i=a(n,e);return void 0===i&&i===t?o(n,e):r(t,i,3)}}},function(e,t,n){var r=n(601),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,i=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(a,(function(e,n,r,a){t.push(r?a.replace(o,"$1"):n||e)})),t}));e.exports=i},function(e,t,n){var r=n(212);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(106),a=n(152),o=n(47),i=n(154),s=n(203),c=n(107);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,p=!1;++u<l;){var f=c(t[u]);if(!(p=null!=e&&n(e,f)))break;e=e[f]}return p||++u!=l?p:!!(l=null==e?0:e.length)&&s(l)&&i(f,l)&&(o(e)||a(e))}},function(e,t,n){var r=n(605),a=n(606),o=n(206),i=n(107);e.exports=function(e){return o(e)?r(i(e)):a(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(155);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(608),a=n(151),o=n(341),i=Math.max;e.exports=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var c=null==n?0:o(n);return c<0&&(c=i(s+c,0)),r(e,a(t,3),c)}},function(e,t){e.exports=function(e,t,n,r){for(var a=e.length,o=n+(r?1:-1);r?o--:++o<a;)if(t(e[o],o,e))return o;return-1}},function(e,t,n){var r=n(342),a=1/0;e.exports=function(e){return e?(e=r(e))===a||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},function(e,t,n){var r=n(611),a=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(a,""):e}},function(e,t){var n=/\s/;e.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},function(e,t,n){var r=n(343);e.exports=function(e,t){var n;return r(e,(function(e,r,a){return!(n=t(e,r,a))})),!!n}},function(e,t,n){var r=n(614),a=n(98);e.exports=function(e,t){return e&&r(e,t,a)}},function(e,t,n){var r=n(615)();e.exports=r},function(e,t){e.exports=function(e){return function(t,n,r){for(var a=-1,o=Object(t),i=r(t),s=i.length;s--;){var c=i[e?s:++a];if(!1===n(o[c],c,o))break}return t}}},function(e,t,n){var r=n(99);e.exports=function(e,t){return function(n,a){if(null==n)return n;if(!r(n))return e(n,a);for(var o=n.length,i=t?o:-1,s=Object(n);(t?i--:++i<o)&&!1!==a(s[i],i,s););return n}}},function(e,t){var n,r,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c,u=[],l=!1,p=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):p=-1,u.length&&d())}function d(){if(!l){var e=s(f);l=!0;for(var t=u.length;t;){for(c=u,u=[];++p<t;)c&&c[p].run();p=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new h(e,t)),1!==u.length||l||s(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=m,a.addListener=m,a.once=m,a.off=m,a.removeListener=m,a.removeAllListeners=m,a.emit=m,a.prependListener=m,a.prependOnceListener=m,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,t){var n={"&":"&",'"':""","'":"'","<":"<",">":">"};e.exports=function(e){return e&&e.replace?e.replace(/([&"<>'])/g,(function(e,t){return n[t]})):e}},function(e,t){e.exports=require("stream")},function(e,t,n){var r=n(621);e.exports=r},function(e,t,n){var r=n(622),a=Array.prototype;e.exports=function(e){var t=e.every;return e===a||e instanceof Array&&t===a.every?r:t}},function(e,t,n){n(623);var r=n(39);e.exports=r("Array").every},function(e,t,n){"use strict";var r=n(24),a=n(75).every;r({target:"Array",proto:!0,forced:!n(95)("every")},{every:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t){e.exports=function(e,t,n,r,a){return a(e,(function(e,a,o){n=r?(r=!1,e):t(n,e,a,o)})),n}},function(e,t,n){var r=n(296);e.exports=r},function(e,t,n){var r=n(627);e.exports=r},function(e,t,n){n(285);var r=n(31);e.exports=r.Object.getOwnPropertySymbols},function(e,t,n){e.exports=n(629)},function(e,t,n){var r=n(295);e.exports=r},function(e,t,n){var r=n(631);e.exports=r},function(e,t,n){n(632);var r=n(31).Object,a=e.exports=function(e,t){return r.getOwnPropertyDescriptor(e,t)};r.getOwnPropertyDescriptor.sham&&(a.sham=!0)},function(e,t,n){var r=n(24),a=n(34),o=n(58),i=n(89).f,s=n(44),c=a((function(){i(1)}));r({target:"Object",stat:!0,forced:!s||c,sham:!s},{getOwnPropertyDescriptor:function(e,t){return i(o(e),t)}})},function(e,t,n){e.exports=n(634)},function(e,t,n){var r=n(316);e.exports=r},function(e,t,n){e.exports=n(636)},function(e,t,n){var r=n(637);e.exports=r},function(e,t,n){n(638);var r=n(31);e.exports=r.Object.getOwnPropertyDescriptors},function(e,t,n){var r=n(24),a=n(44),o=n(639),i=n(58),s=n(89),c=n(118);r({target:"Object",stat:!0,sham:!a},{getOwnPropertyDescriptors:function(e){for(var t,n,r=i(e),a=s.f,u=o(r),l={},p=0;u.length>p;)void 0!==(n=a(r,t=u[p++]))&&c(l,t,n);return l}})},function(e,t,n){var r=n(62),a=n(187),o=n(188),i=n(46);e.exports=r("Reflect","ownKeys")||function(e){var t=a.f(i(e)),n=o.f;return n?t.concat(n(e)):t}},function(e,t,n){e.exports=n(641)},function(e,t,n){var r=n(642);e.exports=r},function(e,t,n){n(643);var r=n(31).Object,a=e.exports=function(e,t){return r.defineProperties(e,t)};r.defineProperties.sham&&(a.sham=!0)},function(e,t,n){var r=n(24),a=n(44);r({target:"Object",stat:!0,forced:!a,sham:!a},{defineProperties:n(183)})},function(e,t,n){var r=n(319);e.exports=r},function(e,t,n){var r=n(345),a=n(348);e.exports=function(e,t){if(null==e)return{};var n,o,i={},s=r(e);for(o=0;o<s.length;o++)n=s[o],a(t).call(t,n)>=0||(i[n]=e[n]);return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(647)},function(e,t,n){var r=n(349);n(653),n(654),n(655),n(656),e.exports=r},function(e,t,n){"use strict";var r,a,o,i,s=n(24),c=n(81),u=n(38),l=n(62),p=n(351),f=n(93),d=n(129),h=n(82),m=n(352),v=n(40),g=n(67),y=n(108),b=n(289),E=n(100),x=n(311),S=n(353),w=n(354).set,j=n(649),O=n(356),C=n(651),_=n(130),A=n(156),k=n(69),I=n(283),P=n(36),T=n(119),R=n(120),N=P("species"),M="Promise",D=k.get,q=k.set,B=k.getterFor(M),L=p,U=u.TypeError,V=u.document,z=u.process,F=l("fetch"),J=_.f,W=J,H=!!(V&&V.createEvent&&u.dispatchEvent),$="function"==typeof PromiseRejectionEvent,Y="unhandledrejection",K=I(M,(function(){if(!(b(L)!==String(L))){if(66===R)return!0;if(!T&&!$)return!0}if(c&&!L.prototype.finally)return!0;if(R>=51&&/native code/.test(L))return!1;var e=L.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[N]=t,!(e.then((function(){}))instanceof t)})),G=K||!x((function(e){L.all(e).catch((function(){}))})),Z=function(e){var t;return!(!v(e)||"function"!=typeof(t=e.then))&&t},X=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;j((function(){for(var r=e.value,a=1==e.state,o=0;n.length>o;){var i,s,c,u=n[o++],l=a?u.ok:u.fail,p=u.resolve,f=u.reject,d=u.domain;try{l?(a||(2===e.rejection&&ne(e),e.rejection=1),!0===l?i=r:(d&&d.enter(),i=l(r),d&&(d.exit(),c=!0)),i===u.promise?f(U("Promise-chain cycle")):(s=Z(i))?s.call(i,p,f):p(i)):f(r)}catch(e){d&&!c&&d.exit(),f(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&ee(e)}))}},Q=function(e,t,n){var r,a;H?((r=V.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),u.dispatchEvent(r)):r={promise:t,reason:n},!$&&(a=u["on"+e])?a(r):e===Y&&C("Unhandled promise rejection",n)},ee=function(e){w.call(u,(function(){var t,n=e.facade,r=e.value;if(te(e)&&(t=A((function(){T?z.emit("unhandledRejection",r,n):Q(Y,n,r)})),e.rejection=T||te(e)?2:1,t.error))throw t.value}))},te=function(e){return 1!==e.rejection&&!e.parent},ne=function(e){w.call(u,(function(){var t=e.facade;T?z.emit("rejectionHandled",t):Q("rejectionhandled",t,e.value)}))},re=function(e,t,n){return function(r){e(t,r,n)}},ae=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,X(e,!0))},oe=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw U("Promise can't be resolved itself");var r=Z(t);r?j((function(){var n={done:!1};try{r.call(t,re(oe,n,e),re(ae,n,e))}catch(t){ae(n,t,e)}})):(e.value=t,e.state=1,X(e,!1))}catch(t){ae({done:!1},t,e)}}};K&&(L=function(e){y(this,L,M),g(e),r.call(this);var t=D(this);try{e(re(oe,t),re(ae,t))}catch(e){ae(t,e)}},(r=function(e){q(this,{type:M,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=d(L.prototype,{then:function(e,t){var n=B(this),r=J(S(this,L));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=T?z.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&X(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r,t=D(e);this.promise=e,this.resolve=re(oe,t),this.reject=re(ae,t)},_.f=J=function(e){return e===L||e===o?new a(e):W(e)},c||"function"!=typeof p||(i=p.prototype.then,f(p.prototype,"then",(function(e,t){var n=this;return new L((function(e,t){i.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof F&&s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return O(L,F.apply(u,arguments))}}))),s({global:!0,wrap:!0,forced:K},{Promise:L}),h(L,M,!1,!0),m(M),o=l(M),s({target:M,stat:!0,forced:K},{reject:function(e){var t=J(this);return t.reject.call(void 0,e),t.promise}}),s({target:M,stat:!0,forced:c||K},{resolve:function(e){return O(c&&this===o?L:this,e)}}),s({target:M,stat:!0,forced:G},{all:function(e){var t=this,n=J(t),r=n.resolve,a=n.reject,o=A((function(){var n=g(t.resolve),o=[],i=0,s=1;E(e,(function(e){var c=i++,u=!1;o.push(void 0),s++,n.call(t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),a)})),--s||r(o)}));return o.error&&a(o.value),n.promise},race:function(e){var t=this,n=J(t),r=n.reject,a=A((function(){var a=g(t.resolve);E(e,(function(e){a.call(t,e).then(n.resolve,r)}))}));return a.error&&r(a.value),n.promise}})},function(e,t,n){var r,a,o,i,s,c,u,l,p=n(38),f=n(89).f,d=n(354).set,h=n(355),m=n(650),v=n(119),g=p.MutationObserver||p.WebKitMutationObserver,y=p.document,b=p.process,E=p.Promise,x=f(p,"queueMicrotask"),S=x&&x.value;S||(r=function(){var e,t;for(v&&(e=b.domain)&&e.exit();a;){t=a.fn,a=a.next;try{t()}catch(e){throw a?i():o=void 0,e}}o=void 0,e&&e.enter()},h||v||m||!g||!y?E&&E.resolve?(u=E.resolve(void 0),l=u.then,i=function(){l.call(u,r)}):i=v?function(){b.nextTick(r)}:function(){d.call(p,r)}:(s=!0,c=y.createTextNode(""),new g(r).observe(c,{characterData:!0}),i=function(){c.data=s=!s})),e.exports=S||function(e){var t={fn:e,next:void 0};o&&(o.next=t),a||(a=t,i()),o=t}},function(e,t,n){var r=n(142);e.exports=/web0s(?!.*chrome)/i.test(r)},function(e,t,n){var r=n(38);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},function(e,t,n){"use strict";var r=n(24),a=n(81),o=n(351),i=n(34),s=n(62),c=n(353),u=n(356),l=n(93);r({target:"Promise",proto:!0,real:!0,forced:!!o&&i((function(){o.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=c(this,s("Promise")),n="function"==typeof e;return this.then(n?function(n){return u(t,e()).then((function(){return n}))}:e,n?function(n){return u(t,e()).then((function(){throw n}))}:e)}}),a||"function"!=typeof o||o.prototype.finally||l(o.prototype,"finally",s("Promise").prototype.finally)},function(e,t,n){n(350)},function(e,t,n){n(357)},function(e,t,n){"use strict";var r=n(24),a=n(130),o=n(156);r({target:"Promise",stat:!0},{try:function(e){var t=a.f(this),n=o(e);return(n.error?t.reject:t.resolve)(n.value),t.promise}})},function(e,t,n){n(358)},function(e,t){e.exports=require("regenerator-runtime")},function(e,t,n){var r=n(297);e.exports=r},function(e,t,n){var r=n(349);e.exports=r},function(e,t,n){var r=n(661);e.exports=r},function(e,t,n){n(662);var r=n(31);e.exports=r.Object.values},function(e,t,n){var r=n(24),a=n(359).values;r({target:"Object",stat:!0},{values:function(e){return a(e)}})},function(e,t,n){var r=n(664);e.exports=r},function(e,t,n){n(665);var r=n(31);e.exports=r.Date.now},function(e,t,n){n(24)({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}})},function(e,t,n){var r=n(64);e.exports=function(){return r.Date.now()}},function(e,t,n){e.exports=n(668)},function(e,t,n){var r=n(299);e.exports=r},function(e,t,n){e.exports=n(670)},function(e,t,n){var r=n(363);e.exports=r},function(e,t,n){n(24)({target:"Object",stat:!0,sham:!n(44)},{create:n(92)})},function(e,t,n){var r=n(364);function a(t,n){return e.exports=a=r||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,a(t,n)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(674);e.exports=r},function(e,t,n){n(675);var r=n(31);e.exports=r.Object.setPrototypeOf},function(e,t,n){n(24)({target:"Object",stat:!0},{setPrototypeOf:n(192)})},function(e,t,n){var r=n(677);e.exports=r},function(e,t,n){n(678);var r=n(31);e.exports=r.Reflect.construct},function(e,t,n){var r=n(24),a=n(62),o=n(67),i=n(46),s=n(40),c=n(92),u=n(298),l=n(34),p=a("Reflect","construct"),f=l((function(){function e(){}return!(p((function(){}),[],e)instanceof e)})),d=!l((function(){p((function(){}))})),h=f||d;r({target:"Reflect",stat:!0,forced:h,sham:h},{construct:function(e,t){o(e),i(t);var n=arguments.length<3?e:o(arguments[2]);if(d&&!f)return p(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return r.push.apply(r,t),new(u.apply(e,r))}var a=n.prototype,l=c(s(a)?a:Object.prototype),h=Function.apply.call(e,l,t);return s(h)?h:l}})},function(e,t,n){e.exports=n(680)},function(e,t,n){var r=n(681);e.exports=r},function(e,t,n){n(682);var r=n(31);e.exports=r.Object.getPrototypeOf},function(e,t,n){var r=n(24),a=n(34),o=n(61),i=n(124),s=n(294);r({target:"Object",stat:!0,forced:a((function(){i(1)})),sham:!s},{getPrototypeOf:function(e){return i(o(e))}})},function(e,t,n){var r=n(365);e.exports=function(){if("undefined"==typeof Reflect||!r)return!1;if(r.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(r(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(19).default,a=n(10);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?a(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},function(e,t,n){var r=n(109),a=n(98);e.exports=function(e,t){return e&&r(t,a(t),e)}},function(e,t,n){var r=n(109),a=n(208);e.exports=function(e,t){return e&&r(t,a(t),e)}},function(e,t,n){var r=n(51),a=n(127),o=n(689),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=a(e),n=[];for(var s in e)("constructor"!=s||!t&&i.call(e,s))&&n.push(s);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t,n){(function(e){var r=n(64),a=t&&!t.nodeType&&t,o=a&&"object"==typeof e&&e&&!e.nodeType&&e,i=o&&o.exports===a?r.Buffer:void 0,s=i?i.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(201)(e))},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(109),a=n(200);e.exports=function(e,t){return r(e,a(e),t)}},function(e,t,n){var r=n(109),a=n(367);e.exports=function(e,t){return r(e,a(e),t)}},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,n){var r=n(210),a=n(696),o=n(697),i=n(698),s=n(699);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return a(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return o(e);case"[object Set]":return new c;case"[object Symbol]":return i(e)}}},function(e,t,n){var r=n(210);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},function(e,t){var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,n){var r=n(105),a=r?r.prototype:void 0,o=a?a.valueOf:void 0;e.exports=function(e){return o?Object(o.call(e)):{}}},function(e,t,n){var r=n(210);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},function(e,t,n){var r=n(701),a=n(209),o=n(127);e.exports=function(e){return"function"!=typeof e.constructor||o(e)?{}:r(a(e))}},function(e,t,n){var r=n(51),a=Object.create,o=function(){function e(){}return function(t){if(!r(t))return{};if(a)return a(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=o},function(e,t,n){var r=n(703),a=n(204),o=n(205),i=o&&o.isMap,s=i?a(i):r;e.exports=s},function(e,t,n){var r=n(128),a=n(76);e.exports=function(e){return a(e)&&"[object Map]"==r(e)}},function(e,t,n){var r=n(705),a=n(204),o=n(205),i=o&&o.isSet,s=i?a(i):r;e.exports=s},function(e,t,n){var r=n(128),a=n(76);e.exports=function(e){return a(e)&&"[object Set]"==r(e)}},function(e,t,n){var r=n(106),a=n(707),o=n(708),i=n(107);e.exports=function(e,t){return t=r(t,e),null==(e=o(e,t))||delete e[i(a(t))]}},function(e,t){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},function(e,t,n){var r=n(155),a=n(324);e.exports=function(e,t){return t.length<2?e:r(e,a(t,0,-1))}},function(e,t,n){var r=n(225);e.exports=function(e){return r(e)?void 0:e}},function(e,t,n){var r=n(711);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},function(e,t,n){var r=n(199),a=n(712);e.exports=function e(t,n,o,i,s){var c=-1,u=t.length;for(o||(o=a),s||(s=[]);++c<u;){var l=t[c];n>0&&o(l)?n>1?e(l,n-1,o,i,s):r(s,l):i||(s[s.length]=l)}return s}},function(e,t,n){var r=n(105),a=n(152),o=n(47),i=r?r.isConcatSpreadable:void 0;e.exports=function(e){return o(e)||a(e)||!!(i&&e&&e[i])}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(715),a=n(362),o=n(207),i=a?function(e,t){return a(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:o;e.exports=i},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var a=n(),o=16-(a-r);if(r=a,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(718);e.exports=r},function(e,t,n){n(719);var r=n(31);e.exports=r.Object.entries},function(e,t,n){var r=n(24),a=n(359).entries;r({target:"Object",stat:!0},{entries:function(e){return a(e)}})},function(e,t,n){var r=n(307);e.exports=r},function(e,t){!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,a="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,i="ArrayBuffer"in e;if(i)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function d(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=h(t);return t.readAsArrayBuffer(e),n}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,n,r=d(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=h(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(E)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=u(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},f.prototype.delete=function(e){delete this.map[u(e)]},f.prototype.get=function(e){return e=u(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(u(e))},f.prototype.set=function(e,t){this.map[u(e)]=l(t)},f.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},r&&(f.prototype[Symbol.iterator]=f.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n,r,a=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,a||null==e._bodyInit||(a=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),y.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}function E(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),a=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(a))}})),t}function x(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},x.error=function(){var e=new x(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];x.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new x(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function w(e,n){return new Promise((function(r,o){var i=new b(e,n);if(i.signal&&i.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var a=n.join(":").trim();t.append(r,a)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var a="response"in s?s.response:s.responseText;r(new x(a,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&a&&(s.responseType="blob"),i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),i.signal&&(i.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",c)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}w.polyfill=!0,e.fetch||(e.fetch=w,e.Headers=f,e.Request=b,e.Response=x),t.Headers=f,t.Request=b,t.Response=x,t.fetch=w}({})}("undefined"!=typeof self?self:this)},function(e,t,n){var r=n(723),a=n(340);e.exports=function(e,t){return r(e,t,(function(t,n){return a(e,n)}))}},function(e,t,n){var r=n(155),a=n(360),o=n(106);e.exports=function(e,t,n){for(var i=-1,s=t.length,c={};++i<s;){var u=t[i],l=r(e,u);n(l,u)&&a(c,o(u,e),l)}return c}},function(e,t,n){e.exports=n(725)},function(e,t,n){var r=n(726);e.exports=r},function(e,t,n){n(727);var r=n(31);e.exports=r.Reflect.get},function(e,t,n){var r=n(24),a=n(40),o=n(46),i=n(48),s=n(89),c=n(124);r({target:"Reflect",stat:!0},{get:function e(t,n){var r,u,l=arguments.length<3?t:arguments[2];return o(t)===l?t[n]:(r=s.f(t,n))?i(r,"value")?r.value:void 0===r.get?void 0:r.get.call(l):a(u=c(t))?e(u,n,l):void 0}})},function(e,t,n){var r=n(159);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(730);e.exports=r},function(e,t,n){var r=n(731),a=Array.prototype;e.exports=function(e){var t=e.splice;return e===a||e instanceof Array&&t===a.splice?r:t}},function(e,t,n){n(732);var r=n(39);e.exports=r("Array").splice},function(e,t,n){"use strict";var r=n(24),a=n(185),o=n(117),i=n(68),s=n(61),c=n(179),u=n(118),l=n(121)("splice"),p=Math.max,f=Math.min,d=9007199254740991,h="Maximum allowed length exceeded";r({target:"Array",proto:!0,forced:!l},{splice:function(e,t){var n,r,l,m,v,g,y=s(this),b=i(y.length),E=a(e,b),x=arguments.length;if(0===x?n=r=0:1===x?(n=0,r=b-E):(n=x-2,r=f(p(o(t),0),b-E)),b+n-r>d)throw TypeError(h);for(l=c(y,r),m=0;m<r;m++)(v=E+m)in y&&u(l,m,y[v]);if(l.length=r,n<r){for(m=E;m<b-r;m++)g=m+n,(v=m+r)in y?y[g]=y[v]:delete y[g];for(m=b;m>b-r+n;m--)delete y[m-1]}else if(n>r)for(m=b-r;m>E;m--)g=m+n-1,(v=m+r-1)in y?y[g]=y[v]:delete y[g];for(m=0;m<n;m++)y[m+E]=arguments[m+2];return y.length=b-r+n,l}})},function(e,t,n){var r=n(363);e.exports=r},function(e,t,n){var r=n(735);e.exports=r},function(e,t,n){n(143),n(736),n(63);var r=n(31);e.exports=r.WeakMap},function(e,t,n){"use strict";var r,a=n(38),o=n(129),i=n(158),s=n(372),c=n(738),u=n(40),l=n(69).enforce,p=n(288),f=!a.ActiveXObject&&"ActiveXObject"in a,d=Object.isExtensible,h=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},m=e.exports=s("WeakMap",h,c);if(p&&f){r=c.getConstructor(h,"WeakMap",!0),i.REQUIRED=!0;var v=m.prototype,g=v.delete,y=v.has,b=v.get,E=v.set;o(v,{delete:function(e){if(u(e)&&!d(e)){var t=l(this);return t.frozen||(t.frozen=new r),g.call(this,e)||t.frozen.delete(e)}return g.call(this,e)},has:function(e){if(u(e)&&!d(e)){var t=l(this);return t.frozen||(t.frozen=new r),y.call(this,e)||t.frozen.has(e)}return y.call(this,e)},get:function(e){if(u(e)&&!d(e)){var t=l(this);return t.frozen||(t.frozen=new r),y.call(this,e)?b.call(this,e):t.frozen.get(e)}return b.call(this,e)},set:function(e,t){if(u(e)&&!d(e)){var n=l(this);n.frozen||(n.frozen=new r),y.call(this,e)?E.call(this,e,t):n.frozen.set(e,t)}else E.call(this,e,t);return this}})}},function(e,t,n){var r=n(34);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){"use strict";var r=n(129),a=n(158).getWeakData,o=n(46),i=n(40),s=n(108),c=n(100),u=n(75),l=n(48),p=n(69),f=p.set,d=p.getterFor,h=u.find,m=u.findIndex,v=0,g=function(e){return e.frozen||(e.frozen=new y)},y=function(){this.entries=[]},b=function(e,t){return h(e.entries,(function(e){return e[0]===t}))};y.prototype={get:function(e){var t=b(this,e);if(t)return t[1]},has:function(e){return!!b(this,e)},set:function(e,t){var n=b(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=m(this.entries,(function(t){return t[0]===e}));return~t&&this.entries.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,u){var p=e((function(e,r){s(e,p,t),f(e,{type:t,id:v++,frozen:void 0}),null!=r&&c(r,e[u],{that:e,AS_ENTRIES:n})})),h=d(t),m=function(e,t,n){var r=h(e),i=a(o(t),!0);return!0===i?g(r).set(t,n):i[r.id]=n,e};return r(p.prototype,{delete:function(e){var t=h(this);if(!i(e))return!1;var n=a(e);return!0===n?g(t).delete(e):n&&l(n,t.id)&&delete n[t.id]},has:function(e){var t=h(this);if(!i(e))return!1;var n=a(e);return!0===n?g(t).has(e):n&&l(n,t.id)}}),r(p.prototype,n?{get:function(e){var t=h(this);if(i(e)){var n=a(e);return!0===n?g(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return m(this,e,t)}}:{add:function(e){return m(this,e,!0)}}),p}}},function(e,t){e.exports=function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}},function(e,t,n){var r=n(741),a=n(344);e.exports=function(e){return r((function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,s&&a(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++r<o;){var c=n[r];c&&e(t,c,r,i)}return t}))}},function(e,t,n){var r=n(207),a=n(370),o=n(371);e.exports=function(e,t){return o(a(e,t,r),e+"")}},function(e,t,n){var r=n(743);e.exports=r},function(e,t,n){n(744),n(746),n(374);var r=n(31);e.exports=r.URL},function(e,t,n){"use strict";n(83);var r,a=n(24),o=n(44),i=n(373),s=n(38),c=n(183),u=n(93),l=n(108),p=n(48),f=n(300),d=n(308),h=n(291).codeAt,m=n(745),v=n(82),g=n(374),y=n(69),b=s.URL,E=g.URLSearchParams,x=g.getState,S=y.set,w=y.getterFor("URL"),j=Math.floor,O=Math.pow,C="Invalid scheme",_="Invalid host",A="Invalid port",k=/[A-Za-z]/,I=/[\d+-.A-Za-z]/,P=/\d/,T=/^(0x|0X)/,R=/^[0-7]+$/,N=/^\d+$/,M=/^[\dA-Fa-f]+$/,D=/[\u0000\t\u000A\u000D #%/:?@[\\]]/,q=/[\u0000\t\u000A\u000D #/:?@[\\]]/,B=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,L=/[\t\u000A\u000D]/g,U=function(e,t){var n,r,a;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return _;if(!(n=z(t.slice(1,-1))))return _;e.host=n}else if(G(e)){if(t=m(t),D.test(t))return _;if(null===(n=V(t)))return _;e.host=n}else{if(q.test(t))return _;for(n="",r=d(t),a=0;a<r.length;a++)n+=Y(r[a],J);e.host=n}},V=function(e){var t,n,r,a,o,i,s,c=e.split(".");if(c.length&&""==c[c.length-1]&&c.pop(),(t=c.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(a=c[r]))return e;if(o=10,a.length>1&&"0"==a.charAt(0)&&(o=T.test(a)?16:8,a=a.slice(8==o?1:2)),""===a)i=0;else{if(!(10==o?N:8==o?R:M).test(a))return e;i=parseInt(a,o)}n.push(i)}for(r=0;r<t;r++)if(i=n[r],r==t-1){if(i>=O(256,5-t))return null}else if(i>255)return null;for(s=n.pop(),r=0;r<n.length;r++)s+=n[r]*O(256,3-r);return s},z=function(e){var t,n,r,a,o,i,s,c=[0,0,0,0,0,0,0,0],u=0,l=null,p=0,f=function(){return e.charAt(p)};if(":"==f()){if(":"!=e.charAt(1))return;p+=2,l=++u}for(;f();){if(8==u)return;if(":"!=f()){for(t=n=0;n<4&&M.test(f());)t=16*t+parseInt(f(),16),p++,n++;if("."==f()){if(0==n)return;if(p-=n,u>6)return;for(r=0;f();){if(a=null,r>0){if(!("."==f()&&r<4))return;p++}if(!P.test(f()))return;for(;P.test(f());){if(o=parseInt(f(),10),null===a)a=o;else{if(0==a)return;a=10*a+o}if(a>255)return;p++}c[u]=256*c[u]+a,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==f()){if(p++,!f())return}else if(f())return;c[u++]=t}else{if(null!==l)return;p++,l=++u}}if(null!==l)for(i=u-l,u=7;0!=u&&i>0;)s=c[u],c[u--]=c[l+i-1],c[l+--i]=s;else if(8!=u)return;return c},F=function(e){var t,n,r,a;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=j(e/256);return t.join(".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,a=0,o=0;o<8;o++)0!==e[o]?(a>n&&(t=r,n=a),r=null,a=0):(null===r&&(r=o),++a);return a>n&&(t=r,n=a),t}(e),n=0;n<8;n++)a&&0===e[n]||(a&&(a=!1),r===n?(t+=n?":":"::",a=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},J={},W=f({},J,{" ":1,'"':1,"<":1,">":1,"`":1}),H=f({},W,{"#":1,"?":1,"{":1,"}":1}),$=f({},H,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Y=function(e,t){var n=h(e,0);return n>32&&n<127&&!p(t,e)?e:encodeURIComponent(e)},K={ftp:21,file:null,http:80,https:443,ws:80,wss:443},G=function(e){return p(K,e.scheme)},Z=function(e){return""!=e.username||""!=e.password},X=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},Q=function(e,t){var n;return 2==e.length&&k.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},ee=function(e){var t;return e.length>1&&Q(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},te=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&Q(t[0],!0)||t.pop()},ne=function(e){return"."===e||"%2e"===e.toLowerCase()},re={},ae={},oe={},ie={},se={},ce={},ue={},le={},pe={},fe={},de={},he={},me={},ve={},ge={},ye={},be={},Ee={},xe={},Se={},we={},je=function(e,t,n,a){var o,i,s,c,u,l=n||re,f=0,h="",m=!1,v=!1,g=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(B,"")),t=t.replace(L,""),o=d(t);f<=o.length;){switch(i=o[f],l){case re:if(!i||!k.test(i)){if(n)return C;l=oe;continue}h+=i.toLowerCase(),l=ae;break;case ae:if(i&&(I.test(i)||"+"==i||"-"==i||"."==i))h+=i.toLowerCase();else{if(":"!=i){if(n)return C;h="",l=oe,f=0;continue}if(n&&(G(e)!=p(K,h)||"file"==h&&(Z(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=h,n)return void(G(e)&&K[e.scheme]==e.port&&(e.port=null));h="","file"==e.scheme?l=ve:G(e)&&a&&a.scheme==e.scheme?l=ie:G(e)?l=le:"/"==o[f+1]?(l=se,f++):(e.cannotBeABaseURL=!0,e.path.push(""),l=xe)}break;case oe:if(!a||a.cannotBeABaseURL&&"#"!=i)return C;if(a.cannotBeABaseURL&&"#"==i){e.scheme=a.scheme,e.path=a.path.slice(),e.query=a.query,e.fragment="",e.cannotBeABaseURL=!0,l=we;break}l="file"==a.scheme?ve:ce;continue;case ie:if("/"!=i||"/"!=o[f+1]){l=ce;continue}l=pe,f++;break;case se:if("/"==i){l=fe;break}l=Ee;continue;case ce:if(e.scheme=a.scheme,i==r)e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.query=a.query;else if("/"==i||"\\"==i&&G(e))l=ue;else if("?"==i)e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.query="",l=Se;else{if("#"!=i){e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.path.pop(),l=Ee;continue}e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.query=a.query,e.fragment="",l=we}break;case ue:if(!G(e)||"/"!=i&&"\\"!=i){if("/"!=i){e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,l=Ee;continue}l=fe}else l=pe;break;case le:if(l=pe,"/"!=i||"/"!=h.charAt(f+1))continue;f++;break;case pe:if("/"!=i&&"\\"!=i){l=fe;continue}break;case fe:if("@"==i){m&&(h="%40"+h),m=!0,s=d(h);for(var y=0;y<s.length;y++){var b=s[y];if(":"!=b||g){var E=Y(b,$);g?e.password+=E:e.username+=E}else g=!0}h=""}else if(i==r||"/"==i||"?"==i||"#"==i||"\\"==i&&G(e)){if(m&&""==h)return"Invalid authority";f-=d(h).length+1,h="",l=de}else h+=i;break;case de:case he:if(n&&"file"==e.scheme){l=ye;continue}if(":"!=i||v){if(i==r||"/"==i||"?"==i||"#"==i||"\\"==i&&G(e)){if(G(e)&&""==h)return _;if(n&&""==h&&(Z(e)||null!==e.port))return;if(c=U(e,h))return c;if(h="",l=be,n)return;continue}"["==i?v=!0:"]"==i&&(v=!1),h+=i}else{if(""==h)return _;if(c=U(e,h))return c;if(h="",l=me,n==he)return}break;case me:if(!P.test(i)){if(i==r||"/"==i||"?"==i||"#"==i||"\\"==i&&G(e)||n){if(""!=h){var x=parseInt(h,10);if(x>65535)return A;e.port=G(e)&&x===K[e.scheme]?null:x,h=""}if(n)return;l=be;continue}return A}h+=i;break;case ve:if(e.scheme="file","/"==i||"\\"==i)l=ge;else{if(!a||"file"!=a.scheme){l=Ee;continue}if(i==r)e.host=a.host,e.path=a.path.slice(),e.query=a.query;else if("?"==i)e.host=a.host,e.path=a.path.slice(),e.query="",l=Se;else{if("#"!=i){ee(o.slice(f).join(""))||(e.host=a.host,e.path=a.path.slice(),te(e)),l=Ee;continue}e.host=a.host,e.path=a.path.slice(),e.query=a.query,e.fragment="",l=we}}break;case ge:if("/"==i||"\\"==i){l=ye;break}a&&"file"==a.scheme&&!ee(o.slice(f).join(""))&&(Q(a.path[0],!0)?e.path.push(a.path[0]):e.host=a.host),l=Ee;continue;case ye:if(i==r||"/"==i||"\\"==i||"?"==i||"#"==i){if(!n&&Q(h))l=Ee;else if(""==h){if(e.host="",n)return;l=be}else{if(c=U(e,h))return c;if("localhost"==e.host&&(e.host=""),n)return;h="",l=be}continue}h+=i;break;case be:if(G(e)){if(l=Ee,"/"!=i&&"\\"!=i)continue}else if(n||"?"!=i)if(n||"#"!=i){if(i!=r&&(l=Ee,"/"!=i))continue}else e.fragment="",l=we;else e.query="",l=Se;break;case Ee:if(i==r||"/"==i||"\\"==i&&G(e)||!n&&("?"==i||"#"==i)){if(".."===(u=(u=h).toLowerCase())||"%2e."===u||".%2e"===u||"%2e%2e"===u?(te(e),"/"==i||"\\"==i&&G(e)||e.path.push("")):ne(h)?"/"==i||"\\"==i&&G(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&Q(h)&&(e.host&&(e.host=""),h=h.charAt(0)+":"),e.path.push(h)),h="","file"==e.scheme&&(i==r||"?"==i||"#"==i))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==i?(e.query="",l=Se):"#"==i&&(e.fragment="",l=we)}else h+=Y(i,H);break;case xe:"?"==i?(e.query="",l=Se):"#"==i?(e.fragment="",l=we):i!=r&&(e.path[0]+=Y(i,J));break;case Se:n||"#"!=i?i!=r&&("'"==i&&G(e)?e.query+="%27":e.query+="#"==i?"%23":Y(i,J)):(e.fragment="",l=we);break;case we:i!=r&&(e.fragment+=Y(i,W))}f++}},Oe=function(e){var t,n,r=l(this,Oe,"URL"),a=arguments.length>1?arguments[1]:void 0,i=String(e),s=S(r,{type:"URL"});if(void 0!==a)if(a instanceof Oe)t=w(a);else if(n=je(t={},String(a)))throw TypeError(n);if(n=je(s,i,null,t))throw TypeError(n);var c=s.searchParams=new E,u=x(c);u.updateSearchParams(s.query),u.updateURL=function(){s.query=String(c)||null},o||(r.href=_e.call(r),r.origin=Ae.call(r),r.protocol=ke.call(r),r.username=Ie.call(r),r.password=Pe.call(r),r.host=Te.call(r),r.hostname=Re.call(r),r.port=Ne.call(r),r.pathname=Me.call(r),r.search=De.call(r),r.searchParams=qe.call(r),r.hash=Be.call(r))},Ce=Oe.prototype,_e=function(){var e=w(this),t=e.scheme,n=e.username,r=e.password,a=e.host,o=e.port,i=e.path,s=e.query,c=e.fragment,u=t+":";return null!==a?(u+="//",Z(e)&&(u+=n+(r?":"+r:"")+"@"),u+=F(a),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?i[0]:i.length?"/"+i.join("/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},Ae=function(){var e=w(this),t=e.scheme,n=e.port;if("blob"==t)try{return new URL(t.path[0]).origin}catch(e){return"null"}return"file"!=t&&G(e)?t+"://"+F(e.host)+(null!==n?":"+n:""):"null"},ke=function(){return w(this).scheme+":"},Ie=function(){return w(this).username},Pe=function(){return w(this).password},Te=function(){var e=w(this),t=e.host,n=e.port;return null===t?"":null===n?F(t):F(t)+":"+n},Re=function(){var e=w(this).host;return null===e?"":F(e)},Ne=function(){var e=w(this).port;return null===e?"":String(e)},Me=function(){var e=w(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},De=function(){var e=w(this).query;return e?"?"+e:""},qe=function(){return w(this).searchParams},Be=function(){var e=w(this).fragment;return e?"#"+e:""},Le=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(o&&c(Ce,{href:Le(_e,(function(e){var t=w(this),n=String(e),r=je(t,n);if(r)throw TypeError(r);x(t.searchParams).updateSearchParams(t.query)})),origin:Le(Ae),protocol:Le(ke,(function(e){var t=w(this);je(t,String(e)+":",re)})),username:Le(Ie,(function(e){var t=w(this),n=d(String(e));if(!X(t)){t.username="";for(var r=0;r<n.length;r++)t.username+=Y(n[r],$)}})),password:Le(Pe,(function(e){var t=w(this),n=d(String(e));if(!X(t)){t.password="";for(var r=0;r<n.length;r++)t.password+=Y(n[r],$)}})),host:Le(Te,(function(e){var t=w(this);t.cannotBeABaseURL||je(t,String(e),de)})),hostname:Le(Re,(function(e){var t=w(this);t.cannotBeABaseURL||je(t,String(e),he)})),port:Le(Ne,(function(e){var t=w(this);X(t)||(""==(e=String(e))?t.port=null:je(t,e,me))})),pathname:Le(Me,(function(e){var t=w(this);t.cannotBeABaseURL||(t.path=[],je(t,e+"",be))})),search:Le(De,(function(e){var t=w(this);""==(e=String(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",je(t,e,Se)),x(t.searchParams).updateSearchParams(t.query)})),searchParams:Le(qe),hash:Le(Be,(function(e){var t=w(this);""!=(e=String(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",je(t,e,we)):t.fragment=null}))}),u(Ce,"toJSON",(function(){return _e.call(this)}),{enumerable:!0}),u(Ce,"toString",(function(){return _e.call(this)}),{enumerable:!0}),b){var Ue=b.createObjectURL,Ve=b.revokeObjectURL;Ue&&u(Oe,"createObjectURL",(function(e){return Ue.apply(b,arguments)})),Ve&&u(Oe,"revokeObjectURL",(function(e){return Ve.apply(b,arguments)}))}v(Oe,"URL"),a({global:!0,forced:!i,sham:!o},{URL:Oe})},function(e,t,n){"use strict";var r=2147483647,a=/[^\0-\u007E]/,o=/[.\u3002\uFF0E\uFF61]/g,i="Overflow: input needs wider integers to process",s=Math.floor,c=String.fromCharCode,u=function(e){return e+22+75*(e<26)},l=function(e,t,n){var r=0;for(e=n?s(e/700):e>>1,e+=s(e/t);e>455;r+=36)e=s(e/35);return s(r+36*e/(e+38))},p=function(e){var t,n,a=[],o=(e=function(e){for(var t=[],n=0,r=e.length;n<r;){var a=e.charCodeAt(n++);if(a>=55296&&a<=56319&&n<r){var o=e.charCodeAt(n++);56320==(64512&o)?t.push(((1023&a)<<10)+(1023&o)+65536):(t.push(a),n--)}else t.push(a)}return t}(e)).length,p=128,f=0,d=72;for(t=0;t<e.length;t++)(n=e[t])<128&&a.push(c(n));var h=a.length,m=h;for(h&&a.push("-");m<o;){var v=r;for(t=0;t<e.length;t++)(n=e[t])>=p&&n<v&&(v=n);var g=m+1;if(v-p>s((r-f)/g))throw RangeError(i);for(f+=(v-p)*g,p=v,t=0;t<e.length;t++){if((n=e[t])<p&&++f>r)throw RangeError(i);if(n==p){for(var y=f,b=36;;b+=36){var E=b<=d?1:b>=d+26?26:b-d;if(y<E)break;var x=y-E,S=36-E;a.push(c(u(E+x%S))),y=s(x/S)}a.push(c(u(y))),d=l(f,g,m==h),f=0,++m}}++f,++p}return a.join("")};e.exports=function(e){var t,n,r=[],i=e.toLowerCase().replace(o,".").split(".");for(t=0;t<i.length;t++)n=i[t],r.push(a.test(n)?"xn--"+p(n):n);return r.join(".")}},function(e,t){},function(e,t,n){n(748);var r=n(31);e.exports=r.setTimeout},function(e,t,n){var r=n(24),a=n(38),o=n(142),i=[].slice,s=function(e){return function(t,n){var r=arguments.length>2,a=r?i.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,a)}:t,n)}};r({global:!0,bind:!0,forced:/MSIE .\./.test(o)},{setTimeout:s(a.setTimeout),setInterval:s(a.setInterval)})},function(e,t,n){var r=n(750);e.exports=r},function(e,t,n){n(751),n(143),n(83),n(63);var r=n(31);e.exports=r.Map},function(e,t,n){"use strict";var r=n(372),a=n(752);e.exports=r("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),a)},function(e,t,n){"use strict";var r=n(60).f,a=n(92),o=n(129),i=n(91),s=n(108),c=n(100),u=n(191),l=n(352),p=n(44),f=n(158).fastKey,d=n(69),h=d.set,m=d.getterFor;e.exports={getConstructor:function(e,t,n,u){var l=e((function(e,r){s(e,l,t),h(e,{type:t,index:a(null),first:void 0,last:void 0,size:0}),p||(e.size=0),null!=r&&c(r,e[u],{that:e,AS_ENTRIES:n})})),d=m(t),v=function(e,t,n){var r,a,o=d(e),i=g(e,t);return i?i.value=n:(o.last=i={index:a=f(t,!0),key:t,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=i),r&&(r.next=i),p?o.size++:e.size++,"F"!==a&&(o.index[a]=i)),e},g=function(e,t){var n,r=d(e),a=f(t);if("F"!==a)return r.index[a];for(n=r.first;n;n=n.next)if(n.key==t)return n};return o(l.prototype,{clear:function(){for(var e=d(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,p?e.size=0:this.size=0},delete:function(e){var t=this,n=d(t),r=g(t,e);if(r){var a=r.next,o=r.previous;delete n.index[r.index],r.removed=!0,o&&(o.next=a),a&&(a.previous=o),n.first==r&&(n.first=a),n.last==r&&(n.last=o),p?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=d(this),r=i(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!g(this,e)}}),o(l.prototype,n?{get:function(e){var t=g(this,e);return t&&t.value},set:function(e,t){return v(this,0===e?0:e,t)}}:{add:function(e){return v(this,e=0===e?0:e,e)}}),p&&r(l.prototype,"size",{get:function(){return d(this).size}}),l},setStrong:function(e,t,n){var r=t+" Iterator",a=m(t),o=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:a(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),l(t)}}},function(e,t,n){n(63);var r=n(754),a=n(74),o=Array.prototype,i={DOMTokenList:!0,NodeList:!0};e.exports=function(e){var t=e.keys;return e===o||e instanceof Array&&t===o.keys||i.hasOwnProperty(a(e))?r:t}},function(e,t,n){var r=n(755);e.exports=r},function(e,t,n){n(125);var r=n(39);e.exports=r("Array").keys},function(e,t,n){n(63);var r=n(757),a=n(74),o=Array.prototype,i={DOMTokenList:!0,NodeList:!0};e.exports=function(e){var t=e.values;return e===o||e instanceof Array&&t===o.values||i.hasOwnProperty(a(e))?r:t}},function(e,t,n){var r=n(758);e.exports=r},function(e,t,n){n(125);var r=n(39);e.exports=r("Array").values},function(e,t,n){var r=n(760);e.exports=r},function(e,t,n){var r=n(761),a=Array.prototype;e.exports=function(e){var t=e.lastIndexOf;return e===a||e instanceof Array&&t===a.lastIndexOf?r:t}},function(e,t,n){n(762);var r=n(39);e.exports=r("Array").lastIndexOf},function(e,t,n){var r=n(24),a=n(763);r({target:"Array",proto:!0,forced:a!==[].lastIndexOf},{lastIndexOf:a})},function(e,t,n){"use strict";var r=n(58),a=n(117),o=n(68),i=n(95),s=Math.min,c=[].lastIndexOf,u=!!c&&1/[1].lastIndexOf(1,-0)<0,l=i("lastIndexOf"),p=u||!l;e.exports=p?function(e){if(u)return c.apply(this,arguments)||0;var t=r(this),n=o(t.length),i=n-1;for(arguments.length>1&&(i=s(i,a(arguments[1]))),i<0&&(i=n+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:c},function(e,t,n){var r={"./all.js":266,"./auth/actions.js":73,"./auth/index.js":229,"./auth/reducers.js":230,"./auth/selectors.js":231,"./auth/spec-wrap-actions.js":232,"./configs/actions.js":112,"./configs/helpers.js":131,"./configs/index.js":268,"./configs/reducers.js":237,"./configs/selectors.js":236,"./configs/spec-actions.js":235,"./deep-linking/helpers.js":135,"./deep-linking/index.js":238,"./deep-linking/layout.js":239,"./deep-linking/operation-tag-wrapper.jsx":241,"./deep-linking/operation-wrapper.jsx":240,"./download-url.js":234,"./err/actions.js":53,"./err/error-transformers/hook.js":103,"./err/error-transformers/transformers/not-of-type.js":215,"./err/error-transformers/transformers/parameter-oneof.js":216,"./err/index.js":213,"./err/reducers.js":214,"./err/selectors.js":217,"./filter/index.js":242,"./filter/opsFilter.js":243,"./layout/actions.js":86,"./layout/index.js":218,"./layout/reducers.js":219,"./layout/selectors.js":220,"./logs/index.js":227,"./oas3/actions.js":50,"./oas3/auth-extensions/wrap-selectors.js":247,"./oas3/components/callbacks.jsx":250,"./oas3/components/http-auth.jsx":255,"./oas3/components/index.js":249,"./oas3/components/operation-link.jsx":251,"./oas3/components/operation-servers.jsx":256,"./oas3/components/request-body-editor.jsx":254,"./oas3/components/request-body.jsx":132,"./oas3/components/servers-container.jsx":253,"./oas3/components/servers.jsx":252,"./oas3/helpers.jsx":32,"./oas3/index.js":245,"./oas3/reducers.js":265,"./oas3/selectors.js":264,"./oas3/spec-extensions/selectors.js":248,"./oas3/spec-extensions/wrap-selectors.js":246,"./oas3/wrap-components/auth-item.jsx":259,"./oas3/wrap-components/index.js":257,"./oas3/wrap-components/json-schema-string.jsx":263,"./oas3/wrap-components/markdown.jsx":258,"./oas3/wrap-components/model.jsx":262,"./oas3/wrap-components/online-validator-badge.js":261,"./oas3/wrap-components/version-stamp.jsx":260,"./on-complete/index.js":244,"./samples/fn.js":111,"./samples/index.js":226,"./spec/actions.js":42,"./spec/index.js":221,"./spec/reducers.js":222,"./spec/selectors.js":78,"./spec/wrap-actions.js":223,"./swagger-js/configs-wrap-actions.js":228,"./swagger-js/index.js":267,"./util/index.js":233,"./view/index.js":224,"./view/root-injects.jsx":134};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=764},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"Container",(function(){return Nn})),n.d(r,"Col",(function(){return Dn})),n.d(r,"Row",(function(){return qn})),n.d(r,"Button",(function(){return Bn})),n.d(r,"TextArea",(function(){return Ln})),n.d(r,"Input",(function(){return Un})),n.d(r,"Select",(function(){return Vn})),n.d(r,"Link",(function(){return zn})),n.d(r,"Collapse",(function(){return Jn}));var a={};n.r(a),n.d(a,"JsonSchemaForm",(function(){return Nr})),n.d(a,"JsonSchema_string",(function(){return Mr})),n.d(a,"JsonSchema_array",(function(){return Dr})),n.d(a,"JsonSchemaArrayItemText",(function(){return qr})),n.d(a,"JsonSchemaArrayItemFile",(function(){return Br})),n.d(a,"JsonSchema_boolean",(function(){return Lr})),n.d(a,"JsonSchema_object",(function(){return Vr}));var o=n(19),i=n.n(o),s=n(2),c=n.n(s),u=n(12),l=n.n(u),p=n(17),f=n.n(p),d=n(30),h=n.n(d),m=n(70),v=n.n(m),g=n(3),y=n.n(g),b=n(6),E=n.n(b),x=n(7),S=n.n(x),w=n(29),j=n.n(w),O=n(22),C=n.n(O),_=n(23),A=n.n(_),k=n(13),I=n.n(k),P=n(21),T=n.n(P),R=n(4),N=n.n(R),M=n(0),D=n.n(M),q=n(136),B=n(1),L=n.n(B),U=n(376),V=n(110),z=n.n(V),F=n(377),J=n.n(F),W=n(53),H=n(26),$=n(5),Y=function(e){return e};var K=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E()(this,e),v()(this,{state:{},plugins:[],system:{configs:{},fn:{},components:{},rootInjects:{},statePlugins:{}},boundSystem:{},toolbox:{}},n),this.getSystem=j()(t=this._getSystem).call(t,this),this.store=ee(Y,Object(B.fromJS)(this.state),this.getSystem),this.buildSystem(!1),this.register(this.plugins)}return S()(e,[{key:"getStore",value:function(){return this.store}},{key:"register",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=G(e,this.getSystem());X(this.system,n),t&&this.buildSystem();var r=Z.call(this.system,e,this.getSystem());r&&this.buildSystem()}},{key:"buildSystem",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.getStore().dispatch,n=this.getStore().getState;this.boundSystem=C()({},this.getRootInjects(),this.getWrappedAndBoundActions(t),this.getWrappedAndBoundSelectors(n,this.getSystem),this.getStateThunks(n),this.getFn(),this.getConfigs()),e&&this.rebuildReducer()}},{key:"_getSystem",value:function(){return this.boundSystem}},{key:"getRootInjects",value:function(){var e,t,n;return C()({getSystem:this.getSystem,getStore:j()(e=this.getStore).call(e,this),getComponents:j()(t=this.getComponents).call(t,this),getState:this.getStore().getState,getConfigs:j()(n=this._getConfigs).call(n,this),Im:L.a,React:D.a},this.system.rootInjects||{})}},{key:"_getConfigs",value:function(){return this.system.configs}},{key:"getConfigs",value:function(){return{configs:this.system.configs}}},{key:"setConfigs",value:function(e){this.system.configs=e}},{key:"rebuildReducer",value:function(){var e,t,n,r;this.store.replaceReducer((r=this.system.statePlugins,e=Object($.y)(r,(function(e){return e.reducers})),n=T()(t=f()(e)).call(t,(function(t,n){return t[n]=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new B.Map,n=arguments.length>1?arguments[1]:void 0;if(!e)return t;var r=e[n.type];if(r){var a=Q(r)(t,n);return null===a?t:a}return t}}(e[n]),t}),{}),f()(n).length?Object(U.combineReducers)(n):Y))}},{key:"getType",value:function(e){var t=e[0].toUpperCase()+A()(e).call(e,1);return Object($.z)(this.system.statePlugins,(function(n,r){var a=n[e];if(a)return y()({},r+t,a)}))}},{key:"getSelectors",value:function(){return this.getType("selectors")}},{key:"getActions",value:function(){var e=this.getType("actions");return Object($.y)(e,(function(e){return Object($.z)(e,(function(e,t){if(Object($.r)(e))return y()({},t,e)}))}))}},{key:"getWrappedAndBoundActions",value:function(e){var t=this,n=this.getBoundActions(e);return Object($.y)(n,(function(e,n){var r=t.system.statePlugins[A()(n).call(n,0,-7)].wrapActions;return r?Object($.y)(e,(function(e,n){var a=r[n];return a?(I()(a)||(a=[a]),T()(a).call(a,(function(e,n){var r=function(){return n(e,t.getSystem()).apply(void 0,arguments)};if(!Object($.r)(r))throw new TypeError("wrapActions needs to return a function that returns a new function (ie the wrapped action)");return Q(r)}),e||Function.prototype)):e})):e}))}},{key:"getWrappedAndBoundSelectors",value:function(e,t){var n=this,r=this.getBoundSelectors(e,t);return Object($.y)(r,(function(t,r){var a=[A()(r).call(r,0,-9)],o=n.system.statePlugins[a].wrapSelectors;return o?Object($.y)(t,(function(t,r){var i=o[r];return i?(I()(i)||(i=[i]),T()(i).call(i,(function(t,r){var o=function(){for(var o,i=arguments.length,s=new Array(i),u=0;u<i;u++)s[u]=arguments[u];return r(t,n.getSystem()).apply(void 0,c()(o=[e().getIn(a)]).call(o,s))};if(!Object($.r)(o))throw new TypeError("wrapSelector needs to return a function that returns a new function (ie the wrapped action)");return o}),t||Function.prototype)):t})):t}))}},{key:"getStates",value:function(e){var t;return T()(t=f()(this.system.statePlugins)).call(t,(function(t,n){return t[n]=e.get(n),t}),{})}},{key:"getStateThunks",value:function(e){var t;return T()(t=f()(this.system.statePlugins)).call(t,(function(t,n){return t[n]=function(){return e().get(n)},t}),{})}},{key:"getFn",value:function(){return{fn:this.system.fn}}},{key:"getComponents",value:function(e){var t=this,n=this.system.components[e];return I()(n)?T()(n).call(n,(function(e,n){return n(e,t.getSystem())})):void 0!==e?this.system.components[e]:this.system.components}},{key:"getBoundSelectors",value:function(e,t){return Object($.y)(this.getSelectors(),(function(n,r){var a=[A()(r).call(r,0,-9)],o=function(){return e().getIn(a)};return Object($.y)(n,(function(e){return function(){for(var n,r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var s=Q(e).apply(null,c()(n=[o()]).call(n,a));return"function"==typeof s&&(s=Q(s)(t())),s}}))}))}},{key:"getBoundActions",value:function(e){e=e||this.getStore().dispatch;var t=this.getActions(),n=function e(t){return"function"!=typeof t?Object($.y)(t,(function(t){return e(t)})):function(){var e=null;try{e=t.apply(void 0,arguments)}catch(t){e={type:W.NEW_THROWN_ERR,error:!0,payload:z()(t)}}finally{return e}}};return Object($.y)(t,(function(t){return Object(q.bindActionCreators)(n(t),e)}))}},{key:"getMapStateToProps",value:function(){var e=this;return function(){return C()({},e.getSystem())}}},{key:"getMapDispatchToProps",value:function(e){var t=this;return function(n){return v()({},t.getWrappedAndBoundActions(n),t.getFn(),e)}}}]),e}();function G(e,t){return Object($.u)(e)&&!Object($.p)(e)?J()({},e):Object($.s)(e)?G(e(t),t):Object($.p)(e)?T()(n=N()(e).call(e,(function(e){return G(e,t)}))).call(n,X,{}):{};var n}function Z(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.hasLoaded,o=a;return Object($.u)(e)&&!Object($.p)(e)&&"function"==typeof e.afterLoad&&(o=!0,Q(e.afterLoad).call(this,t)),Object($.s)(e)?Z.call(this,e(t),t,{hasLoaded:o}):Object($.p)(e)?N()(e).call(e,(function(e){return Z.call(n,e,t,{hasLoaded:o})})):o}function X(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object($.u)(e))return{};if(!Object($.u)(t))return e;t.wrapComponents&&(Object($.y)(t.wrapComponents,(function(n,r){var a=e.components&&e.components[r];a&&I()(a)?(e.components[r]=c()(a).call(a,[n]),delete t.wrapComponents[r]):a&&(e.components[r]=[a,n],delete t.wrapComponents[r])})),f()(t.wrapComponents).length||delete t.wrapComponents);var n=e.statePlugins;if(Object($.u)(n))for(var r in n){var a=n[r];if(Object($.u)(a)&&Object($.u)(a.wrapActions)){var o=a.wrapActions;for(var i in o){var s,u=o[i];if(I()(u)||(u=[u],o[i]=u),t&&t.statePlugins&&t.statePlugins[r]&&t.statePlugins[r].wrapActions&&t.statePlugins[r].wrapActions[i])t.statePlugins[r].wrapActions[i]=c()(s=o[i]).call(s,t.statePlugins[r].wrapActions[i])}}}return v()(e,t)}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.logErrors,r=void 0===n||n;return"function"!=typeof e?e:function(){try{for(var t,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return e.call.apply(e,c()(t=[this]).call(t,a))}catch(e){return r&&console.error(e),null}}}function ee(e,t,n){return function(e,t,n){var r=[Object($.K)(n)],a=H.a.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||q.compose;return Object(q.createStore)(e,t,a(q.applyMiddleware.apply(void 0,r)))}(e,t,n)}var te=n(213),ne=n(218),re=n(221),ae=n(224),oe=n(226),ie=n(227),se=n(267),ce=n(229),ue=n(233),le=n(234),pe=n(268),fe=n(238),de=n(242),he=n(244),me=n(10),ve=n.n(me),ge=n(8),ye=n.n(ge),be=n(9),Ee=n.n(be),xe=n(14),Se=n.n(xe),we=(n(11),n(27),n(52)),je=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;E()(this,n),a=t.call(this,e,r),y()(ve()(a),"toggleShown",(function(){var e=a.props,t=e.layoutActions,n=e.tag,r=e.operationId,o=e.isShown,i=a.getResolvedSubtree();o||void 0!==i||a.requestResolvedSubtree(),t.show(["operations",n,r],!o)})),y()(ve()(a),"onCancelClick",(function(){a.setState({tryItOutEnabled:!a.state.tryItOutEnabled})})),y()(ve()(a),"onTryoutClick",(function(){a.setState({tryItOutEnabled:!a.state.tryItOutEnabled})})),y()(ve()(a),"onExecute",(function(){a.setState({executeInProgress:!0})})),y()(ve()(a),"getResolvedSubtree",(function(){var e=a.props,t=e.specSelectors,n=e.path,r=e.method,o=e.specPath;return o?t.specResolvedSubtree(o.toJS()):t.specResolvedSubtree(["paths",n,r])})),y()(ve()(a),"requestResolvedSubtree",(function(){var e=a.props,t=e.specActions,n=e.path,r=e.method,o=e.specPath;return o?t.requestResolvedSubtree(o.toJS()):t.requestResolvedSubtree(["paths",n,r])}));var o=e.getConfigs().tryItOutEnabled;return a.state={tryItOutEnabled:!0===o||"true"===o,executeInProgress:!1},a}return S()(n,[{key:"mapStateToProps",value:function(e,t){var n,r=t.op,a=t.layoutSelectors,o=(0,t.getConfigs)(),i=o.docExpansion,s=o.deepLinking,u=o.displayOperationId,l=o.displayRequestDuration,p=o.supportedSubmitMethods,f=a.showSummary(),d=r.getIn(["operation","__originalOperationId"])||r.getIn(["operation","operationId"])||Object(we.e)(r.get("operation"),t.path,t.method)||r.get("id"),h=["operations",t.tag,d],m=s&&"false"!==s,v=Se()(p).call(p,t.method)>=0&&(void 0===t.allowTryItOut?t.specSelectors.allowTryItOutFor(t.path,t.method):t.allowTryItOut),g=r.getIn(["operation","security"])||t.specSelectors.security();return{operationId:d,isDeepLinkingEnabled:m,showSummary:f,displayOperationId:u,displayRequestDuration:l,allowTryItOut:v,security:g,isAuthorized:t.authSelectors.isAuthorized(g),isShown:a.isShown(h,"full"===i),jumpToKey:c()(n="paths.".concat(t.path,".")).call(n,t.method),response:t.specSelectors.responseFor(t.path,t.method),request:t.specSelectors.requestFor(t.path,t.method)}}},{key:"componentDidMount",value:function(){var e=this.props.isShown,t=this.getResolvedSubtree();e&&void 0===t&&this.requestResolvedSubtree()}},{key:"componentWillReceiveProps",value:function(e){var t=e.response,n=e.isShown,r=this.getResolvedSubtree();t!==this.props.response&&this.setState({executeInProgress:!1}),n&&void 0===r&&this.requestResolvedSubtree()}},{key:"render",value:function(){var e=this.props,t=e.op,n=e.tag,r=e.path,a=e.method,o=e.security,i=e.isAuthorized,s=e.operationId,c=e.showSummary,u=e.isShown,l=e.jumpToKey,p=e.allowTryItOut,f=e.response,d=e.request,h=e.displayOperationId,m=e.displayRequestDuration,v=e.isDeepLinkingEnabled,g=e.specPath,y=e.specSelectors,b=e.specActions,E=e.getComponent,x=e.getConfigs,S=e.layoutSelectors,w=e.layoutActions,j=e.authActions,O=e.authSelectors,C=e.oas3Actions,_=e.oas3Selectors,A=e.fn,k=E("operation"),I=this.getResolvedSubtree()||Object(B.Map)(),P=Object(B.fromJS)({op:I,tag:n,path:r,summary:t.getIn(["operation","summary"])||"",deprecated:I.get("deprecated")||t.getIn(["operation","deprecated"])||!1,method:a,security:o,isAuthorized:i,operationId:s,originalOperationId:I.getIn(["operation","__originalOperationId"]),showSummary:c,isShown:u,jumpToKey:l,allowTryItOut:p,request:d,displayOperationId:h,displayRequestDuration:m,isDeepLinkingEnabled:v,executeInProgress:this.state.executeInProgress,tryItOutEnabled:this.state.tryItOutEnabled});return D.a.createElement(k,{operation:P,response:f,request:d,isShown:u,toggleShown:this.toggleShown,onTryoutClick:this.onTryoutClick,onCancelClick:this.onCancelClick,onExecute:this.onExecute,specPath:g,specActions:b,specSelectors:y,oas3Actions:C,oas3Selectors:_,layoutActions:w,layoutSelectors:S,authActions:j,authSelectors:O,getComponent:E,getConfigs:x,fn:A})}}]),n}(M.PureComponent);y()(je,"defaultProps",{showSummary:!0,response:null,allowTryItOut:!0,displayOperationId:!1,displayRequestDuration:!1});var Oe=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"getLayout",value:function(){var e=this.props,t=e.getComponent,n=e.layoutSelectors.current(),r=t(n,!0);return r||function(){return D.a.createElement("h1",null,' No layout defined for "',n,'" ')}}},{key:"render",value:function(){var e=this.getLayout();return D.a.createElement(e,null)}}]),n}(D.a.Component);Oe.defaultProps={};var Ce=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"close",(function(){r.props.authActions.showDefinitions(!1)})),r}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.authSelectors,r=t.authActions,a=t.getComponent,o=t.errSelectors,i=t.specSelectors,s=t.fn.AST,c=void 0===s?{}:s,u=n.shownDefinitions(),l=a("auths");return D.a.createElement("div",{className:"dialog-ux"},D.a.createElement("div",{className:"backdrop-ux"}),D.a.createElement("div",{className:"modal-ux"},D.a.createElement("div",{className:"modal-dialog-ux"},D.a.createElement("div",{className:"modal-ux-inner"},D.a.createElement("div",{className:"modal-ux-header"},D.a.createElement("h3",null,"Available authorizations"),D.a.createElement("button",{type:"button",className:"close-modal",onClick:this.close},D.a.createElement("svg",{width:"20",height:"20"},D.a.createElement("use",{href:"#close",xlinkHref:"#close"})))),D.a.createElement("div",{className:"modal-ux-content"},N()(e=u.valueSeq()).call(e,(function(e,t){return D.a.createElement(l,{key:t,AST:c,definitions:e,getComponent:a,errSelectors:o,authSelectors:n,authActions:r,specSelectors:i})})))))))}}]),n}(D.a.Component),_e=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.isAuthorized,n=e.showPopup,r=e.onClick,a=(0,e.getComponent)("authorizationPopup",!0);return D.a.createElement("div",{className:"auth-wrapper"},D.a.createElement("button",{className:t?"btn authorize locked":"btn authorize unlocked",onClick:r},D.a.createElement("span",null,"Authorize"),D.a.createElement("svg",{width:"20",height:"20"},D.a.createElement("use",{href:t?"#locked":"#unlocked",xlinkHref:t?"#locked":"#unlocked"}))),n&&D.a.createElement(a,null))}}]),n}(D.a.Component),Ae=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.authActions,n=e.authSelectors,r=e.specSelectors,a=e.getComponent,o=r.securityDefinitions(),i=n.definitionsToAuthorize(),s=a("authorizeBtn");return o?D.a.createElement(s,{onClick:function(){return t.showDefinitions(i)},isAuthorized:!!n.authorized().size,showPopup:!!n.shownDefinitions(),getComponent:a}):null}}]),n}(D.a.Component),ke=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onClick",(function(e){e.stopPropagation();var t=r.props.onClick;t&&t()})),r}return S()(n,[{key:"render",value:function(){var e=this.props.isAuthorized;return D.a.createElement("button",{className:e?"authorization__btn locked":"authorization__btn unlocked","aria-label":e?"authorization button locked":"authorization button unlocked",onClick:this.onClick},D.a.createElement("svg",{width:"20",height:"20"},D.a.createElement("use",{href:e?"#locked":"#unlocked",xlinkHref:e?"#locked":"#unlocked"})))}}]),n}(D.a.Component),Ie=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;return E()(this,n),a=t.call(this,e,r),y()(ve()(a),"onAuthChange",(function(e){var t=e.name;a.setState(y()({},t,e))})),y()(ve()(a),"submitAuth",(function(e){e.preventDefault(),a.props.authActions.authorizeWithPersistOption(a.state)})),y()(ve()(a),"logoutClick",(function(e){e.preventDefault();var t=a.props,n=t.authActions,r=t.definitions,o=N()(r).call(r,(function(e,t){return t})).toArray();a.setState(T()(o).call(o,(function(e,t){return e[t]="",e}),{})),n.logoutWithPersistOption(o)})),y()(ve()(a),"close",(function(e){e.preventDefault(),a.props.authActions.showDefinitions(!1)})),a.state={},a}return S()(n,[{key:"render",value:function(){var e,t=this,n=this.props,r=n.definitions,a=n.getComponent,o=n.authSelectors,i=n.errSelectors,s=a("AuthItem"),c=a("oauth2",!0),u=a("Button"),p=o.authorized(),f=l()(r).call(r,(function(e,t){return!!p.get(t)})),d=l()(r).call(r,(function(e){return"oauth2"!==e.get("type")})),h=l()(r).call(r,(function(e){return"oauth2"===e.get("type")}));return D.a.createElement("div",{className:"auth-container"},!!d.size&&D.a.createElement("form",{onSubmit:this.submitAuth},N()(d).call(d,(function(e,n){return D.a.createElement(s,{key:n,schema:e,name:n,getComponent:a,onAuthChange:t.onAuthChange,authorized:p,errSelectors:i})})).toArray(),D.a.createElement("div",{className:"auth-btn-wrapper"},d.size===f.size?D.a.createElement(u,{className:"btn modal-btn auth",onClick:this.logoutClick},"Logout"):D.a.createElement(u,{type:"submit",className:"btn modal-btn auth authorize"},"Authorize"),D.a.createElement(u,{className:"btn modal-btn auth btn-done",onClick:this.close},"Close"))),h&&h.size?D.a.createElement("div",null,D.a.createElement("div",{className:"scope-def"},D.a.createElement("p",null,"Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes."),D.a.createElement("p",null,"API requires the following scopes. Select which ones you want to grant to Swagger UI.")),N()(e=l()(r).call(r,(function(e){return"oauth2"===e.get("type")}))).call(e,(function(e,t){return D.a.createElement("div",{key:t},D.a.createElement(c,{authorized:p,schema:e,name:t}))})).toArray()):null)}}]),n}(D.a.Component),Pe=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.schema,r=t.name,a=t.getComponent,o=t.onAuthChange,i=t.authorized,s=t.errSelectors,c=a("apiKeyAuth"),u=a("basicAuth"),l=n.get("type");switch(l){case"apiKey":e=D.a.createElement(c,{key:r,schema:n,name:r,errSelectors:s,authorized:i,getComponent:a,onChange:o});break;case"basic":e=D.a.createElement(u,{key:r,schema:n,name:r,errSelectors:s,authorized:i,getComponent:a,onChange:o});break;default:e=D.a.createElement("div",{key:r},"Unknown security definition type ",l)}return D.a.createElement("div",{key:"".concat(r,"-jump")},e)}}]),n}(D.a.Component),Te=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props.error,t=e.get("level"),n=e.get("message"),r=e.get("source");return D.a.createElement("div",{className:"errors"},D.a.createElement("b",null,r," ",t),D.a.createElement("span",null,n))}}]),n}(D.a.Component),Re=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;E()(this,n),a=t.call(this,e,r),y()(ve()(a),"onChange",(function(e){var t=a.props.onChange,n=e.target.value,r=C()({},a.state,{value:n});a.setState(r),t(r)}));var o=a.props,i=o.name,s=o.schema,c=a.getValue();return a.state={name:i,schema:s,value:c},a}return S()(n,[{key:"getValue",value:function(){var e=this.props,t=e.name,n=e.authorized;return n&&n.getIn([t,"value"])}},{key:"render",value:function(){var e,t,n=this.props,r=n.schema,a=n.getComponent,o=n.errSelectors,i=n.name,s=a("Input"),c=a("Row"),u=a("Col"),p=a("authError"),f=a("Markdown",!0),d=a("JumpToPath",!0),h=this.getValue(),m=l()(e=o.allErrors()).call(e,(function(e){return e.get("authId")===i}));return D.a.createElement("div",null,D.a.createElement("h4",null,D.a.createElement("code",null,i||r.get("name"))," (apiKey)",D.a.createElement(d,{path:["securityDefinitions",i]})),h&&D.a.createElement("h6",null,"Authorized"),D.a.createElement(c,null,D.a.createElement(f,{source:r.get("description")})),D.a.createElement(c,null,D.a.createElement("p",null,"Name: ",D.a.createElement("code",null,r.get("name")))),D.a.createElement(c,null,D.a.createElement("p",null,"In: ",D.a.createElement("code",null,r.get("in")))),D.a.createElement(c,null,D.a.createElement("label",null,"Value:"),h?D.a.createElement("code",null," ****** "):D.a.createElement(u,null,D.a.createElement(s,{type:"text",onChange:this.onChange,autoFocus:!0}))),N()(t=m.valueSeq()).call(t,(function(e,t){return D.a.createElement(p,{error:e,key:t})})))}}]),n}(D.a.Component),Ne=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;E()(this,n),a=t.call(this,e,r),y()(ve()(a),"onChange",(function(e){var t=a.props.onChange,n=e.target,r=n.value,o=n.name,i=a.state.value;i[o]=r,a.setState({value:i}),t(a.state)}));var o=a.props,i=o.schema,s=o.name,c=a.getValue().username;return a.state={name:s,schema:i,value:c?{username:c}:{}},a}return S()(n,[{key:"getValue",value:function(){var e=this.props,t=e.authorized,n=e.name;return t&&t.getIn([n,"value"])||{}}},{key:"render",value:function(){var e,t,n=this.props,r=n.schema,a=n.getComponent,o=n.name,i=n.errSelectors,s=a("Input"),c=a("Row"),u=a("Col"),p=a("authError"),f=a("JumpToPath",!0),d=a("Markdown",!0),h=this.getValue().username,m=l()(e=i.allErrors()).call(e,(function(e){return e.get("authId")===o}));return D.a.createElement("div",null,D.a.createElement("h4",null,"Basic authorization",D.a.createElement(f,{path:["securityDefinitions",o]})),h&&D.a.createElement("h6",null,"Authorized"),D.a.createElement(c,null,D.a.createElement(d,{source:r.get("description")})),D.a.createElement(c,null,D.a.createElement("label",null,"Username:"),h?D.a.createElement("code",null," ",h," "):D.a.createElement(u,null,D.a.createElement(s,{type:"text",required:"required",name:"username",onChange:this.onChange,autoFocus:!0}))),D.a.createElement(c,null,D.a.createElement("label",null,"Password:"),h?D.a.createElement("code",null," ****** "):D.a.createElement(u,null,D.a.createElement(s,{autoComplete:"new-password",name:"password",type:"password",onChange:this.onChange}))),N()(t=m.valueSeq()).call(t,(function(e,t){return D.a.createElement(p,{error:e,key:t})})))}}]),n}(D.a.Component);function Me(e){var t=e.example,n=e.showValue,r=e.getComponent,a=e.getConfigs,o=r("Markdown",!0),i=r("highlightCode");return t?D.a.createElement("div",{className:"example"},t.get("description")?D.a.createElement("section",{className:"example__section"},D.a.createElement("div",{className:"example__section-header"},"Example Description"),D.a.createElement("p",null,D.a.createElement(o,{source:t.get("description")}))):null,n&&t.has("value")?D.a.createElement("section",{className:"example__section"},D.a.createElement("div",{className:"example__section-header"},"Example Value"),D.a.createElement(i,{getConfigs:a,value:Object($.J)(t.get("value"))})):null):null}var De=n(398),qe=n.n(De),Be=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"_onSelect",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.isSyntheticChange,a=void 0!==n&&n;"function"==typeof r.props.onSelect&&r.props.onSelect(e,{isSyntheticChange:a})})),y()(ve()(r),"_onDomSelect",(function(e){if("function"==typeof r.props.onSelect){var t=e.target.selectedOptions[0].getAttribute("value");r._onSelect(t,{isSyntheticChange:!1})}})),y()(ve()(r),"getCurrentExample",(function(){var e=r.props,t=e.examples,n=e.currentExampleKey,a=t.get(n),o=t.keySeq().first(),i=t.get(o);return a||i||qe()({})})),r}return S()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.onSelect,n=e.examples;if("function"==typeof t){var r=n.first(),a=n.keyOf(r);this._onSelect(a,{isSyntheticChange:!0})}}},{key:"componentWillReceiveProps",value:function(e){var t=e.currentExampleKey,n=e.examples;if(n!==this.props.examples&&!n.has(t)){var r=n.first(),a=n.keyOf(r);this._onSelect(a,{isSyntheticChange:!0})}}},{key:"render",value:function(){var e=this.props,t=e.examples,n=e.currentExampleKey,r=e.isValueModified,a=e.isModifiedValueAvailable,o=e.showLabels;return D.a.createElement("div",{className:"examples-select"},o?D.a.createElement("span",{className:"examples-select__section-label"},"Examples: "):null,D.a.createElement("select",{onChange:this._onDomSelect,value:a&&r?"__MODIFIED__VALUE__":n||""},a?D.a.createElement("option",{value:"__MODIFIED__VALUE__"},"[Modified value]"):null,N()(t).call(t,(function(e,t){return D.a.createElement("option",{key:t,value:t},e.get("summary")||t)})).valueSeq()))}}]),n}(D.a.PureComponent);y()(Be,"defaultProps",{examples:L.a.Map({}),onSelect:function(){for(var e,t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(e=console).log.apply(e,c()(t=["DEBUG: ExamplesSelect was not given an onSelect callback"]).call(t,r))},currentExampleKey:null,showLabels:!0});var Le=function(e){return B.List.isList(e)?e:Object($.J)(e)},Ue=function(e){ye()(n,e);var t=Ee()(n);function n(e){var r;E()(this,n),r=t.call(this,e),y()(ve()(r),"_getStateForCurrentNamespace",(function(){var e=r.props.currentNamespace;return(r.state[e]||Object(B.Map)()).toObject()})),y()(ve()(r),"_setStateForCurrentNamespace",(function(e){var t=r.props.currentNamespace;return r._setStateForNamespace(t,e)})),y()(ve()(r),"_setStateForNamespace",(function(e,t){var n=(r.state[e]||Object(B.Map)()).mergeDeep(t);return r.setState(y()({},e,n))})),y()(ve()(r),"_isCurrentUserInputSameAsExampleValue",(function(){var e=r.props.currentUserInputValue;return r._getCurrentExampleValue()===e})),y()(ve()(r),"_getValueForExample",(function(e,t){var n=(t||r.props).examples;return Le((n||Object(B.Map)({})).getIn([e,"value"]))})),y()(ve()(r),"_getCurrentExampleValue",(function(e){var t=(e||r.props).currentKey;return r._getValueForExample(t,e||r.props)})),y()(ve()(r),"_onExamplesSelect",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.isSyntheticChange,a=r.props,o=a.onSelect,i=a.updateValue,s=a.currentUserInputValue,u=a.userHasEditedBody,l=r._getStateForCurrentNamespace(),p=l.lastUserEditedValue,f=r._getValueForExample(e);if("__MODIFIED__VALUE__"===e)return i(Le(p)),r._setStateForCurrentNamespace({isModifiedValueSelected:!0});if("function"==typeof o){for(var d,h=arguments.length,m=new Array(h>2?h-2:0),v=2;v<h;v++)m[v-2]=arguments[v];o.apply(void 0,c()(d=[e,{isSyntheticChange:n}]).call(d,m))}r._setStateForCurrentNamespace({lastDownstreamValue:f,isModifiedValueSelected:n&&u||!!s&&s!==f}),n||"function"==typeof i&&i(Le(f))}));var a=r._getCurrentExampleValue();return r.state=y()({},e.currentNamespace,Object(B.Map)({lastUserEditedValue:r.props.currentUserInputValue,lastDownstreamValue:a,isModifiedValueSelected:r.props.userHasEditedBody||r.props.currentUserInputValue!==a})),r}return S()(n,[{key:"componentWillUnmount",value:function(){this.props.setRetainRequestBodyValueFlag(!1)}},{key:"componentWillReceiveProps",value:function(e){var t=e.currentUserInputValue,n=e.examples,r=e.onSelect,a=e.userHasEditedBody,o=this._getStateForCurrentNamespace(),i=o.lastUserEditedValue,s=o.lastDownstreamValue,c=this._getValueForExample(e.currentKey,e),u=l()(n).call(n,(function(e){return e.get("value")===t||Object($.J)(e.get("value"))===t}));u.size?r(u.has(e.currentKey)?e.currentKey:u.keySeq().first(),{isSyntheticChange:!0}):t!==this.props.currentUserInputValue&&t!==i&&t!==s&&(this.props.setRetainRequestBodyValueFlag(!0),this._setStateForNamespace(e.currentNamespace,{lastUserEditedValue:e.currentUserInputValue,isModifiedValueSelected:a||t!==c}))}},{key:"render",value:function(){var e=this.props,t=e.currentUserInputValue,n=e.examples,r=e.currentKey,a=e.getComponent,o=e.userHasEditedBody,i=this._getStateForCurrentNamespace(),s=i.lastDownstreamValue,c=i.lastUserEditedValue,u=i.isModifiedValueSelected,l=a("ExamplesSelect");return D.a.createElement(l,{examples:n,currentExampleKey:r,onSelect:this._onExamplesSelect,isModifiedValueAvailable:!!c&&c!==s,isValueModified:void 0!==t&&u&&t!==this._getCurrentExampleValue()||o})}}]),n}(D.a.PureComponent);y()(Ue,"defaultProps",{userHasEditedBody:!1,examples:Object(B.Map)({}),currentNamespace:"__DEFAULT__NAMESPACE__",setRetainRequestBodyValueFlag:function(){},onSelect:function(){for(var e,t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(e=console).log.apply(e,c()(t=["ExamplesSelectValueRetainer: no `onSelect` function was provided"]).call(t,r))},updateValue:function(){for(var e,t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(e=console).log.apply(e,c()(t=["ExamplesSelectValueRetainer: no `updateValue` function was provided"]).call(t,r))}});var Ve=n(164),ze=n.n(Ve),Fe=n(102),Je=n.n(Fe),We=n(35),He=n.n(We),$e=n(79),Ye=n.n($e);var Ke=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;E()(this,n),a=t.call(this,e,r),y()(ve()(a),"close",(function(e){e.preventDefault(),a.props.authActions.showDefinitions(!1)})),y()(ve()(a),"authorize",(function(){var e=a.props,t=e.authActions,n=e.errActions,r=e.getConfigs,o=e.authSelectors,i=e.oas3Selectors,s=r(),c=o.getConfigs();n.clear({authId:name,type:"auth",source:"auth"}),function(e){var t=e.auth,n=e.authActions,r=e.errActions,a=e.configs,o=e.authConfigs,i=void 0===o?{}:o,s=e.currentServer,c=t.schema,u=t.scopes,l=t.name,p=t.clientId,f=c.get("flow"),d=[];switch(f){case"password":return void n.authorizePassword(t);case"application":return void n.authorizeApplication(t);case"accessCode":d.push("response_type=code");break;case"implicit":d.push("response_type=token");break;case"clientCredentials":case"client_credentials":return void n.authorizeApplication(t);case"authorizationCode":case"authorization_code":d.push("response_type=code")}"string"==typeof p&&d.push("client_id="+encodeURIComponent(p));var h=a.oauth2RedirectUrl;if(void 0!==h){d.push("redirect_uri="+encodeURIComponent(h));var m=[];if(I()(u)?m=u:L.a.List.isList(u)&&(m=u.toArray()),m.length>0){var v=i.scopeSeparator||" ";d.push("scope="+encodeURIComponent(m.join(v)))}var g=Object($.a)(new Date);if(d.push("state="+encodeURIComponent(g)),void 0!==i.realm&&d.push("realm="+encodeURIComponent(i.realm)),("authorizationCode"===f||"authorization_code"===f||"accessCode"===f)&&i.usePkceWithAuthorizationCodeGrant){var y=Object($.j)(),b=Object($.c)(y);d.push("code_challenge="+b),d.push("code_challenge_method=S256"),t.codeVerifier=y}var E=i.additionalQueryStringParams;for(var x in E){var S;void 0!==E[x]&&d.push(N()(S=[x,E[x]]).call(S,encodeURIComponent).join("="))}var w,j=c.get("authorizationUrl"),O=[s?Ye()(Object($.G)(j),s,!0).toString():Object($.G)(j),d.join("&")].join(-1===Se()(j).call(j,"?")?"?":"&");w="implicit"===f?n.preAuthorizeImplicit:i.useBasicAuthenticationWithAccessCodeGrant?n.authorizeAccessCodeWithBasicAuthentication:n.authorizeAccessCodeWithFormParams,H.a.swaggerUIRedirectOauth2={auth:t,state:g,redirectUrl:h,callback:w,errCb:r.newAuthErr},H.a.open(O)}else r.newAuthErr({authId:l,source:"validation",level:"error",message:"oauth2RedirectUrl configuration is not passed. Oauth2 authorization cannot be performed."})}({auth:a.state,currentServer:i.serverEffectiveValue(i.selectedServer()),authActions:t,errActions:n,configs:s,authConfigs:c})})),y()(ve()(a),"onScopeChange",(function(e){var t,n,r=e.target,o=r.checked,i=r.dataset.value;if(o&&-1===Se()(t=a.state.scopes).call(t,i)){var s,u=c()(s=a.state.scopes).call(s,[i]);a.setState({scopes:u})}else if(!o&&Se()(n=a.state.scopes).call(n,i)>-1){var p;a.setState({scopes:l()(p=a.state.scopes).call(p,(function(e){return e!==i}))})}})),y()(ve()(a),"onInputChange",(function(e){var t=e.target,n=t.dataset.name,r=t.value,o=y()({},n,r);a.setState(o)})),y()(ve()(a),"selectScopes",(function(e){var t;e.target.dataset.all?a.setState({scopes:ze()(Je()(t=a.props.schema.get("allowedScopes")||a.props.schema.get("scopes")).call(t))}):a.setState({scopes:[]})})),y()(ve()(a),"logout",(function(e){e.preventDefault();var t=a.props,n=t.authActions,r=t.errActions,o=t.name;r.clear({authId:o,type:"auth",source:"auth"}),n.logoutWithPersistOption([o])}));var o=a.props,i=o.name,s=o.schema,u=o.authorized,p=o.authSelectors,f=u&&u.get(i),d=p.getConfigs()||{},h=f&&f.get("username")||"",m=f&&f.get("clientId")||d.clientId||"",v=f&&f.get("clientSecret")||d.clientSecret||"",g=f&&f.get("passwordType")||"basic",b=f&&f.get("scopes")||d.scopes||[];return"string"==typeof b&&(b=b.split(d.scopeSeparator||" ")),a.state={appName:d.appName,name:i,schema:s,scopes:b,clientId:m,clientSecret:v,username:h,password:"",passwordType:g},a}return S()(n,[{key:"render",value:function(){var e,t,n=this,r=this.props,a=r.schema,o=r.getComponent,i=r.authSelectors,s=r.errSelectors,u=r.name,p=r.specSelectors,f=o("Input"),d=o("Row"),h=o("Col"),m=o("Button"),v=o("authError"),g=o("JumpToPath",!0),y=o("Markdown",!0),b=o("InitializedInput"),E=p.isOAS3,x=E()?a.get("openIdConnectUrl"):null,S="implicit",w="password",j=E()?x?"authorization_code":"authorizationCode":"accessCode",O=E()?x?"client_credentials":"clientCredentials":"application",C=a.get("flow"),_=a.get("allowedScopes")||a.get("scopes"),A=!!i.authorized().get(u),k=l()(e=s.allErrors()).call(e,(function(e){return e.get("authId")===u})),I=!l()(k).call(k,(function(e){return"validation"===e.get("source")})).size,P=a.get("description");return D.a.createElement("div",null,D.a.createElement("h4",null,u," (OAuth2, ",a.get("flow"),") ",D.a.createElement(g,{path:["securityDefinitions",u]})),this.state.appName?D.a.createElement("h5",null,"Application: ",this.state.appName," "):null,P&&D.a.createElement(y,{source:a.get("description")}),A&&D.a.createElement("h6",null,"Authorized"),x&&D.a.createElement("p",null,"OpenID Connect URL: ",D.a.createElement("code",null,x)),(C===S||C===j)&&D.a.createElement("p",null,"Authorization URL: ",D.a.createElement("code",null,a.get("authorizationUrl"))),(C===w||C===j||C===O)&&D.a.createElement("p",null,"Token URL:",D.a.createElement("code",null," ",a.get("tokenUrl"))),D.a.createElement("p",{className:"flow"},"Flow: ",D.a.createElement("code",null,a.get("flow"))),C!==w?null:D.a.createElement(d,null,D.a.createElement(d,null,D.a.createElement("label",{htmlFor:"oauth_username"},"username:"),A?D.a.createElement("code",null," ",this.state.username," "):D.a.createElement(h,{tablet:10,desktop:10},D.a.createElement("input",{id:"oauth_username",type:"text","data-name":"username",onChange:this.onInputChange,autoFocus:!0}))),D.a.createElement(d,null,D.a.createElement("label",{htmlFor:"oauth_password"},"password:"),A?D.a.createElement("code",null," ****** "):D.a.createElement(h,{tablet:10,desktop:10},D.a.createElement("input",{id:"oauth_password",type:"password","data-name":"password",onChange:this.onInputChange}))),D.a.createElement(d,null,D.a.createElement("label",{htmlFor:"password_type"},"Client credentials location:"),A?D.a.createElement("code",null," ",this.state.passwordType," "):D.a.createElement(h,{tablet:10,desktop:10},D.a.createElement("select",{id:"password_type","data-name":"passwordType",onChange:this.onInputChange},D.a.createElement("option",{value:"basic"},"Authorization header"),D.a.createElement("option",{value:"request-body"},"Request body"))))),(C===O||C===S||C===j||C===w)&&(!A||A&&this.state.clientId)&&D.a.createElement(d,null,D.a.createElement("label",{htmlFor:"client_id"},"client_id:"),A?D.a.createElement("code",null," ****** "):D.a.createElement(h,{tablet:10,desktop:10},D.a.createElement(b,{id:"client_id",type:"text",required:C===w,initialValue:this.state.clientId,"data-name":"clientId",onChange:this.onInputChange}))),(C===O||C===j||C===w)&&D.a.createElement(d,null,D.a.createElement("label",{htmlFor:"client_secret"},"client_secret:"),A?D.a.createElement("code",null," ****** "):D.a.createElement(h,{tablet:10,desktop:10},D.a.createElement(b,{id:"client_secret",initialValue:this.state.clientSecret,type:"password","data-name":"clientSecret",onChange:this.onInputChange}))),!A&&_&&_.size?D.a.createElement("div",{className:"scopes"},D.a.createElement("h2",null,"Scopes:",D.a.createElement("a",{onClick:this.selectScopes,"data-all":!0},"select all"),D.a.createElement("a",{onClick:this.selectScopes},"select none")),N()(_).call(_,(function(e,t){var r,a,o,i,s;return D.a.createElement(d,{key:t},D.a.createElement("div",{className:"checkbox"},D.a.createElement(f,{"data-value":t,id:c()(r=c()(a="".concat(t,"-")).call(a,C,"-checkbox-")).call(r,n.state.name),disabled:A,checked:He()(o=n.state.scopes).call(o,t),type:"checkbox",onChange:n.onScopeChange}),D.a.createElement("label",{htmlFor:c()(i=c()(s="".concat(t,"-")).call(s,C,"-checkbox-")).call(i,n.state.name)},D.a.createElement("span",{className:"item"}),D.a.createElement("div",{className:"text"},D.a.createElement("p",{className:"name"},t),D.a.createElement("p",{className:"description"},e)))))})).toArray()):null,N()(t=k.valueSeq()).call(t,(function(e,t){return D.a.createElement(v,{error:e,key:t})})),D.a.createElement("div",{className:"auth-btn-wrapper"},I&&(A?D.a.createElement(m,{className:"btn modal-btn auth authorize",onClick:this.logout},"Logout"):D.a.createElement(m,{className:"btn modal-btn auth authorize",onClick:this.authorize},"Authorize")),D.a.createElement(m,{className:"btn modal-btn auth btn-done",onClick:this.close},"Close")))}}]),n}(D.a.Component),Ge=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onClick",(function(){var e=r.props,t=e.specActions,n=e.path,a=e.method;t.clearResponse(n,a),t.clearRequest(n,a)})),r}return S()(n,[{key:"render",value:function(){return D.a.createElement("button",{className:"btn btn-clear opblock-control__btn",onClick:this.onClick},"Clear")}}]),n}(M.Component),Ze=function(e){var t=e.headers;return D.a.createElement("div",null,D.a.createElement("h5",null,"Response headers"),D.a.createElement("pre",{className:"microlight"},t))},Xe=function(e){var t=e.duration;return D.a.createElement("div",null,D.a.createElement("h5",null,"Request duration"),D.a.createElement("pre",{className:"microlight"},t," ms"))},Qe=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"shouldComponentUpdate",value:function(e){return this.props.response!==e.response||this.props.path!==e.path||this.props.method!==e.method||this.props.displayRequestDuration!==e.displayRequestDuration}},{key:"render",value:function(){var e,t=this.props,n=t.response,r=t.getComponent,a=t.getConfigs,o=t.displayRequestDuration,i=t.specSelectors,s=t.path,u=t.method,l=a().showMutatedRequest?i.mutatedRequestFor(s,u):i.requestFor(s,u),p=n.get("status"),d=l.get("url"),h=n.get("headers").toJS(),m=n.get("notDocumented"),v=n.get("error"),g=n.get("text"),y=n.get("duration"),b=f()(h),E=h["content-type"]||h["Content-Type"],x=r("curl"),S=r("responseBody"),w=N()(b).call(b,(function(e){var t=I()(h[e])?h[e].join():h[e];return D.a.createElement("span",{className:"headerline",key:e}," ",e,": ",t," ")})),j=0!==w.length,O=r("Markdown",!0);return D.a.createElement("div",null,l&&D.a.createElement(x,{request:l,getConfigs:a}),d&&D.a.createElement("div",null,D.a.createElement("h4",null,"Request URL"),D.a.createElement("div",{className:"request-url"},D.a.createElement("pre",{className:"microlight"},d))),D.a.createElement("h4",null,"Server response"),D.a.createElement("table",{className:"responses-table live-responses-table"},D.a.createElement("thead",null,D.a.createElement("tr",{className:"responses-header"},D.a.createElement("td",{className:"col_header response-col_status"},"Code"),D.a.createElement("td",{className:"col_header response-col_description"},"Details"))),D.a.createElement("tbody",null,D.a.createElement("tr",{className:"response"},D.a.createElement("td",{className:"response-col_status"},p,m?D.a.createElement("div",{className:"response-undocumented"},D.a.createElement("i",null," Undocumented ")):null),D.a.createElement("td",{className:"response-col_description"},v?D.a.createElement(O,{source:c()(e="".concat(""!==n.get("name")?"".concat(n.get("name"),": "):"")).call(e,n.get("message"))}):null,g?D.a.createElement(S,{content:g,contentType:E,url:d,headers:h,getConfigs:a,getComponent:r}):null,j?D.a.createElement(Ze,{headers:w}):null,o&&y?D.a.createElement(Xe,{duration:y}):null)))))}}]),n}(D.a.Component),et=n(170),tt=["get","put","post","delete","options","head","patch"],nt=c()(tt).call(tt,["trace"]),rt=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.specSelectors,n=e.getComponent,r=e.oas3Selectors,a=e.layoutSelectors,o=e.layoutActions,i=e.getConfigs,s=e.fn,u=t.taggedOperations(),l=n("OperationContainer",!0),p=n("OperationTag"),f=i().maxDisplayedTags,d=a.currentFilter();return d&&!0!==d&&"true"!==d&&"false"!==d&&(u=s.opsFilter(u,d)),f&&!isNaN(f)&&f>=0&&(u=A()(u).call(u,0,f)),D.a.createElement("div",null,N()(u).call(u,(function(e,s){var u=e.get("operations");return D.a.createElement(p,{key:"operation-"+s,tagObj:e,tag:s,oas3Selectors:r,layoutSelectors:a,layoutActions:o,getConfigs:i,getComponent:n,specUrl:t.url()},N()(u).call(u,(function(e){var n,r=e.get("path"),a=e.get("method"),o=L.a.List(["paths",r,a]),i=t.isOAS3()?nt:tt;return-1===Se()(i).call(i,a)?null:D.a.createElement(l,{key:c()(n="".concat(r,"-")).call(n,a),specPath:o,op:e,path:r,method:a,tag:s})})).toArray())})).toArray(),u.size<1?D.a.createElement("h3",null," No operations defined in spec! "):null)}}]),n}(D.a.Component),at=n(80),ot=n.n(at);function it(e){return e.match(/^(?:[a-z]+:)?\/\//i)}function st(e,t){return e?it(e)?(n=e).match(/^\/\//i)?c()(r="".concat(window.location.protocol)).call(r,n):n:new ot.a(e,t).href:t;var n,r}function ct(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.selectedServer,a=void 0===r?"":r;if(e){if(it(e))return e;var o=st(a,t);return it(o)?new ot.a(e,o).href:new ot.a(e,window.location.href).href}}var ut=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.tagObj,r=t.tag,a=t.children,o=t.oas3Selectors,i=t.layoutSelectors,s=t.layoutActions,c=t.getConfigs,u=t.getComponent,l=t.specUrl,p=c(),f=p.docExpansion,d=p.deepLinking,h=d&&"false"!==d,m=u("Collapse"),v=u("Markdown",!0),g=u("DeepLink"),y=u("Link"),b=n.getIn(["tagDetails","description"],null),E=n.getIn(["tagDetails","externalDocs","description"]),x=n.getIn(["tagDetails","externalDocs","url"]);e=Object($.s)(o)&&Object($.s)(o.selectedServer)?ct(x,l,{selectedServer:o.selectedServer()}):x;var S=["operations-tag",r],w=i.isShown(S,"full"===f||"list"===f);return D.a.createElement("div",{className:w?"opblock-tag-section is-open":"opblock-tag-section"},D.a.createElement("h4",{onClick:function(){return s.show(S,!w)},className:b?"opblock-tag":"opblock-tag no-desc",id:N()(S).call(S,(function(e){return Object($.g)(e)})).join("-"),"data-tag":r,"data-is-open":w},D.a.createElement(g,{enabled:h,isShown:w,path:Object($.d)(r),text:r}),b?D.a.createElement("small",null,D.a.createElement(v,{source:b})):D.a.createElement("small",null),D.a.createElement("div",null,E?D.a.createElement("small",null,E,e?": ":null,e?D.a.createElement(y,{href:Object($.G)(e),onClick:function(e){return e.stopPropagation()},target:"_blank"},e):null):null),D.a.createElement("button",{className:"expand-operation",title:w?"Collapse operation":"Expand operation",onClick:function(){return s.show(S,!w)}},D.a.createElement("svg",{className:"arrow",width:"20",height:"20"},D.a.createElement("use",{href:w?"#large-arrow-down":"#large-arrow",xlinkHref:w?"#large-arrow-down":"#large-arrow"})))),D.a.createElement(m,{isOpened:w},a))}}]),n}(D.a.Component);y()(ut,"defaultProps",{tagObj:L.a.fromJS({}),tag:""});var lt=function(e){ye()(r,e);var t=Ee()(r);function r(){return E()(this,r),t.apply(this,arguments)}return S()(r,[{key:"render",value:function(){var e=this.props,t=e.specPath,r=e.response,a=e.request,o=e.toggleShown,i=e.onTryoutClick,s=e.onCancelClick,c=e.onExecute,u=e.fn,l=e.getComponent,p=e.getConfigs,f=e.specActions,d=e.specSelectors,h=e.authActions,m=e.authSelectors,v=e.oas3Actions,g=e.oas3Selectors,y=this.props.operation,b=y.toJS(),E=b.deprecated,x=b.isShown,S=b.path,w=b.method,j=b.op,O=b.tag,C=b.operationId,_=b.allowTryItOut,A=b.displayRequestDuration,k=b.tryItOutEnabled,I=b.executeInProgress,P=j.description,T=j.externalDocs,R=j.schemes,N=T?ct(T.url,d.url(),{selectedServer:g.selectedServer()}):"",M=y.getIn(["op"]),q=M.get("responses"),B=Object($.n)(M,["parameters"]),L=d.operationScheme(S,w),U=["operations",O,C],V=Object($.m)(M),z=l("responses"),F=l("parameters"),J=l("execute"),W=l("clear"),H=l("Collapse"),Y=l("Markdown",!0),K=l("schemes"),G=l("OperationServers"),Z=l("OperationExt"),X=l("OperationSummary"),Q=l("Link"),ee=p().showExtensions;if(q&&r&&r.size>0){var te=!q.get(String(r.get("status")))&&!q.get("default");r=r.set("notDocumented",te)}var ne=[S,w];return D.a.createElement("div",{className:E?"opblock opblock-deprecated":x?"opblock opblock-".concat(w," is-open"):"opblock opblock-".concat(w),id:Object($.g)(U.join("-"))},D.a.createElement(X,{operationProps:y,toggleShown:o,getComponent:l,authActions:h,authSelectors:m,specPath:t}),D.a.createElement(H,{isOpened:x},D.a.createElement("div",{className:"opblock-body"},M&&M.size||null===M?null:D.a.createElement("img",{height:"32px",width:"32px",src:n(375),className:"opblock-loading-animation"}),E&&D.a.createElement("h4",{className:"opblock-title_normal"}," Warning: Deprecated"),P&&D.a.createElement("div",{className:"opblock-description-wrapper"},D.a.createElement("div",{className:"opblock-description"},D.a.createElement(Y,{source:P}))),N?D.a.createElement("div",{className:"opblock-external-docs-wrapper"},D.a.createElement("h4",{className:"opblock-title_normal"},"Find more details"),D.a.createElement("div",{className:"opblock-external-docs"},D.a.createElement("span",{className:"opblock-external-docs__description"},D.a.createElement(Y,{source:T.description})),D.a.createElement(Q,{target:"_blank",className:"opblock-external-docs__link",href:Object($.G)(N)},N))):null,M&&M.size?D.a.createElement(F,{parameters:B,specPath:t.push("parameters"),operation:M,onChangeKey:ne,onTryoutClick:i,onCancelClick:s,tryItOutEnabled:k,allowTryItOut:_,fn:u,getComponent:l,specActions:f,specSelectors:d,pathMethod:[S,w],getConfigs:p,oas3Actions:v,oas3Selectors:g}):null,k?D.a.createElement(G,{getComponent:l,path:S,method:w,operationServers:M.get("servers"),pathServers:d.paths().getIn([S,"servers"]),getSelectedServer:g.selectedServer,setSelectedServer:v.setSelectedServer,setServerVariableValue:v.setServerVariableValue,getServerVariable:g.serverVariableValue,getEffectiveServerValue:g.serverEffectiveValue}):null,k&&_&&R&&R.size?D.a.createElement("div",{className:"opblock-schemes"},D.a.createElement(K,{schemes:R,path:S,method:w,specActions:f,currentScheme:L})):null,D.a.createElement("div",{className:k&&r&&_?"btn-group":"execute-wrapper"},k&&_?D.a.createElement(J,{operation:M,specActions:f,specSelectors:d,oas3Selectors:g,oas3Actions:v,path:S,method:w,onExecute:c,disabled:I}):null,k&&r&&_?D.a.createElement(W,{specActions:f,path:S,method:w}):null),I?D.a.createElement("div",{className:"loading-container"},D.a.createElement("div",{className:"loading"})):null,q?D.a.createElement(z,{responses:q,request:a,tryItOutResponse:r,getComponent:l,getConfigs:p,specSelectors:d,oas3Actions:v,oas3Selectors:g,specActions:f,produces:d.producesOptionsFor([S,w]),producesValue:d.currentProducesFor([S,w]),specPath:t.push("responses"),path:S,method:w,displayRequestDuration:A,fn:u}):null,ee&&V.size?D.a.createElement(Z,{extensions:V,getComponent:l}):null)))}}]),r}(M.PureComponent);y()(lt,"defaultProps",{operation:null,response:null,request:null,specPath:Object(B.List)(),summary:""});var pt=n(77),ft=n.n(pt),dt=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.toggleShown,n=e.getComponent,r=e.authActions,a=e.authSelectors,o=e.operationProps,i=e.specPath,s=o.toJS(),c=s.summary,u=s.isAuthorized,l=s.method,p=s.op,f=s.showSummary,d=s.operationId,h=s.originalOperationId,m=s.displayOperationId,v=p.summary,g=o.get("security"),y=n("authorizeOperationBtn"),b=n("OperationSummaryMethod"),E=n("OperationSummaryPath"),x=n("JumpToPath",!0),S=g&&!!g.count(),w=S&&1===g.size&&g.first().isEmpty(),j=!S||w;return D.a.createElement("div",{className:"opblock-summary opblock-summary-".concat(l),onClick:t},D.a.createElement(b,{method:l}),D.a.createElement(E,{getComponent:n,operationProps:o,specPath:i}),f?D.a.createElement("div",{className:"opblock-summary-description"},ft()(v||c)):null,m&&(h||d)?D.a.createElement("span",{className:"opblock-summary-operation-id"},h||d):null,j?null:D.a.createElement(y,{isAuthorized:u,onClick:function(){var e=a.definitionsForRequirements(g);r.showDefinitions(e)}}),D.a.createElement(x,{path:i}))}}]),n}(M.PureComponent);y()(dt,"defaultProps",{operationProps:null,specPath:Object(B.List)(),summary:""});var ht=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props.method;return D.a.createElement("span",{className:"opblock-summary-method"},e.toUpperCase())}}]),n}(M.PureComponent);y()(ht,"defaultProps",{operationProps:null});var mt=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onCopyCapture",(function(e){e.clipboardData.setData("text/plain",r.props.operationProps.get("path")),e.preventDefault()})),r}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.getComponent,r=t.operationProps.toJS(),a=r.deprecated,o=r.isShown,i=r.path,s=r.tag,u=r.operationId,l=r.isDeepLinkingEnabled,p=n("DeepLink");return D.a.createElement("span",{className:a?"opblock-summary-path__deprecated":"opblock-summary-path",onCopyCapture:this.onCopyCapture,"data-path":i},D.a.createElement(p,{enabled:l,isShown:o,path:Object($.d)(c()(e="".concat(s,"/")).call(e,u)),text:i.replace(/\//g,"/")}))}}]),n}(M.PureComponent),vt=n(16),gt=n.n(vt),yt=function(e){var t,n=e.extensions,r=(0,e.getComponent)("OperationExtRow");return D.a.createElement("div",{className:"opblock-section"},D.a.createElement("div",{className:"opblock-section-header"},D.a.createElement("h4",null,"Extensions")),D.a.createElement("div",{className:"table-container"},D.a.createElement("table",null,D.a.createElement("thead",null,D.a.createElement("tr",null,D.a.createElement("td",{className:"col_header"},"Field"),D.a.createElement("td",{className:"col_header"},"Value"))),D.a.createElement("tbody",null,N()(t=n.entrySeq()).call(t,(function(e){var t,n=gt()(e,2),a=n[0],o=n[1];return D.a.createElement(r,{key:c()(t="".concat(a,"-")).call(t,o),xKey:a,xVal:o})}))))))},bt=function(e){var t=e.xKey,n=e.xVal,r=n?n.toJS?n.toJS():n:null;return D.a.createElement("tr",null,D.a.createElement("td",null,t),D.a.createElement("td",null,h()(r)))},Et=n(88),xt=n(400),St=n.n(xt).a,wt=n(399),jt=n.n(wt).a,Ot=n(401),Ct=n.n(Ot).a,_t=n(404),At=n.n(_t).a,kt=n(402),It=n.n(kt).a,Pt=n(403),Tt=n.n(Pt).a,Rt={hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"#333",color:"white"},"hljs-name":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-code":{fontStyle:"italic",color:"#888"},"hljs-emphasis":{fontStyle:"italic"},"hljs-tag":{color:"#62c8f3"},"hljs-variable":{color:"#ade5fc"},"hljs-template-variable":{color:"#ade5fc"},"hljs-selector-id":{color:"#ade5fc"},"hljs-selector-class":{color:"#ade5fc"},"hljs-string":{color:"#a2fca2"},"hljs-bullet":{color:"#d36363"},"hljs-type":{color:"#ffa"},"hljs-title":{color:"#ffa"},"hljs-section":{color:"#ffa"},"hljs-attribute":{color:"#ffa"},"hljs-quote":{color:"#ffa"},"hljs-built_in":{color:"#ffa"},"hljs-builtin-name":{color:"#ffa"},"hljs-number":{color:"#d36363"},"hljs-symbol":{color:"#d36363"},"hljs-keyword":{color:"#fcc28c"},"hljs-selector-tag":{color:"#fcc28c"},"hljs-literal":{color:"#fcc28c"},"hljs-comment":{color:"#888"},"hljs-deletion":{color:"#333",backgroundColor:"#fc9b9b"},"hljs-regexp":{color:"#c6b4f0"},"hljs-link":{color:"#c6b4f0"},"hljs-meta":{color:"#fc9b9b"},"hljs-addition":{backgroundColor:"#a2fca2",color:"#333"}};Et.Light.registerLanguage("json",jt),Et.Light.registerLanguage("js",St),Et.Light.registerLanguage("xml",Ct),Et.Light.registerLanguage("yaml",It),Et.Light.registerLanguage("http",Tt),Et.Light.registerLanguage("bash",At);var Nt={agate:Rt,arta:{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"#222",color:"#aaa"},"hljs-subst":{color:"#aaa"},"hljs-section":{color:"#fff",fontWeight:"bold"},"hljs-comment":{color:"#444"},"hljs-quote":{color:"#444"},"hljs-meta":{color:"#444"},"hljs-string":{color:"#ffcc33"},"hljs-symbol":{color:"#ffcc33"},"hljs-bullet":{color:"#ffcc33"},"hljs-regexp":{color:"#ffcc33"},"hljs-number":{color:"#00cc66"},"hljs-addition":{color:"#00cc66"},"hljs-built_in":{color:"#32aaee"},"hljs-builtin-name":{color:"#32aaee"},"hljs-literal":{color:"#32aaee"},"hljs-type":{color:"#32aaee"},"hljs-template-variable":{color:"#32aaee"},"hljs-attribute":{color:"#32aaee"},"hljs-link":{color:"#32aaee"},"hljs-keyword":{color:"#6644aa"},"hljs-selector-tag":{color:"#6644aa"},"hljs-name":{color:"#6644aa"},"hljs-selector-id":{color:"#6644aa"},"hljs-selector-class":{color:"#6644aa"},"hljs-title":{color:"#bb1166"},"hljs-variable":{color:"#bb1166"},"hljs-deletion":{color:"#bb1166"},"hljs-template-tag":{color:"#bb1166"},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},monokai:{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"#272822",color:"#ddd"},"hljs-tag":{color:"#f92672"},"hljs-keyword":{color:"#f92672",fontWeight:"bold"},"hljs-selector-tag":{color:"#f92672",fontWeight:"bold"},"hljs-literal":{color:"#f92672",fontWeight:"bold"},"hljs-strong":{color:"#f92672"},"hljs-name":{color:"#f92672"},"hljs-code":{color:"#66d9ef"},"hljs-class .hljs-title":{color:"white"},"hljs-attribute":{color:"#bf79db"},"hljs-symbol":{color:"#bf79db"},"hljs-regexp":{color:"#bf79db"},"hljs-link":{color:"#bf79db"},"hljs-string":{color:"#a6e22e"},"hljs-bullet":{color:"#a6e22e"},"hljs-subst":{color:"#a6e22e"},"hljs-title":{color:"#a6e22e",fontWeight:"bold"},"hljs-section":{color:"#a6e22e",fontWeight:"bold"},"hljs-emphasis":{color:"#a6e22e"},"hljs-type":{color:"#a6e22e",fontWeight:"bold"},"hljs-built_in":{color:"#a6e22e"},"hljs-builtin-name":{color:"#a6e22e"},"hljs-selector-attr":{color:"#a6e22e"},"hljs-selector-pseudo":{color:"#a6e22e"},"hljs-addition":{color:"#a6e22e"},"hljs-variable":{color:"#a6e22e"},"hljs-template-tag":{color:"#a6e22e"},"hljs-template-variable":{color:"#a6e22e"},"hljs-comment":{color:"#75715e"},"hljs-quote":{color:"#75715e"},"hljs-deletion":{color:"#75715e"},"hljs-meta":{color:"#75715e"},"hljs-doctag":{fontWeight:"bold"},"hljs-selector-id":{fontWeight:"bold"}},nord:{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"#2E3440",color:"#D8DEE9"},"hljs-subst":{color:"#D8DEE9"},"hljs-selector-tag":{color:"#81A1C1"},"hljs-selector-id":{color:"#8FBCBB",fontWeight:"bold"},"hljs-selector-class":{color:"#8FBCBB"},"hljs-selector-attr":{color:"#8FBCBB"},"hljs-selector-pseudo":{color:"#88C0D0"},"hljs-addition":{backgroundColor:"rgba(163, 190, 140, 0.5)"},"hljs-deletion":{backgroundColor:"rgba(191, 97, 106, 0.5)"},"hljs-built_in":{color:"#8FBCBB"},"hljs-type":{color:"#8FBCBB"},"hljs-class":{color:"#8FBCBB"},"hljs-function":{color:"#88C0D0"},"hljs-function > .hljs-title":{color:"#88C0D0"},"hljs-keyword":{color:"#81A1C1"},"hljs-literal":{color:"#81A1C1"},"hljs-symbol":{color:"#81A1C1"},"hljs-number":{color:"#B48EAD"},"hljs-regexp":{color:"#EBCB8B"},"hljs-string":{color:"#A3BE8C"},"hljs-title":{color:"#8FBCBB"},"hljs-params":{color:"#D8DEE9"},"hljs-bullet":{color:"#81A1C1"},"hljs-code":{color:"#8FBCBB"},"hljs-emphasis":{fontStyle:"italic"},"hljs-formula":{color:"#8FBCBB"},"hljs-strong":{fontWeight:"bold"},"hljs-link:hover":{textDecoration:"underline"},"hljs-quote":{color:"#4C566A"},"hljs-comment":{color:"#4C566A"},"hljs-doctag":{color:"#8FBCBB"},"hljs-meta":{color:"#5E81AC"},"hljs-meta-keyword":{color:"#5E81AC"},"hljs-meta-string":{color:"#A3BE8C"},"hljs-attr":{color:"#8FBCBB"},"hljs-attribute":{color:"#D8DEE9"},"hljs-builtin-name":{color:"#81A1C1"},"hljs-name":{color:"#81A1C1"},"hljs-section":{color:"#88C0D0"},"hljs-tag":{color:"#81A1C1"},"hljs-variable":{color:"#D8DEE9"},"hljs-template-variable":{color:"#D8DEE9"},"hljs-template-tag":{color:"#5E81AC"},"abnf .hljs-attribute":{color:"#88C0D0"},"abnf .hljs-symbol":{color:"#EBCB8B"},"apache .hljs-attribute":{color:"#88C0D0"},"apache .hljs-section":{color:"#81A1C1"},"arduino .hljs-built_in":{color:"#88C0D0"},"aspectj .hljs-meta":{color:"#D08770"},"aspectj > .hljs-title":{color:"#88C0D0"},"bnf .hljs-attribute":{color:"#8FBCBB"},"clojure .hljs-name":{color:"#88C0D0"},"clojure .hljs-symbol":{color:"#EBCB8B"},"coq .hljs-built_in":{color:"#88C0D0"},"cpp .hljs-meta-string":{color:"#8FBCBB"},"css .hljs-built_in":{color:"#88C0D0"},"css .hljs-keyword":{color:"#D08770"},"diff .hljs-meta":{color:"#8FBCBB"},"ebnf .hljs-attribute":{color:"#8FBCBB"},"glsl .hljs-built_in":{color:"#88C0D0"},"groovy .hljs-meta:not(:first-child)":{color:"#D08770"},"haxe .hljs-meta":{color:"#D08770"},"java .hljs-meta":{color:"#D08770"},"ldif .hljs-attribute":{color:"#8FBCBB"},"lisp .hljs-name":{color:"#88C0D0"},"lua .hljs-built_in":{color:"#88C0D0"},"moonscript .hljs-built_in":{color:"#88C0D0"},"nginx .hljs-attribute":{color:"#88C0D0"},"nginx .hljs-section":{color:"#5E81AC"},"pf .hljs-built_in":{color:"#88C0D0"},"processing .hljs-built_in":{color:"#88C0D0"},"scss .hljs-keyword":{color:"#81A1C1"},"stylus .hljs-keyword":{color:"#81A1C1"},"swift .hljs-meta":{color:"#D08770"},"vim .hljs-built_in":{color:"#88C0D0",fontStyle:"italic"},"yaml .hljs-meta":{color:"#D08770"}},obsidian:{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"#282b2e",color:"#e0e2e4"},"hljs-keyword":{color:"#93c763",fontWeight:"bold"},"hljs-selector-tag":{color:"#93c763",fontWeight:"bold"},"hljs-literal":{color:"#93c763",fontWeight:"bold"},"hljs-selector-id":{color:"#93c763"},"hljs-number":{color:"#ffcd22"},"hljs-attribute":{color:"#668bb0"},"hljs-code":{color:"white"},"hljs-class .hljs-title":{color:"white"},"hljs-section":{color:"white",fontWeight:"bold"},"hljs-regexp":{color:"#d39745"},"hljs-link":{color:"#d39745"},"hljs-meta":{color:"#557182"},"hljs-tag":{color:"#8cbbad"},"hljs-name":{color:"#8cbbad",fontWeight:"bold"},"hljs-bullet":{color:"#8cbbad"},"hljs-subst":{color:"#8cbbad"},"hljs-emphasis":{color:"#8cbbad"},"hljs-type":{color:"#8cbbad",fontWeight:"bold"},"hljs-built_in":{color:"#8cbbad"},"hljs-selector-attr":{color:"#8cbbad"},"hljs-selector-pseudo":{color:"#8cbbad"},"hljs-addition":{color:"#8cbbad"},"hljs-variable":{color:"#8cbbad"},"hljs-template-tag":{color:"#8cbbad"},"hljs-template-variable":{color:"#8cbbad"},"hljs-string":{color:"#ec7600"},"hljs-symbol":{color:"#ec7600"},"hljs-comment":{color:"#818e96"},"hljs-quote":{color:"#818e96"},"hljs-deletion":{color:"#818e96"},"hljs-selector-class":{color:"#A082BD"},"hljs-doctag":{fontWeight:"bold"},"hljs-title":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"}},"tomorrow-night":{"hljs-comment":{color:"#969896"},"hljs-quote":{color:"#969896"},"hljs-variable":{color:"#cc6666"},"hljs-template-variable":{color:"#cc6666"},"hljs-tag":{color:"#cc6666"},"hljs-name":{color:"#cc6666"},"hljs-selector-id":{color:"#cc6666"},"hljs-selector-class":{color:"#cc6666"},"hljs-regexp":{color:"#cc6666"},"hljs-deletion":{color:"#cc6666"},"hljs-number":{color:"#de935f"},"hljs-built_in":{color:"#de935f"},"hljs-builtin-name":{color:"#de935f"},"hljs-literal":{color:"#de935f"},"hljs-type":{color:"#de935f"},"hljs-params":{color:"#de935f"},"hljs-meta":{color:"#de935f"},"hljs-link":{color:"#de935f"},"hljs-attribute":{color:"#f0c674"},"hljs-string":{color:"#b5bd68"},"hljs-symbol":{color:"#b5bd68"},"hljs-bullet":{color:"#b5bd68"},"hljs-addition":{color:"#b5bd68"},"hljs-title":{color:"#81a2be"},"hljs-section":{color:"#81a2be"},"hljs-keyword":{color:"#b294bb"},"hljs-selector-tag":{color:"#b294bb"},hljs:{display:"block",overflowX:"auto",background:"#1d1f21",color:"#c5c8c6",padding:"0.5em"},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}}},Mt=f()(Nt),Dt=function(e){return He()(Mt).call(Mt,e)?Nt[e]:(console.warn("Request style '".concat(e,"' is not available, returning default instead")),Rt)},qt=n(41),Bt=n.n(qt),Lt=n(405),Ut=n.n(Lt),Vt=n(171),zt=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"downloadText",(function(){Ut()(r.props.value,r.props.fileName||"response.txt")})),y()(ve()(r),"preventYScrollingBeyondElement",(function(e){var t=e.target,n=e.nativeEvent.deltaY,r=t.scrollHeight,a=t.offsetHeight,o=t.scrollTop;r>a&&(0===o&&n<0||a+o>=r&&n>0)&&e.preventDefault()})),r}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.value,n=e.className,r=e.downloadable,a=e.getConfigs,o=e.canCopy,i=e.language,s=a?a():{syntaxHighlight:{activated:!0,theme:"agate"}};n=n||"";var c=Bt()(s,"syntaxHighlight.activated")?D.a.createElement(Et.Light,{language:i,className:n+" microlight",onWheel:this.preventYScrollingBeyondElement,style:Dt(Bt()(s,"syntaxHighlight.theme"))},t):D.a.createElement("pre",{onWheel:this.preventYScrollingBeyondElement,className:n+" microlight"},t);return D.a.createElement("div",{className:"highlight-code"},r?D.a.createElement("div",{className:"download-contents",onClick:this.downloadText},"Download"):null,o?D.a.createElement("div",{className:"copy-to-clipboard"},D.a.createElement(Vt.CopyToClipboard,{text:t},D.a.createElement("button",null))):null,c)}}]),n}(M.Component),Ft=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onChangeProducesWrapper",(function(e){return r.props.specActions.changeProducesValue([r.props.path,r.props.method],e)})),y()(ve()(r),"onResponseContentTypeChange",(function(e){var t=e.controlsAcceptHeader,n=e.value,a=r.props,o=a.oas3Actions,i=a.path,s=a.method;t&&o.setResponseContentType({value:n,path:i,method:s})})),r}return S()(n,[{key:"render",value:function(){var e,t=this,r=this.props,a=r.responses,o=r.tryItOutResponse,i=r.getComponent,s=r.getConfigs,c=r.specSelectors,u=r.fn,l=r.producesValue,p=r.displayRequestDuration,f=r.specPath,d=r.path,h=r.method,m=r.oas3Selectors,v=r.oas3Actions,g=Object($.f)(a),y=i("contentType"),b=i("liveResponse"),E=i("response"),x=this.props.produces&&this.props.produces.size?this.props.produces:n.defaultProps.produces,S=c.isOAS3()?Object($.k)(a):null;return D.a.createElement("div",{className:"responses-wrapper"},D.a.createElement("div",{className:"opblock-section-header"},D.a.createElement("h4",null,"Responses"),c.isOAS3()?null:D.a.createElement("label",null,D.a.createElement("span",null,"Response content type"),D.a.createElement(y,{value:l,onChange:this.onChangeProducesWrapper,contentTypes:x,className:"execute-content-type"}))),D.a.createElement("div",{className:"responses-inner"},o?D.a.createElement("div",null,D.a.createElement(b,{response:o,getComponent:i,getConfigs:s,specSelectors:c,path:this.props.path,method:this.props.method,displayRequestDuration:p}),D.a.createElement("h4",null,"Responses")):null,D.a.createElement("table",{className:"responses-table"},D.a.createElement("thead",null,D.a.createElement("tr",{className:"responses-header"},D.a.createElement("td",{className:"col_header response-col_status"},"Code"),D.a.createElement("td",{className:"col_header response-col_description"},"Description"),c.isOAS3()?D.a.createElement("td",{className:"col col_header response-col_links"},"Links"):null)),D.a.createElement("tbody",null,N()(e=a.entrySeq()).call(e,(function(e){var n=gt()(e,2),r=n[0],a=n[1],p=o&&o.get("status")==r?"response_current":"";return D.a.createElement(E,{key:r,path:d,method:h,specPath:f.push(r),isDefault:g===r,fn:u,className:p,code:r,response:a,specSelectors:c,controlsAcceptHeader:a===S,onContentTypeChange:t.onResponseContentTypeChange,contentType:l,getConfigs:s,activeExamplesKey:m.activeExamplesMember(d,h,"responses",r),oas3Actions:v,getComponent:i})})).toArray()))))}}]),n}(D.a.Component);y()(Ft,"defaultProps",{tryItOutResponse:null,produces:Object(B.fromJS)(["application/json"]),displayRequestDuration:!1});var Jt=n(25),Wt=n.n(Jt),Ht=n(406),$t=n.n(Ht),Yt=n(54),Kt=n.n(Yt),Gt=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;return E()(this,n),a=t.call(this,e,r),y()(ve()(a),"_onContentTypeChange",(function(e){var t=a.props,n=t.onContentTypeChange,r=t.controlsAcceptHeader;a.setState({responseContentType:e}),n({value:e,controlsAcceptHeader:r})})),y()(ve()(a),"getTargetExamplesKey",(function(){var e=a.props,t=e.response,n=e.contentType,r=e.activeExamplesKey,o=a.state.responseContentType||n,i=t.getIn(["content",o],Object(B.Map)({})).get("examples",null).keySeq().first();return r||i})),a.state={responseContentType:""},a}return S()(n,[{key:"render",value:function(){var e,t,n,r,a,o=this.props,i=o.path,s=o.method,u=o.code,l=o.response,p=o.className,f=o.specPath,d=o.fn,h=o.getComponent,m=o.getConfigs,v=o.specSelectors,g=o.contentType,y=o.controlsAcceptHeader,b=o.oas3Actions,E=d.inferSchema,x=v.isOAS3(),S=m().showExtensions,w=S?Object($.m)(l):null,j=l.get("headers"),O=l.get("links"),C=h("ResponseExtension"),_=h("headers"),A=h("highlightCode"),k=h("modelExample"),I=h("Markdown",!0),P=h("operationLink"),T=h("contentType"),R=h("ExamplesSelect"),M=h("Example"),q=this.state.responseContentType||g,L=l.getIn(["content",q],Object(B.Map)({})),U=L.get("examples",null);if(x){var V=L.get("schema");n=V?E(V.toJS()):null,r=V?Object(B.List)(["content",this.state.responseContentType,"schema"]):f}else n=l.get("schema"),r=l.has("schema")?f.push("schema"):f;var z,F=!1,J={includeReadOnly:!0};if(x)if(z=L.get("schema",Object(B.Map)({})).toJS(),U){var W=this.getTargetExamplesKey();void 0===(a=U.get(W,Object(B.Map)({})).get("value"))&&(a=$t()(U).call(U).next().value),F=!0}else void 0!==L.get("example")&&(a=L.get("example"),F=!0);else{z=n,J=Wt()(Wt()({},J),{},{includeWriteOnly:!0});var H=l.getIn(["examples",q]);H&&(a=H,F=!0)}var Y=function(e,t,n){return null!=e?D.a.createElement("div",null,D.a.createElement(t,{className:"example",getConfigs:n,value:Object($.J)(e)})):null}(Object($.o)(z,q,J,F?a:void 0),A,m);return D.a.createElement("tr",{className:"response "+(p||""),"data-code":u},D.a.createElement("td",{className:"response-col_status"},u),D.a.createElement("td",{className:"response-col_description"},D.a.createElement("div",{className:"response-col_description__inner"},D.a.createElement(I,{source:l.get("description")})),S&&w.size?N()(e=w.entrySeq()).call(e,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(C,{key:c()(t="".concat(r,"-")).call(t,a),xKey:r,xVal:a})})):null,x&&l.get("content")?D.a.createElement("section",{className:"response-controls"},D.a.createElement("div",{className:Kt()("response-control-media-type",{"response-control-media-type--accept-controller":y})},D.a.createElement("small",{className:"response-control-media-type__title"},"Media type"),D.a.createElement(T,{value:this.state.responseContentType,contentTypes:l.get("content")?l.get("content").keySeq():Object(B.Seq)(),onChange:this._onContentTypeChange}),y?D.a.createElement("small",{className:"response-control-media-type__accept-message"},"Controls ",D.a.createElement("code",null,"Accept")," header."):null),U?D.a.createElement("div",{className:"response-control-examples"},D.a.createElement("small",{className:"response-control-examples__title"},"Examples"),D.a.createElement(R,{examples:U,currentExampleKey:this.getTargetExamplesKey(),onSelect:function(e){return b.setActiveExamplesMember({name:e,pathMethod:[i,s],contextType:"responses",contextName:u})},showLabels:!1})):null):null,Y||n?D.a.createElement(k,{specPath:r,getComponent:h,getConfigs:m,specSelectors:v,schema:Object($.i)(n),example:Y,includeReadOnly:!0}):null,x&&U?D.a.createElement(M,{example:U.get(this.getTargetExamplesKey(),Object(B.Map)({})),getComponent:h,getConfigs:m,omitValue:!0}):null,j?D.a.createElement(_,{headers:j,getComponent:h}):null),x?D.a.createElement("td",{className:"response-col_links"},O?N()(t=O.toSeq().entrySeq()).call(t,(function(e){var t=gt()(e,2),n=t[0],r=t[1];return D.a.createElement(P,{key:n,name:n,link:r,getComponent:h})})):D.a.createElement("i",null,"No links")):null)}}]),n}(D.a.Component);y()(Gt,"defaultProps",{response:Object(B.fromJS)({}),onContentTypeChange:function(){}});var Zt=function(e){var t=e.xKey,n=e.xVal;return D.a.createElement("div",{className:"response__extension"},t,": ",String(n))},Xt=n(407),Qt=n.n(Xt),en=n(408),tn=n.n(en),nn=n(409),rn=n.n(nn),an=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"state",{parsedContent:null}),y()(ve()(r),"updateParsedContent",(function(e){var t=r.props.content;if(e!==t)if(t&&t instanceof Blob){var n=new FileReader;n.onload=function(){r.setState({parsedContent:n.result})},n.readAsText(t)}else r.setState({parsedContent:t.toString()})})),r}return S()(n,[{key:"componentDidMount",value:function(){this.updateParsedContent(null)}},{key:"componentDidUpdate",value:function(e){this.updateParsedContent(e.content)}},{key:"render",value:function(){var e,t,n=this.props,r=n.content,a=n.contentType,o=n.url,i=n.headers,s=void 0===i?{}:i,c=n.getConfigs,u=n.getComponent,l=this.state.parsedContent,p=u("highlightCode"),f="response_"+(new Date).getTime();if(o=o||"",/^application\/octet-stream/i.test(a)||s["Content-Disposition"]&&/attachment/i.test(s["Content-Disposition"])||s["content-disposition"]&&/attachment/i.test(s["content-disposition"])||s["Content-Description"]&&/File Transfer/i.test(s["Content-Description"])||s["content-description"]&&/File Transfer/i.test(s["content-description"]))if("Blob"in window){var d=a||"text/html",m=r instanceof Blob?r:new Blob([r],{type:d}),v=ot.a.createObjectURL(m),g=[d,o.substr(Qt()(o).call(o,"/")+1),v].join(":"),y=s["content-disposition"]||s["Content-Disposition"];if(void 0!==y){var b=Object($.h)(y);null!==b&&(g=b)}t=H.a.navigator&&H.a.navigator.msSaveOrOpenBlob?D.a.createElement("div",null,D.a.createElement("a",{href:v,onClick:function(){return H.a.navigator.msSaveOrOpenBlob(m,g)}},"Download file")):D.a.createElement("div",null,D.a.createElement("a",{href:v,download:g},"Download file"))}else t=D.a.createElement("pre",{className:"microlight"},"Download headers detected but your browser does not support downloading binary via XHR (Blob).");else if(/json/i.test(a)){var E=null;try{e=h()(JSON.parse(r),null," "),E="json"}catch(t){e="can't parse JSON. Raw result:\n\n"+r}t=D.a.createElement(p,{language:E,downloadable:!0,fileName:"".concat(f,".json"),value:e,getConfigs:c,canCopy:!0})}else/xml/i.test(a)?(e=tn()(r,{textNodesOnSameLine:!0,indentor:" "}),t=D.a.createElement(p,{downloadable:!0,fileName:"".concat(f,".xml"),value:e,getConfigs:c,canCopy:!0})):t="text/html"===rn()(a)||/text\/plain/.test(a)?D.a.createElement(p,{downloadable:!0,fileName:"".concat(f,".html"),value:r,getConfigs:c,canCopy:!0}):/^image\//i.test(a)?He()(a).call(a,"svg")?D.a.createElement("div",null," ",r," "):D.a.createElement("img",{className:"full-width",src:ot.a.createObjectURL(r)}):/^audio\//i.test(a)?D.a.createElement("pre",{className:"microlight"},D.a.createElement("audio",{controls:!0},D.a.createElement("source",{src:o,type:a}))):"string"==typeof r?D.a.createElement(p,{downloadable:!0,fileName:"".concat(f,".txt"),value:r,getConfigs:c,canCopy:!0}):r.size>0?l?D.a.createElement("div",null,D.a.createElement("p",{className:"i"},"Unrecognized response type; displaying content as text."),D.a.createElement(p,{downloadable:!0,fileName:"".concat(f,".txt"),value:l,getConfigs:c,canCopy:!0})):D.a.createElement("p",{className:"i"},"Unrecognized response type; unable to display."):null;return t?D.a.createElement("div",null,D.a.createElement("h5",null,"Response body"),t):null}}]),n}(D.a.PureComponent),on=n(15),sn=n.n(on),cn=n(162),un=n.n(cn),ln=function(e){ye()(n,e);var t=Ee()(n);function n(e){var r;return E()(this,n),r=t.call(this,e),y()(ve()(r),"onChange",(function(e,t,n){var a=r.props;(0,a.specActions.changeParamByIdentity)(a.onChangeKey,e,t,n)})),y()(ve()(r),"onChangeConsumesWrapper",(function(e){var t=r.props;(0,t.specActions.changeConsumesValue)(t.onChangeKey,e)})),y()(ve()(r),"toggleTab",(function(e){return"parameters"===e?r.setState({parametersVisible:!0,callbackVisible:!1}):"callbacks"===e?r.setState({callbackVisible:!0,parametersVisible:!1}):void 0})),y()(ve()(r),"onChangeMediaType",(function(e){var t=e.value,n=e.pathMethod,a=r.props,o=a.specActions,i=a.oas3Selectors,s=a.oas3Actions,c=i.hasUserEditedBody.apply(i,sn()(n)),u=i.shouldRetainRequestBodyValue.apply(i,sn()(n));s.setRequestContentType({value:t,pathMethod:n}),s.initRequestBodyValidateError({pathMethod:n}),c||(u||s.setRequestBodyValue({value:void 0,pathMethod:n}),o.clearResponse.apply(o,sn()(n)),o.clearRequest.apply(o,sn()(n)),o.clearValidateParams(n))})),r.state={callbackVisible:!1,parametersVisible:!0},r}return S()(n,[{key:"render",value:function(){var e,t,n=this,r=this.props,a=r.onTryoutClick,o=r.parameters,i=r.allowTryItOut,s=r.tryItOutEnabled,u=r.specPath,l=r.fn,p=r.getComponent,f=r.getConfigs,d=r.specSelectors,h=r.specActions,m=r.pathMethod,v=r.oas3Actions,g=r.oas3Selectors,y=r.operation,b=p("parameterRow"),E=p("TryItOutButton"),x=p("contentType"),S=p("Callbacks",!0),w=p("RequestBody",!0),j=s&&i,O=d.isOAS3(),C=y.get("requestBody"),_=T()(e=un()(T()(o).call(o,(function(e,t){var n,r=t.get("in");return null!==(n=e[r])&&void 0!==n||(e[r]=[]),e[r].push(t),e}),{}))).call(e,(function(e,t){return c()(e).call(e,t)}),[]);return D.a.createElement("div",{className:"opblock-section"},D.a.createElement("div",{className:"opblock-section-header"},O?D.a.createElement("div",{className:"tab-header"},D.a.createElement("div",{onClick:function(){return n.toggleTab("parameters")},className:"tab-item ".concat(this.state.parametersVisible&&"active")},D.a.createElement("h4",{className:"opblock-title"},D.a.createElement("span",null,"Parameters"))),y.get("callbacks")?D.a.createElement("div",{onClick:function(){return n.toggleTab("callbacks")},className:"tab-item ".concat(this.state.callbackVisible&&"active")},D.a.createElement("h4",{className:"opblock-title"},D.a.createElement("span",null,"Callbacks"))):null):D.a.createElement("div",{className:"tab-header"},D.a.createElement("h4",{className:"opblock-title"},"Parameters")),i?D.a.createElement(E,{isOAS3:d.isOAS3(),hasUserEditedBody:g.hasUserEditedBody.apply(g,sn()(m)),enabled:s,onCancelClick:this.props.onCancelClick,onTryoutClick:a,onResetClick:function(){return v.setRequestBodyValue({value:void 0,pathMethod:m})}}):null),this.state.parametersVisible?D.a.createElement("div",{className:"parameters-container"},_.length?D.a.createElement("div",{className:"table-container"},D.a.createElement("table",{className:"parameters"},D.a.createElement("thead",null,D.a.createElement("tr",null,D.a.createElement("th",{className:"col_header parameters-col_name"},"Name"),D.a.createElement("th",{className:"col_header parameters-col_description"},"Description"))),D.a.createElement("tbody",null,N()(_).call(_,(function(e,t){var r;return D.a.createElement(b,{fn:l,specPath:u.push(t.toString()),getComponent:p,getConfigs:f,rawParam:e,param:d.parameterWithMetaByIdentity(m,e),key:c()(r="".concat(e.get("in"),".")).call(r,e.get("name")),onChange:n.onChange,onChangeConsumes:n.onChangeConsumesWrapper,specSelectors:d,specActions:h,oas3Actions:v,oas3Selectors:g,pathMethod:m,isExecute:j})}))))):D.a.createElement("div",{className:"opblock-description-wrapper"},D.a.createElement("p",null,"No parameters"))):null,this.state.callbackVisible?D.a.createElement("div",{className:"callbacks-container opblock-description-wrapper"},D.a.createElement(S,{callbacks:Object(B.Map)(y.get("callbacks")),specPath:A()(u).call(u,0,-1).push("callbacks")})):null,O&&C&&this.state.parametersVisible&&D.a.createElement("div",{className:"opblock-section opblock-section-request-body"},D.a.createElement("div",{className:"opblock-section-header"},D.a.createElement("h4",{className:"opblock-title parameter__name ".concat(C.get("required")&&"required")},"Request body"),D.a.createElement("label",null,D.a.createElement(x,{value:g.requestContentType.apply(g,sn()(m)),contentTypes:C.get("content",Object(B.List)()).keySeq(),onChange:function(e){n.onChangeMediaType({value:e,pathMethod:m})},className:"body-param-content-type"}))),D.a.createElement("div",{className:"opblock-description-wrapper"},D.a.createElement(w,{setRetainRequestBodyValueFlag:function(e){return v.setRetainRequestBodyValueFlag({value:e,pathMethod:m})},userHasEditedBody:g.hasUserEditedBody.apply(g,sn()(m)),specPath:A()(u).call(u,0,-1).push("requestBody"),requestBody:C,requestBodyValue:g.requestBodyValue.apply(g,sn()(m)),requestBodyInclusionSetting:g.requestBodyInclusionSetting.apply(g,sn()(m)),requestBodyErrors:g.requestBodyErrors.apply(g,sn()(m)),isExecute:j,getConfigs:f,activeExamplesKey:g.activeExamplesMember.apply(g,c()(t=sn()(m)).call(t,["requestBody","requestBody"])),updateActiveExamplesKey:function(e){n.props.oas3Actions.setActiveExamplesMember({name:e,pathMethod:n.props.pathMethod,contextType:"requestBody",contextName:"requestBody"})},onChange:function(e,t){if(t){var n=g.requestBodyValue.apply(g,sn()(m)),r=B.Map.isMap(n)?n:Object(B.Map)();return v.setRequestBodyValue({pathMethod:m,value:r.setIn(t,e)})}v.setRequestBodyValue({value:e,pathMethod:m})},onChangeIncludeEmpty:function(e,t){v.setRequestBodyInclusion({pathMethod:m,value:t,name:e})},contentType:g.requestContentType.apply(g,sn()(m))}))))}}]),n}(M.Component);y()(ln,"defaultProps",{onTryoutClick:Function.prototype,onCancelClick:Function.prototype,tryItOutEnabled:!1,allowTryItOut:!0,onChangeKey:[],specPath:[]});var pn=function(e){var t=e.xKey,n=e.xVal;return D.a.createElement("div",{className:"parameter__extension"},t,": ",String(n))},fn={onChange:function(){},isIncludedOptions:{}},dn=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onCheckboxChange",(function(e){(0,r.props.onChange)(e.target.checked)})),r}return S()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.isIncludedOptions,n=e.onChange,r=t.shouldDispatchInit,a=t.defaultValue;r&&n(a)}},{key:"render",value:function(){var e=this.props,t=e.isIncluded,n=e.isDisabled;return D.a.createElement("div",null,D.a.createElement("label",{className:Kt()("parameter__empty_value_toggle",{disabled:n})},D.a.createElement("input",{type:"checkbox",disabled:n,checked:!n&&t,onChange:this.onCheckboxChange}),"Send empty value"))}}]),n}(M.Component);y()(dn,"defaultProps",fn);var hn=n(113),mn=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;return E()(this,n),a=t.call(this,e,r),y()(ve()(a),"onChangeWrapper",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=a.props,r=n.onChange,o=n.rawParam;return r(o,""===e||e&&0===e.size?null:e,t)})),y()(ve()(a),"_onExampleSelect",(function(e){a.props.oas3Actions.setActiveExamplesMember({name:e,pathMethod:a.props.pathMethod,contextType:"parameters",contextName:a.getParamKey()})})),y()(ve()(a),"onChangeIncludeEmpty",(function(e){var t=a.props,n=t.specActions,r=t.param,o=t.pathMethod,i=r.get("name"),s=r.get("in");return n.updateEmptyParamInclusion(o,i,s,e)})),y()(ve()(a),"setDefaultValue",(function(){var e=a.props,t=e.specSelectors,n=e.pathMethod,r=e.rawParam,o=e.oas3Selectors,i=t.parameterWithMetaByIdentity(n,r)||Object(B.Map)(),s=Object(hn.a)(i,{isOAS3:t.isOAS3()}).schema,u=i.get("content",Object(B.Map)()).keySeq().first(),l=s?Object($.o)(s.toJS(),u,{includeWriteOnly:!0}):null;if(i&&void 0===i.get("value")&&"body"!==i.get("in")){var p;if(t.isSwagger2())p=void 0!==i.get("x-example")?i.get("x-example"):void 0!==i.getIn(["schema","example"])?i.getIn(["schema","example"]):s&&s.getIn(["default"]);else if(t.isOAS3()){var f,d=o.activeExamplesMember.apply(o,c()(f=sn()(n)).call(f,["parameters",a.getParamKey()]));p=void 0!==i.getIn(["examples",d,"value"])?i.getIn(["examples",d,"value"]):void 0!==i.getIn(["content",u,"example"])?i.getIn(["content",u,"example"]):void 0!==i.get("example")?i.get("example"):void 0!==(s&&s.get("example"))?s&&s.get("example"):void 0!==(s&&s.get("default"))?s&&s.get("default"):i.get("default")}void 0===p||B.List.isList(p)||(p=Object($.J)(p)),void 0!==p?a.onChangeWrapper(p):s&&"object"===s.get("type")&&l&&!i.get("examples")&&a.onChangeWrapper(B.List.isList(l)?l:Object($.J)(l))}})),a.setDefaultValue(),a}return S()(n,[{key:"componentWillReceiveProps",value:function(e){var t,n=e.specSelectors,r=e.pathMethod,a=e.rawParam,o=n.isOAS3(),i=n.parameterWithMetaByIdentity(r,a)||new B.Map;if(i=i.isEmpty()?a:i,o){var s=Object(hn.a)(i,{isOAS3:o}).schema;t=s?s.get("enum"):void 0}else t=i?i.get("enum"):void 0;var c,u=i?i.get("value"):void 0;void 0!==u?c=u:a.get("required")&&t&&t.size&&(c=t.first()),void 0!==c&&c!==u&&this.onChangeWrapper(Object($.x)(c)),this.setDefaultValue()}},{key:"getParamKey",value:function(){var e,t=this.props.param;return t?c()(e="".concat(t.get("name"),"-")).call(e,t.get("in")):null}},{key:"render",value:function(){var e,t,n,r,a,o=this.props,i=o.param,s=o.rawParam,u=o.getComponent,l=o.getConfigs,p=o.isExecute,f=o.fn,d=o.onChangeConsumes,h=o.specSelectors,m=o.pathMethod,v=o.specPath,g=o.oas3Selectors,y=h.isOAS3(),b=l(),E=b.showExtensions,x=b.showCommonExtensions;if(i||(i=s),!s)return null;var S,w,j,O,C=u("JsonSchemaForm"),_=u("ParamBody"),A=i.get("in"),k="body"!==A?null:D.a.createElement(_,{getComponent:u,getConfigs:l,fn:f,param:i,consumes:h.consumesOptionsFor(m),consumesValue:h.contentTypeValues(m).get("requestContentType"),onChange:this.onChangeWrapper,onChangeConsumes:d,isExecute:p,specSelectors:h,pathMethod:m}),I=u("modelExample"),P=u("Markdown",!0),T=u("ParameterExt"),R=u("ParameterIncludeEmpty"),M=u("ExamplesSelectValueRetainer"),q=u("Example"),L=Object(hn.a)(i,{isOAS3:y}).schema,U=h.parameterWithMetaByIdentity(m,s)||Object(B.Map)(),V=L?L.get("format"):null,z=L?L.get("type"):null,F=L?L.getIn(["items","type"]):null,J="formData"===A,W="FormData"in H.a,Y=i.get("required"),K=U?U.get("value"):"",G=x?Object($.l)(L):null,Z=E?Object($.m)(i):null,X=!1;return void 0!==i&&L&&(S=L.get("items")),void 0!==S?(w=S.get("enum"),j=S.get("default")):L&&(w=L.get("enum")),w&&w.size&&w.size>0&&(X=!0),void 0!==i&&(L&&(j=L.get("default")),void 0===j&&(j=i.get("default")),void 0===(O=i.get("example"))&&(O=i.get("x-example"))),D.a.createElement("tr",{"data-param-name":i.get("name"),"data-param-in":i.get("in")},D.a.createElement("td",{className:"parameters-col_name"},D.a.createElement("div",{className:Y?"parameter__name required":"parameter__name"},i.get("name"),Y?D.a.createElement("span",null," *"):null),D.a.createElement("div",{className:"parameter__type"},z,F&&"[".concat(F,"]"),V&&D.a.createElement("span",{className:"prop-format"},"($",V,")")),D.a.createElement("div",{className:"parameter__deprecated"},y&&i.get("deprecated")?"deprecated":null),D.a.createElement("div",{className:"parameter__in"},"(",i.get("in"),")"),x&&G.size?N()(e=G.entrySeq()).call(e,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(T,{key:c()(t="".concat(r,"-")).call(t,a),xKey:r,xVal:a})})):null,E&&Z.size?N()(t=Z.entrySeq()).call(t,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(T,{key:c()(t="".concat(r,"-")).call(t,a),xKey:r,xVal:a})})):null),D.a.createElement("td",{className:"parameters-col_description"},i.get("description")?D.a.createElement(P,{source:i.get("description")}):null,!k&&p||!X?null:D.a.createElement(P,{className:"parameter__enum",source:"<i>Available values</i> : "+N()(w).call(w,(function(e){return e})).toArray().join(", ")}),!k&&p||void 0===j?null:D.a.createElement(P,{className:"parameter__default",source:"<i>Default value</i> : "+j}),!k&&p||void 0===O?null:D.a.createElement(P,{source:"<i>Example</i> : "+O}),J&&!W&&D.a.createElement("div",null,"Error: your browser does not support FormData"),y&&i.get("examples")?D.a.createElement("section",{className:"parameter-controls"},D.a.createElement(M,{examples:i.get("examples"),onSelect:this._onExampleSelect,updateValue:this.onChangeWrapper,getComponent:u,defaultToFirstExample:!0,currentKey:g.activeExamplesMember.apply(g,c()(n=sn()(m)).call(n,["parameters",this.getParamKey()])),currentUserInputValue:K})):null,k?null:D.a.createElement(C,{fn:f,getComponent:u,value:K,required:Y,disabled:!p,description:i.get("description")?c()(r="".concat(i.get("name")," - ")).call(r,i.get("description")):"".concat(i.get("name")),onChange:this.onChangeWrapper,errors:U.get("errors"),schema:L}),k&&L?D.a.createElement(I,{getComponent:u,specPath:v.push("schema"),getConfigs:l,isExecute:p,specSelectors:h,schema:L,example:k,includeWriteOnly:!0}):null,!k&&p&&i.get("allowEmptyValue")?D.a.createElement(R,{onChange:this.onChangeIncludeEmpty,isIncluded:h.parameterInclusionSettingFor(m,i.get("name"),i.get("in")),isDisabled:!Object($.q)(K)}):null,y&&i.get("examples")?D.a.createElement(q,{example:i.getIn(["examples",g.activeExamplesMember.apply(g,c()(a=sn()(m)).call(a,["parameters",this.getParamKey()]))]),getComponent:u,getConfigs:l}):null))}}]),n}(M.Component),vn=n(18),gn=n.n(vn),yn=n(169),bn=n.n(yn),En=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"handleValidateParameters",(function(){var e=r.props,t=e.specSelectors,n=e.specActions,a=e.path,o=e.method;return n.validateParams([a,o]),t.validateBeforeExecute([a,o])})),y()(ve()(r),"handleValidateRequestBody",(function(){var e=r.props,t=e.path,n=e.method,a=e.specSelectors,o=e.oas3Selectors,i=e.oas3Actions,s={missingBodyValue:!1,missingRequiredKeys:[]};i.clearRequestBodyValidateError({path:t,method:n});var c=a.getOAS3RequiredRequestBodyContentType([t,n]),u=o.requestBodyValue(t,n),l=o.validateBeforeExecute([t,n]),p=o.requestContentType(t,n);if(!l)return s.missingBodyValue=!0,i.setRequestBodyValidateError({path:t,method:n,validationErrors:s}),!1;if(!c)return!0;var f=o.validateShallowRequired({oas3RequiredRequestBodyContentType:c,oas3RequestContentType:p,oas3RequestBodyValue:u});return!f||f.length<1||(gn()(f).call(f,(function(e){s.missingRequiredKeys.push(e)})),i.setRequestBodyValidateError({path:t,method:n,validationErrors:s}),!1)})),y()(ve()(r),"handleValidationResultPass",(function(){var e=r.props,t=e.specActions,n=e.operation,a=e.path,o=e.method;r.props.onExecute&&r.props.onExecute(),t.execute({operation:n,path:a,method:o})})),y()(ve()(r),"handleValidationResultFail",(function(){var e=r.props,t=e.specActions,n=e.path,a=e.method;t.clearValidateParams([n,a]),bn()((function(){t.validateParams([n,a])}),40)})),y()(ve()(r),"handleValidationResult",(function(e){e?r.handleValidationResultPass():r.handleValidationResultFail()})),y()(ve()(r),"onClick",(function(){var e=r.handleValidateParameters(),t=r.handleValidateRequestBody(),n=e&&t;r.handleValidationResult(n)})),y()(ve()(r),"onChangeProducesWrapper",(function(e){return r.props.specActions.changeProducesValue([r.props.path,r.props.method],e)})),r}return S()(n,[{key:"render",value:function(){var e=this.props.disabled;return D.a.createElement("button",{className:"btn execute opblock-control__btn",onClick:this.onClick,disabled:e},"Execute")}}]),n}(M.Component),xn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.headers,r=t.getComponent,a=r("Property"),o=r("Markdown",!0);return n&&n.size?D.a.createElement("div",{className:"headers-wrapper"},D.a.createElement("h4",{className:"headers__title"},"Headers:"),D.a.createElement("table",{className:"headers"},D.a.createElement("thead",null,D.a.createElement("tr",{className:"header-row"},D.a.createElement("th",{className:"header-col"},"Name"),D.a.createElement("th",{className:"header-col"},"Description"),D.a.createElement("th",{className:"header-col"},"Type"))),D.a.createElement("tbody",null,N()(e=n.entrySeq()).call(e,(function(e){var t=gt()(e,2),n=t[0],r=t[1];if(!L.a.Map.isMap(r))return null;var i=r.get("description"),s=r.getIn(["schema"])?r.getIn(["schema","type"]):r.getIn(["type"]),c=r.getIn(["schema","example"]);return D.a.createElement("tr",{key:n},D.a.createElement("td",{className:"header-col"},n),D.a.createElement("td",{className:"header-col"},i?D.a.createElement(o,{source:i}):null),D.a.createElement("td",{className:"header-col"},s," ",c?D.a.createElement(a,{propKey:"Example",propVal:c,propClass:"header-example"}):null))})).toArray()))):null}}]),n}(D.a.Component),Sn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.editorActions,n=e.errSelectors,r=e.layoutSelectors,a=e.layoutActions,o=(0,e.getComponent)("Collapse");if(t&&t.jumpToLine)var i=t.jumpToLine;var s=n.allErrors(),c=l()(s).call(s,(function(e){return"thrown"===e.get("type")||"error"===e.get("level")}));if(!c||c.count()<1)return null;var u=r.isShown(["errorPane"],!0),p=c.sortBy((function(e){return e.get("line")}));return D.a.createElement("pre",{className:"errors-wrapper"},D.a.createElement("hgroup",{className:"error"},D.a.createElement("h4",{className:"errors__title"},"Errors"),D.a.createElement("button",{className:"btn errors__clear-btn",onClick:function(){return a.show(["errorPane"],!u)}},u?"Hide":"Show")),D.a.createElement(o,{isOpened:u,animated:!0},D.a.createElement("div",{className:"errors"},N()(p).call(p,(function(e,t){var n=e.get("type");return"thrown"===n||"auth"===n?D.a.createElement(wn,{key:t,error:e.get("error")||e,jumpToLine:i}):"spec"===n?D.a.createElement(jn,{key:t,error:e,jumpToLine:i}):void 0})))))}}]),n}(D.a.Component),wn=function(e){var t=e.error,n=e.jumpToLine;if(!t)return null;var r=t.get("line");return D.a.createElement("div",{className:"error-wrapper"},t?D.a.createElement("div",null,D.a.createElement("h4",null,t.get("source")&&t.get("level")?On(t.get("source"))+" "+t.get("level"):"",t.get("path")?D.a.createElement("small",null," at ",t.get("path")):null),D.a.createElement("span",{className:"message thrown"},t.get("message")),D.a.createElement("div",{className:"error-line"},r&&n?D.a.createElement("a",{onClick:j()(n).call(n,null,r)},"Jump to line ",r):null)):null)},jn=function(e){var t=e.error,n=e.jumpToLine,r=null;return t.get("path")?r=B.List.isList(t.get("path"))?D.a.createElement("small",null,"at ",t.get("path").join(".")):D.a.createElement("small",null,"at ",t.get("path")):t.get("line")&&!n&&(r=D.a.createElement("small",null,"on line ",t.get("line"))),D.a.createElement("div",{className:"error-wrapper"},t?D.a.createElement("div",null,D.a.createElement("h4",null,On(t.get("source"))+" "+t.get("level")," ",r),D.a.createElement("span",{className:"message"},t.get("message")),D.a.createElement("div",{className:"error-line"},n?D.a.createElement("a",{onClick:j()(n).call(n,null,t.get("line"))},"Jump to line ",t.get("line")):null)):null)};function On(e){var t;return N()(t=(e||"").split(" ")).call(t,(function(e){return e[0].toUpperCase()+A()(e).call(e,1)})).join(" ")}wn.defaultProps={jumpToLine:null};var Cn=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onChangeWrapper",(function(e){return r.props.onChange(e.target.value)})),r}return S()(n,[{key:"componentDidMount",value:function(){this.props.contentTypes&&this.props.onChange(this.props.contentTypes.first())}},{key:"componentWillReceiveProps",value:function(e){var t;e.contentTypes&&e.contentTypes.size&&(He()(t=e.contentTypes).call(t,e.value)||e.onChange(e.contentTypes.first()))}},{key:"render",value:function(){var e=this.props,t=e.contentTypes,n=e.className,r=e.value;return t&&t.size?D.a.createElement("div",{className:"content-type-wrapper "+(n||"")},D.a.createElement("select",{className:"content-type",value:r||"",onChange:this.onChangeWrapper},N()(t).call(t,(function(e){return D.a.createElement("option",{key:e,value:e},e)})).toArray())):null}}]),n}(D.a.Component);y()(Cn,"defaultProps",{onChange:function(){},value:null,contentTypes:Object(B.fromJS)(["application/json"])});var _n=n(28),An=n.n(_n),kn=n(49),In=n.n(kn),Pn=n(84),Tn=n.n(Pn);function Rn(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Tn()(e=l()(n).call(n,(function(e){return!!e})).join(" ")).call(e)}var Nn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.fullscreen,n=e.full,r=In()(e,["fullscreen","full"]);if(t)return D.a.createElement("section",r);var a="swagger-container"+(n?"-full":"");return D.a.createElement("section",An()({},r,{className:Rn(r.className,a)}))}}]),n}(D.a.Component),Mn={mobile:"",tablet:"-tablet",desktop:"-desktop",large:"-hd"},Dn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.keepContents,a=(t.mobile,t.tablet,t.desktop,t.large,In()(t,["hide","keepContents","mobile","tablet","desktop","large"]));if(n&&!r)return D.a.createElement("span",null);var o=[];for(var i in Mn)if(Mn.hasOwnProperty(i)){var s=Mn[i];if(i in this.props){var u=this.props[i];if(u<1){o.push("none"+s);continue}o.push("block"+s),o.push("col-"+u+s)}}n&&o.push("hidden");var l=Rn.apply(void 0,c()(e=[a.className]).call(e,o));return D.a.createElement("section",An()({},a,{className:l}))}}]),n}(D.a.Component),qn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){return D.a.createElement("div",An()({},this.props,{className:Rn(this.props.className,"wrapper")}))}}]),n}(D.a.Component),Bn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){return D.a.createElement("button",An()({},this.props,{className:Rn(this.props.className,"button")}))}}]),n}(D.a.Component);y()(Bn,"defaultProps",{className:""});var Ln=function(e){return D.a.createElement("textarea",e)},Un=function(e){return D.a.createElement("input",e)},Vn=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a,o;return E()(this,n),a=t.call(this,e,r),y()(ve()(a),"onChange",(function(e){var t,n,r=a.props,o=r.onChange,i=r.multiple,s=A()([]).call(e.target.options);i?t=N()(n=l()(s).call(s,(function(e){return e.selected}))).call(n,(function(e){return e.value})):t=e.target.value;a.setState({value:t}),o&&o(t)})),o=e.value?e.value:e.multiple?[""]:"",a.state={value:o},a}return S()(n,[{key:"componentWillReceiveProps",value:function(e){e.value!==this.props.value&&this.setState({value:e.value})}},{key:"render",value:function(){var e,t,n=this.props,r=n.allowedValues,a=n.multiple,o=n.allowEmptyValue,i=n.disabled,s=(null===(e=this.state.value)||void 0===e||null===(t=e.toJS)||void 0===t?void 0:t.call(e))||this.state.value;return D.a.createElement("select",{className:this.props.className,multiple:a,value:s,onChange:this.onChange,disabled:i},o?D.a.createElement("option",{value:""},"--"):null,N()(r).call(r,(function(e,t){return D.a.createElement("option",{key:t,value:String(e)},String(e))})))}}]),n}(D.a.Component);y()(Vn,"defaultProps",{multiple:!1,allowEmptyValue:!0});var zn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){return D.a.createElement("a",An()({},this.props,{rel:"noopener noreferrer",className:Rn(this.props.className,"link")}))}}]),n}(D.a.Component),Fn=function(e){var t=e.children;return D.a.createElement("div",{className:"no-margin"}," ",t," ")},Jn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"renderNotAnimated",value:function(){return this.props.isOpened?D.a.createElement(Fn,null,this.props.children):D.a.createElement("noscript",null)}},{key:"render",value:function(){var e=this.props,t=e.animated,n=e.isOpened,r=e.children;return t?(r=n?r:null,D.a.createElement(Fn,null,r)):this.renderNotAnimated()}}]),n}(D.a.Component);y()(Jn,"defaultProps",{isOpened:!1,animated:!1});var Wn=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r,a;E()(this,n);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return(a=t.call.apply(t,c()(e=[this]).call(e,i))).setTagShown=j()(r=a._setTagShown).call(r,ve()(a)),a}return S()(n,[{key:"_setTagShown",value:function(e,t){this.props.layoutActions.show(e,t)}},{key:"showOp",value:function(e,t){this.props.layoutActions.show(e,t)}},{key:"render",value:function(){var e=this.props,t=e.specSelectors,n=e.layoutSelectors,r=e.layoutActions,a=e.getComponent,o=t.taggedOperations(),i=a("Collapse");return D.a.createElement("div",null,D.a.createElement("h4",{className:"overview-title"},"Overview"),N()(o).call(o,(function(e,t){var a=e.get("operations"),o=["overview-tags",t],s=n.isShown(o,!0);return D.a.createElement("div",{key:"overview-"+t},D.a.createElement("h4",{onClick:function(){return r.show(o,!s)},className:"link overview-tag"}," ",s?"-":"+",t),D.a.createElement(i,{isOpened:s,animated:!0},N()(a).call(a,(function(e){var t=e.toObject(),a=t.path,o=t.method,i=t.id,s="operations",c=i,u=n.isShown([s,c]);return D.a.createElement(Hn,{key:i,path:a,method:o,id:a+"-"+o,shown:u,showOpId:c,showOpIdPrefix:s,href:"#operation-".concat(c),onClick:r.show})})).toArray()))})).toArray(),o.size<1&&D.a.createElement("h3",null," No operations defined in spec! "))}}]),n}(D.a.Component),Hn=function(e){ye()(n,e);var t=Ee()(n);function n(e){var r,a;return E()(this,n),(a=t.call(this,e)).onClick=j()(r=a._onClick).call(r,ve()(a)),a}return S()(n,[{key:"_onClick",value:function(){var e=this.props,t=e.showOpId,n=e.showOpIdPrefix;(0,e.onClick)([n,t],!e.shown)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.method,r=e.shown,a=e.href;return D.a.createElement(zn,{href:a,onClick:this.onClick,className:"block opblock-link ".concat(r?"shown":"")},D.a.createElement("div",null,D.a.createElement("small",{className:"bold-label-".concat(n)},n.toUpperCase()),D.a.createElement("span",{className:"bold-label"},t)))}}]),n}(D.a.Component),$n=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"componentDidMount",value:function(){this.props.initialValue&&(this.inputRef.value=this.props.initialValue)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.value,t.defaultValue,t.initialValue,In()(t,["value","defaultValue","initialValue"]));return D.a.createElement("input",An()({},n,{ref:function(t){return e.inputRef=t}}))}}]),n}(D.a.Component),Yn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.host,n=e.basePath;return D.a.createElement("pre",{className:"base-url"},"[ Base URL: ",t,n," ]")}}]),n}(D.a.Component),Kn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.data,n=e.getComponent,r=e.selectedServer,a=e.url,o=t.get("name")||"the developer",i=ct(t.get("url"),a,{selectedServer:r}),s=t.get("email"),c=n("Link");return D.a.createElement("div",{className:"info__contact"},i&&D.a.createElement("div",null,D.a.createElement(c,{href:Object($.G)(i),target:"_blank"},o," - Website")),s&&D.a.createElement(c,{href:Object($.G)("mailto:".concat(s))},i?"Send email to ".concat(o):"Contact ".concat(o)))}}]),n}(D.a.Component),Gn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.license,n=e.getComponent,r=e.selectedServer,a=e.url,o=n("Link"),i=t.get("name")||"License",s=ct(t.get("url"),a,{selectedServer:r});return D.a.createElement("div",{className:"info__license"},s?D.a.createElement(o,{target:"_blank",href:Object($.G)(s)},i):D.a.createElement("span",null,i))}}]),n}(D.a.Component),Zn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.url,n=(0,e.getComponent)("Link");return D.a.createElement(n,{target:"_blank",href:Object($.G)(t)},D.a.createElement("span",{className:"url"}," ",t))}}]),n}(D.a.PureComponent),Xn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.info,n=e.url,r=e.host,a=e.basePath,o=e.getComponent,i=e.externalDocs,s=e.selectedServer,c=e.url,u=t.get("version"),l=t.get("description"),p=t.get("title"),f=ct(t.get("termsOfService"),c,{selectedServer:s}),d=t.get("contact"),h=t.get("license"),m=ct(i&&i.get("url"),c,{selectedServer:s}),v=i&&i.get("description"),g=o("Markdown",!0),y=o("Link"),b=o("VersionStamp"),E=o("InfoUrl"),x=o("InfoBasePath");return D.a.createElement("div",{className:"info"},D.a.createElement("hgroup",{className:"main"},D.a.createElement("h2",{className:"title"},p,u&&D.a.createElement(b,{version:u})),r||a?D.a.createElement(x,{host:r,basePath:a}):null,n&&D.a.createElement(E,{getComponent:o,url:n})),D.a.createElement("div",{className:"description"},D.a.createElement(g,{source:l})),f&&D.a.createElement("div",{className:"info__tos"},D.a.createElement(y,{target:"_blank",href:Object($.G)(f)},"Terms of service")),d&&d.size?D.a.createElement(Kn,{getComponent:o,data:d,selectedServer:s,url:n}):null,h&&h.size?D.a.createElement(Gn,{getComponent:o,license:h,selectedServer:s,url:n}):null,m?D.a.createElement(y,{className:"info__extdocs",target:"_blank",href:Object($.G)(m)},v||m):null)}}]),n}(D.a.Component),Qn=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.specSelectors,n=e.getComponent,r=e.oas3Selectors,a=t.info(),o=t.url(),i=t.basePath(),s=t.host(),c=t.externalDocs(),u=r.selectedServer(),l=n("info");return D.a.createElement("div",null,a&&a.count()?D.a.createElement(l,{info:a,url:o,host:s,basePath:i,externalDocs:c,getComponent:n,selectedServer:u}):null)}}]),n}(D.a.Component),er=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){return null}}]),n}(D.a.Component),tr=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){return D.a.createElement("div",{className:"footer"})}}]),n}(D.a.Component),nr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onFilterChange",(function(e){var t=e.target.value;r.props.layoutActions.updateFilter(t)})),r}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.specSelectors,n=e.layoutSelectors,r=(0,e.getComponent)("Col"),a="loading"===t.loadingStatus(),o="failed"===t.loadingStatus(),i=n.currentFilter(),s=["operation-filter-input"];return o&&s.push("failed"),a&&s.push("loading"),D.a.createElement("div",null,null===i||!1===i||"false"===i?null:D.a.createElement("div",{className:"filter-container"},D.a.createElement(r,{className:"filter wrapper",mobile:12},D.a.createElement("input",{className:s.join(" "),placeholder:"Filter by tag",type:"text",onChange:this.onFilterChange,value:!0===i||"true"===i?"":i,disabled:a}))))}}]),n}(D.a.Component),rr=Function.prototype,ar=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;return E()(this,n),a=t.call(this,e,r),y()(ve()(a),"updateValues",(function(e){var t=e.param,n=e.isExecute,r=e.consumesValue,o=void 0===r?"":r,i=/xml/i.test(o),s=/json/i.test(o),c=i?t.get("value_xml"):t.get("value");if(void 0!==c){var u=!c&&s?"{}":c;a.setState({value:u}),a.onChange(u,{isXml:i,isEditBox:n})}else i?a.onChange(a.sample("xml"),{isXml:i,isEditBox:n}):a.onChange(a.sample(),{isEditBox:n})})),y()(ve()(a),"sample",(function(e){var t=a.props,n=t.param,r=(0,t.fn.inferSchema)(n.toJS());return Object($.o)(r,e,{includeWriteOnly:!0})})),y()(ve()(a),"onChange",(function(e,t){var n=t.isEditBox,r=t.isXml;a.setState({value:e,isEditBox:n}),a._onChange(e,r)})),y()(ve()(a),"_onChange",(function(e,t){(a.props.onChange||rr)(e,t)})),y()(ve()(a),"handleOnChange",(function(e){var t=a.props.consumesValue,n=/xml/i.test(t),r=e.target.value;a.onChange(r,{isXml:n})})),y()(ve()(a),"toggleIsEditBox",(function(){return a.setState((function(e){return{isEditBox:!e.isEditBox}}))})),a.state={isEditBox:!1,value:""},a}return S()(n,[{key:"componentDidMount",value:function(){this.updateValues.call(this,this.props)}},{key:"componentWillReceiveProps",value:function(e){this.updateValues.call(this,e)}},{key:"render",value:function(){var e=this.props,t=e.onChangeConsumes,r=e.param,a=e.isExecute,o=e.specSelectors,i=e.pathMethod,s=e.getConfigs,c=e.getComponent,u=c("Button"),l=c("TextArea"),p=c("highlightCode"),f=c("contentType"),d=(o?o.parameterWithMetaByIdentity(i,r):r).get("errors",Object(B.List)()),h=o.contentTypeValues(i).get("requestContentType"),m=this.props.consumes&&this.props.consumes.size?this.props.consumes:n.defaultProp.consumes,v=this.state,g=v.value,y=v.isEditBox;return D.a.createElement("div",{className:"body-param","data-param-name":r.get("name"),"data-param-in":r.get("in")},y&&a?D.a.createElement(l,{className:"body-param__text"+(d.count()?" invalid":""),value:g,onChange:this.handleOnChange}):g&&D.a.createElement(p,{className:"body-param__example",getConfigs:s,value:g}),D.a.createElement("div",{className:"body-param-options"},a?D.a.createElement("div",{className:"body-param-edit"},D.a.createElement(u,{className:y?"btn cancel body-param__example-edit":"btn edit body-param__example-edit",onClick:this.toggleIsEditBox},y?"Cancel":"Edit")):null,D.a.createElement("label",{htmlFor:""},D.a.createElement("span",null,"Parameter content type"),D.a.createElement(f,{value:h,contentTypes:m,onChange:t,className:"body-param-content-type"}))))}}]),n}(M.PureComponent);y()(ar,"defaultProp",{consumes:Object(B.fromJS)(["application/json"]),param:Object(B.fromJS)({}),onChange:rr,onChangeConsumes:rr});var or=n(45),ir=n.n(or),sr=n(71),cr=n.n(sr),ur=function(e){var t,n="_**[]";return Se()(e).call(e,n)<0?e:Tn()(t=e.split(n)[0]).call(t)};var lr=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.request,n=e.getConfigs,r=function(e){var t,n=[],r=!1,a=e.get("headers");if(n.push("curl"),e.get("curlOptions")&&n.push.apply(n,sn()(e.get("curlOptions"))),n.push("-X",e.get("method")),n.push('"'.concat(e.get("url"),'"')),a&&a.size){var o,i,s=ir()(cr()(o=e.get("headers")).call(o));try{for(s.s();!(i=s.n()).done;){var u,l=i.value,p=gt()(l,2),f=p[0],d=p[1];n.push("-H "),n.push(c()(u='"'.concat(f,": ")).call(u,d.replace(/\$/g,"\\$"),'"')),r=r||/^content-type$/i.test(f)&&/^multipart\/form-data$/i.test(d)}}catch(e){s.e(e)}finally{s.f()}}if(e.get("body"))if(r&&He()(t=["POST","PUT","PATCH"]).call(t,e.get("method"))){var m,v=ir()(e.get("body").entrySeq());try{for(v.s();!(m=v.n()).done;){var g,y,b,E=gt()(m.value,2),x=E[0],S=E[1],w=ur(x);n.push("-F"),S instanceof H.a.File?n.push(c()(g=c()(y='"'.concat(w,"=@")).call(y,S.name)).call(g,S.type?";type=".concat(S.type):"",'"')):n.push(c()(b='"'.concat(w,"=")).call(b,S,'"'))}}catch(e){v.e(e)}finally{v.f()}}else{n.push("-d");var j=e.get("body");if(B.Map.isMap(j)){var O,C=[],_=ir()(e.get("body").entrySeq());try{for(_.s();!(O=_.n()).done;){var A,k,I,P=gt()(O.value,2),T=P[0],R=P[1],N=ur(T);R instanceof H.a.File?C.push(c()(A=c()(k='"'.concat(N,'":{"name":"')).call(k,R.name,'"')).call(A,R.type?',"type":"'.concat(R.type,'"'):"","}")):C.push(c()(I='"'.concat(N,'":')).call(I,h()(R).replace(/\\n/g,"").replace("$","\\$")))}}catch(e){_.e(e)}finally{_.f()}n.push("{".concat(C.join(),"}"))}else n.push(h()(e.get("body")).replace(/\\n/g,"").replace(/\$/g,"\\$"))}else e.get("body")||"POST"!==e.get("method")||(n.push("-d"),n.push('""'));return n.join(" ")}(t),a=n(),o=Bt()(a,"syntaxHighlight.activated")?D.a.createElement(Et.Light,{language:"bash",className:"curl microlight",onWheel:this.preventYScrollingBeyondElement,style:Dt(Bt()(a,"syntaxHighlight.theme"))},r):D.a.createElement("textarea",{readOnly:!0,className:"curl",value:r});return D.a.createElement("div",{className:"curl-command"},D.a.createElement("h4",null,"Curl"),D.a.createElement("div",{className:"copy-to-clipboard"},D.a.createElement(Vt.CopyToClipboard,{text:r},D.a.createElement("button",null))),D.a.createElement("div",null,o))}}]),n}(D.a.Component),pr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onChange",(function(e){r.setScheme(e.target.value)})),y()(ve()(r),"setScheme",(function(e){var t=r.props,n=t.path,a=t.method;t.specActions.setScheme(e,n,a)})),r}return S()(n,[{key:"componentWillMount",value:function(){var e=this.props.schemes;this.setScheme(e.first())}},{key:"componentWillReceiveProps",value:function(e){var t;this.props.currentScheme&&He()(t=e.schemes).call(t,this.props.currentScheme)||this.setScheme(e.schemes.first())}},{key:"render",value:function(){var e,t=this.props,n=t.schemes,r=t.currentScheme;return D.a.createElement("label",{htmlFor:"schemes"},D.a.createElement("span",{className:"schemes-title"},"Schemes"),D.a.createElement("select",{onChange:this.onChange,value:r},N()(e=n.valueSeq()).call(e,(function(e){return D.a.createElement("option",{value:e,key:e},e)})).toArray()))}}]),n}(D.a.Component),fr=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.specActions,n=e.specSelectors,r=e.getComponent,a=n.operationScheme(),o=n.schemes(),i=r("schemes");return o&&o.size?D.a.createElement(i,{currentScheme:a,schemes:o,specActions:t}):null}}]),n}(D.a.Component),dr=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;E()(this,n),a=t.call(this,e,r),y()(ve()(a),"toggleCollapsed",(function(){a.props.onToggle&&a.props.onToggle(a.props.modelName,!a.state.expanded),a.setState({expanded:!a.state.expanded})})),y()(ve()(a),"onLoad",(function(e){if(e&&a.props.layoutSelectors){var t=a.props.layoutSelectors.getScrollToKey();L.a.is(t,a.props.specPath)&&a.toggleCollapsed(),a.props.layoutActions.readyToScroll(a.props.specPath,e.parentElement)}}));var o=a.props,i=o.expanded,s=o.collapsedContent;return a.state={expanded:i,collapsedContent:s||n.defaultProps.collapsedContent},a}return S()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.hideSelfOnExpand,n=e.expanded,r=e.modelName;t&&n&&this.props.onToggle(r,n)}},{key:"componentWillReceiveProps",value:function(e){this.props.expanded!==e.expanded&&this.setState({expanded:e.expanded})}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.classes;return this.state.expanded&&this.props.hideSelfOnExpand?D.a.createElement("span",{className:n||""},this.props.children):D.a.createElement("span",{className:n||"",ref:this.onLoad},t&&D.a.createElement("span",{onClick:this.toggleCollapsed,className:"pointer"},t),D.a.createElement("span",{onClick:this.toggleCollapsed,className:"pointer"},D.a.createElement("span",{className:"model-toggle"+(this.state.expanded?"":" collapsed")})),this.state.expanded?this.props.children:D.a.createElement("span",{onClick:this.toggleCollapsed,className:"pointer"},this.state.collapsedContent))}}]),n}(M.Component);y()(dr,"defaultProps",{collapsedContent:"{...}",expanded:!1,title:null,onToggle:function(){},hideSelfOnExpand:!1,specPath:L.a.List([])});var hr=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;E()(this,n),a=t.call(this,e,r),y()(ve()(a),"activeTab",(function(e){var t=e.target.dataset.name;a.setState({activeTab:t})}));var o=a.props,i=o.getConfigs,s=o.isExecute,c=i().defaultModelRendering,u=c;return"example"!==c&&"model"!==c&&(u="example"),s&&(u="example"),a.state={activeTab:u},a}return S()(n,[{key:"componentWillReceiveProps",value:function(e){e.isExecute&&!this.props.isExecute&&this.props.example&&this.setState({activeTab:"example"})}},{key:"render",value:function(){var e=this.props,t=e.getComponent,n=e.specSelectors,r=e.schema,a=e.example,o=e.isExecute,i=e.getConfigs,s=e.specPath,c=e.includeReadOnly,u=e.includeWriteOnly,l=i().defaultModelExpandDepth,p=t("ModelWrapper"),f=t("highlightCode"),d=n.isOAS3();return D.a.createElement("div",{className:"model-example"},D.a.createElement("ul",{className:"tab"},D.a.createElement("li",{className:"tabitem"+("example"===this.state.activeTab?" active":"")},D.a.createElement("a",{className:"tablinks","data-name":"example",onClick:this.activeTab},o?"Edit Value":"Example Value")),r?D.a.createElement("li",{className:"tabitem"+("model"===this.state.activeTab?" active":"")},D.a.createElement("a",{className:"tablinks"+(o?" inactive":""),"data-name":"model",onClick:this.activeTab},d?"Schema":"Model")):null),D.a.createElement("div",null,"example"===this.state.activeTab?a||D.a.createElement(f,{value:"(no example available)",getConfigs:i}):null,"model"===this.state.activeTab&&D.a.createElement(p,{schema:r,getComponent:t,getConfigs:i,specSelectors:n,expandDepth:l,specPath:s,includeReadOnly:c,includeWriteOnly:u})))}}]),n}(D.a.Component),mr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onToggle",(function(e,t){r.props.layoutActions&&r.props.layoutActions.show(r.props.fullPath,t)})),r}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.getComponent,r=t.getConfigs,a=n("Model");return this.props.layoutSelectors&&(e=this.props.layoutSelectors.isShown(this.props.fullPath)),D.a.createElement("div",{className:"model-box"},D.a.createElement(a,An()({},this.props,{getConfigs:r,expanded:e,depth:1,onToggle:this.onToggle,expandDepth:this.props.expandDepth||0})))}}]),n}(M.Component),vr=n(172),gr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"getSchemaBasePath",(function(){return r.props.specSelectors.isOAS3()?["components","schemas"]:["definitions"]})),y()(ve()(r),"getCollapsedContent",(function(){return" "})),y()(ve()(r),"handleToggle",(function(e,t){var n,a;(r.props.layoutActions.show(c()(n=[]).call(n,sn()(r.getSchemaBasePath()),[e]),t),t)&&r.props.specActions.requestResolvedSubtree(c()(a=[]).call(a,sn()(r.getSchemaBasePath()),[e]))})),y()(ve()(r),"onLoadModels",(function(e){e&&r.props.layoutActions.readyToScroll(r.getSchemaBasePath(),e)})),y()(ve()(r),"onLoadModel",(function(e){if(e){var t,n=e.getAttribute("data-name");r.props.layoutActions.readyToScroll(c()(t=[]).call(t,sn()(r.getSchemaBasePath()),[n]),e)}})),r}return S()(n,[{key:"render",value:function(){var e,t=this,n=this.props,r=n.specSelectors,a=n.getComponent,o=n.layoutSelectors,i=n.layoutActions,s=n.getConfigs,u=r.definitions(),l=s(),p=l.docExpansion,f=l.defaultModelsExpandDepth;if(!u.size||f<0)return null;var d=this.getSchemaBasePath(),h=o.isShown(d,f>0&&"none"!==p),m=r.isOAS3(),v=a("ModelWrapper"),g=a("Collapse"),y=a("ModelCollapse"),b=a("JumpToPath");return D.a.createElement("section",{className:h?"models is-open":"models",ref:this.onLoadModels},D.a.createElement("h4",{onClick:function(){return i.show(d,!h)}},D.a.createElement("span",null,m?"Schemas":"Models"),D.a.createElement("svg",{width:"20",height:"20"},D.a.createElement("use",{xlinkHref:h?"#large-arrow-down":"#large-arrow"}))),D.a.createElement(g,{isOpened:h},N()(e=u.entrySeq()).call(e,(function(e){var n,u=gt()(e,1)[0],l=c()(n=[]).call(n,sn()(d),[u]),p=L.a.List(l),h=r.specResolvedSubtree(l),m=r.specJson().getIn(l),g=B.Map.isMap(h)?h:L.a.Map(),E=B.Map.isMap(m)?m:L.a.Map(),x=g.get("title")||E.get("title")||u,S=o.isShown(l,!1);S&&0===g.size&&E.size>0&&t.props.specActions.requestResolvedSubtree(l);var w=D.a.createElement(v,{name:u,expandDepth:f,schema:g||L.a.Map(),displayName:x,fullPath:l,specPath:p,getComponent:a,specSelectors:r,getConfigs:s,layoutSelectors:o,layoutActions:i,includeReadOnly:!0,includeWriteOnly:!0}),j=D.a.createElement("span",{className:"model-box"},D.a.createElement("span",{className:"model model-title"},x));return D.a.createElement("div",{id:"model-".concat(u),className:"model-container",key:"models-section-".concat(u),"data-name":u,ref:t.onLoadModel},D.a.createElement("span",{className:"models-jump-to-path"},D.a.createElement(b,{specPath:p})),D.a.createElement(y,{classes:"model-box",collapsedContent:t.getCollapsedContent(u),onToggle:t.handleToggle,title:j,displayName:x,modelName:u,specPath:p,layoutSelectors:o,layoutActions:i,hideSelfOnExpand:!0,expanded:f>0&&S},w))})).toArray()))}}]),n}(M.Component),yr=function(e){var t=e.value,n=(0,e.getComponent)("ModelCollapse"),r=D.a.createElement("span",null,"Array [ ",t.count()," ]");return D.a.createElement("span",{className:"prop-enum"},"Enum:",D.a.createElement("br",null),D.a.createElement(n,{collapsedContent:r},"[ ",t.join(", ")," ]"))},br=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t,n,r,a=this.props,o=a.schema,i=a.name,s=a.displayName,u=a.isRef,p=a.getComponent,f=a.getConfigs,d=a.depth,m=a.onToggle,v=a.expanded,g=a.specPath,y=In()(a,["schema","name","displayName","isRef","getComponent","getConfigs","depth","onToggle","expanded","specPath"]),b=y.specSelectors,E=y.expandDepth,x=y.includeReadOnly,S=y.includeWriteOnly,w=b.isOAS3;if(!o)return null;var j=f().showExtensions,O=o.get("description"),C=o.get("properties"),_=o.get("additionalProperties"),k=o.get("title")||s||i,I=o.get("required"),P=l()(o).call(o,(function(e,t){var n;return-1!==Se()(n=["maxProperties","minProperties","nullable","example"]).call(n,t)})),T=o.get("deprecated"),R=p("JumpToPath",!0),M=p("Markdown",!0),q=p("Model"),L=p("ModelCollapse"),U=p("Property"),V=function(){return D.a.createElement("span",{className:"model-jump-to-path"},D.a.createElement(R,{specPath:g}))},z=D.a.createElement("span",null,D.a.createElement("span",null,"{"),"...",D.a.createElement("span",null,"}"),u?D.a.createElement(V,null):""),F=b.isOAS3()?o.get("anyOf"):null,J=b.isOAS3()?o.get("oneOf"):null,W=b.isOAS3()?o.get("not"):null,H=k&&D.a.createElement("span",{className:"model-title"},u&&o.get("$$ref")&&D.a.createElement("span",{className:"model-hint"},o.get("$$ref")),D.a.createElement("span",{className:"model-title__text"},k));return D.a.createElement("span",{className:"model"},D.a.createElement(L,{modelName:i,title:H,onToggle:m,expanded:!!v||d<=E,collapsedContent:z},D.a.createElement("span",{className:"brace-open object"},"{"),u?D.a.createElement(V,null):null,D.a.createElement("span",{className:"inner-object"},D.a.createElement("table",{className:"model"},D.a.createElement("tbody",null,O?D.a.createElement("tr",{className:"description"},D.a.createElement("td",null,"description:"),D.a.createElement("td",null,D.a.createElement(M,{source:O}))):null,T?D.a.createElement("tr",{className:"property"},D.a.createElement("td",null,"deprecated:"),D.a.createElement("td",null,"true")):null,C&&C.size?N()(e=l()(t=C.entrySeq()).call(t,(function(e){var t=gt()(e,2)[1];return(!t.get("readOnly")||x)&&(!t.get("writeOnly")||S)}))).call(e,(function(e){var t,n,r=gt()(e,2),a=r[0],o=r[1],s=w()&&o.get("deprecated"),u=B.List.isList(I)&&I.contains(a),l=["property-row"];return s&&l.push("deprecated"),u&&l.push("required"),D.a.createElement("tr",{key:a,className:l.join(" ")},D.a.createElement("td",null,a,u&&D.a.createElement("span",{className:"star"},"*")),D.a.createElement("td",null,D.a.createElement(q,An()({key:c()(t=c()(n="object-".concat(i,"-")).call(n,a,"_")).call(t,o)},y,{required:u,getComponent:p,specPath:g.push("properties",a),getConfigs:f,schema:o,depth:d+1}))))})).toArray():null,j?D.a.createElement("tr",null,D.a.createElement("td",null," ")):null,j?N()(n=o.entrySeq()).call(n,(function(e){var t=gt()(e,2),n=t[0],r=t[1];if("x-"===A()(n).call(n,0,2)){var a=r?r.toJS?r.toJS():r:null;return D.a.createElement("tr",{key:n,className:"extension"},D.a.createElement("td",null,n),D.a.createElement("td",null,h()(a)))}})).toArray():null,_&&_.size?D.a.createElement("tr",null,D.a.createElement("td",null,"< * >:"),D.a.createElement("td",null,D.a.createElement(q,An()({},y,{required:!1,getComponent:p,specPath:g.push("additionalProperties"),getConfigs:f,schema:_,depth:d+1})))):null,F?D.a.createElement("tr",null,D.a.createElement("td",null,"anyOf ->"),D.a.createElement("td",null,N()(F).call(F,(function(e,t){return D.a.createElement("div",{key:t},D.a.createElement(q,An()({},y,{required:!1,getComponent:p,specPath:g.push("anyOf",t),getConfigs:f,schema:e,depth:d+1})))})))):null,J?D.a.createElement("tr",null,D.a.createElement("td",null,"oneOf ->"),D.a.createElement("td",null,N()(J).call(J,(function(e,t){return D.a.createElement("div",{key:t},D.a.createElement(q,An()({},y,{required:!1,getComponent:p,specPath:g.push("oneOf",t),getConfigs:f,schema:e,depth:d+1})))})))):null,W?D.a.createElement("tr",null,D.a.createElement("td",null,"not ->"),D.a.createElement("td",null,D.a.createElement("div",null,D.a.createElement(q,An()({},y,{required:!1,getComponent:p,specPath:g.push("not"),getConfigs:f,schema:W,depth:d+1}))))):null))),D.a.createElement("span",{className:"brace-close"},"}")),P.size?N()(r=P.entrySeq()).call(r,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(U,{key:c()(t="".concat(r,"-")).call(t,a),propKey:r,propVal:a,propClass:"property"})})):null)}}]),n}(M.Component),Er=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t=this.props,n=t.getComponent,r=t.getConfigs,a=t.schema,o=t.depth,i=t.expandDepth,s=t.name,u=t.displayName,p=t.specPath,f=a.get("description"),d=a.get("items"),h=a.get("title")||u||s,m=l()(a).call(a,(function(e,t){var n;return-1===Se()(n=["type","items","description","$$ref"]).call(n,t)})),v=n("Markdown",!0),g=n("ModelCollapse"),y=n("Model"),b=n("Property"),E=h&&D.a.createElement("span",{className:"model-title"},D.a.createElement("span",{className:"model-title__text"},h));return D.a.createElement("span",{className:"model"},D.a.createElement(g,{title:E,expanded:o<=i,collapsedContent:"[...]"},"[",m.size?N()(e=m.entrySeq()).call(e,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(b,{key:c()(t="".concat(r,"-")).call(t,a),propKey:r,propVal:a,propClass:"property"})})):null,f?D.a.createElement(v,{source:f}):m.size?D.a.createElement("div",{className:"markdown"}):null,D.a.createElement("span",null,D.a.createElement(y,An()({},this.props,{getConfigs:r,specPath:p.push("items"),name:null,schema:d,required:!1,depth:o+1}))),"]"))}}]),n}(M.Component),xr="property primitive",Sr=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e,t,n,r=this.props,a=r.schema,o=r.getComponent,i=r.getConfigs,s=r.name,u=r.displayName,p=r.depth,f=i().showExtensions;if(!a||!a.get)return D.a.createElement("div",null);var d=a.get("type"),h=a.get("format"),m=a.get("xml"),v=a.get("enum"),g=a.get("title")||u||s,y=a.get("description"),b=Object($.m)(a),E=l()(a).call(a,(function(e,t){var n;return-1===Se()(n=["enum","type","format","description","$$ref"]).call(n,t)})).filterNot((function(e,t){return b.has(t)})),x=o("Markdown",!0),S=o("EnumModel"),w=o("Property");return D.a.createElement("span",{className:"model"},D.a.createElement("span",{className:"prop"},s&&D.a.createElement("span",{className:"".concat(1===p&&"model-title"," prop-name")},g),D.a.createElement("span",{className:"prop-type"},d),h&&D.a.createElement("span",{className:"prop-format"},"($",h,")"),E.size?N()(e=E.entrySeq()).call(e,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(w,{key:c()(t="".concat(r,"-")).call(t,a),propKey:r,propVal:a,propClass:xr})})):null,f&&b.size?N()(t=b.entrySeq()).call(t,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement(w,{key:c()(t="".concat(r,"-")).call(t,a),propKey:r,propVal:a,propClass:xr})})):null,y?D.a.createElement(x,{source:y}):null,m&&m.size?D.a.createElement("span",null,D.a.createElement("br",null),D.a.createElement("span",{className:xr},"xml:"),N()(n=m.entrySeq()).call(n,(function(e){var t,n=gt()(e,2),r=n[0],a=n[1];return D.a.createElement("span",{key:c()(t="".concat(r,"-")).call(t,a),className:xr},D.a.createElement("br",null)," ",r,": ",String(a))})).toArray()):null,v&&D.a.createElement(S,{value:v,getComponent:o})))}}]),n}(M.Component),wr=function(e){var t=e.propKey,n=e.propVal,r=e.propClass;return D.a.createElement("span",{className:r},D.a.createElement("br",null),t,": ",String(n))},jr=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.onTryoutClick,n=e.onCancelClick,r=e.onResetClick,a=e.enabled,o=e.hasUserEditedBody,i=e.isOAS3&&o;return D.a.createElement("div",{className:i?"try-out btn-group":"try-out"},a?D.a.createElement("button",{className:"btn try-out__btn cancel",onClick:n},"Cancel"):D.a.createElement("button",{className:"btn try-out__btn",onClick:t},"Try it out "),i&&D.a.createElement("button",{className:"btn try-out__btn reset",onClick:r},"Reset"))}}]),n}(D.a.Component);y()(jr,"defaultProps",{onTryoutClick:Function.prototype,onCancelClick:Function.prototype,onResetClick:Function.prototype,enabled:!1,hasUserEditedBody:!1,isOAS3:!1});var Or=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.bypass,n=e.isSwagger2,r=e.isOAS3,a=e.alsoShow;return t?D.a.createElement("div",null,this.props.children):n&&r?D.a.createElement("div",{className:"version-pragma"},a,D.a.createElement("div",{className:"version-pragma__message version-pragma__message--ambiguous"},D.a.createElement("div",null,D.a.createElement("h3",null,"Unable to render this definition"),D.a.createElement("p",null,D.a.createElement("code",null,"swagger")," and ",D.a.createElement("code",null,"openapi")," fields cannot be present in the same Swagger or OpenAPI definition. Please remove one of the fields."),D.a.createElement("p",null,"Supported version fields are ",D.a.createElement("code",null,"swagger: ",'"2.0"')," and those that match ",D.a.createElement("code",null,"openapi: 3.0.n")," (for example, ",D.a.createElement("code",null,"openapi: 3.0.0"),").")))):n||r?D.a.createElement("div",null,this.props.children):D.a.createElement("div",{className:"version-pragma"},a,D.a.createElement("div",{className:"version-pragma__message version-pragma__message--missing"},D.a.createElement("div",null,D.a.createElement("h3",null,"Unable to render this definition"),D.a.createElement("p",null,"The provided definition does not specify a valid version field."),D.a.createElement("p",null,"Please indicate a valid Swagger or OpenAPI version field. Supported version fields are ",D.a.createElement("code",null,"swagger: ",'"2.0"')," and those that match ",D.a.createElement("code",null,"openapi: 3.0.n")," (for example, ",D.a.createElement("code",null,"openapi: 3.0.0"),")."))))}}]),n}(D.a.PureComponent);y()(Or,"defaultProps",{alsoShow:null,children:null,bypass:!1});var Cr=function(e){var t=e.version;return D.a.createElement("small",null,D.a.createElement("pre",{className:"version"}," ",t," "))},_r=function(e){var t=e.enabled,n=e.path,r=e.text;return D.a.createElement("a",{className:"nostyle",onClick:t?function(e){return e.preventDefault()}:null,href:t?"#/".concat(n):null},D.a.createElement("span",null,r))},Ar=function(){return D.a.createElement("div",null,D.a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"svg-assets"},D.a.createElement("defs",null,D.a.createElement("symbol",{viewBox:"0 0 20 20",id:"unlocked"},D.a.createElement("path",{d:"M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"})),D.a.createElement("symbol",{viewBox:"0 0 20 20",id:"locked"},D.a.createElement("path",{d:"M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"})),D.a.createElement("symbol",{viewBox:"0 0 20 20",id:"close"},D.a.createElement("path",{d:"M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"})),D.a.createElement("symbol",{viewBox:"0 0 20 20",id:"large-arrow"},D.a.createElement("path",{d:"M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"})),D.a.createElement("symbol",{viewBox:"0 0 20 20",id:"large-arrow-down"},D.a.createElement("path",{d:"M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"})),D.a.createElement("symbol",{viewBox:"0 0 24 24",id:"jump-to"},D.a.createElement("path",{d:"M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"})),D.a.createElement("symbol",{viewBox:"0 0 24 24",id:"expand"},D.a.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})))))},kr=n(174),Ir=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.errSelectors,n=e.specSelectors,r=e.getComponent,a=r("SvgAssets"),o=r("InfoContainer",!0),i=r("VersionPragmaFilter"),s=r("operations",!0),c=r("Models",!0),u=r("Row"),l=r("Col"),p=r("errors",!0),f=r("ServersContainer",!0),d=r("SchemesContainer",!0),h=r("AuthorizeBtnContainer",!0),m=r("FilterContainer",!0),v=n.isSwagger2(),g=n.isOAS3(),y=!n.specStr(),b=n.loadingStatus(),E=null;if("loading"===b&&(E=D.a.createElement("div",{className:"info"},D.a.createElement("div",{className:"loading-container"},D.a.createElement("div",{className:"loading"})))),"failed"===b&&(E=D.a.createElement("div",{className:"info"},D.a.createElement("div",{className:"loading-container"},D.a.createElement("h4",{className:"title"},"Failed to load API definition."),D.a.createElement(p,null)))),"failedConfig"===b){var x=t.lastError(),S=x?x.get("message"):"";E=D.a.createElement("div",{className:"info failed-config"},D.a.createElement("div",{className:"loading-container"},D.a.createElement("h4",{className:"title"},"Failed to load remote configuration."),D.a.createElement("p",null,S)))}if(!E&&y&&(E=D.a.createElement("h4",null,"No API definition provided.")),E)return D.a.createElement("div",{className:"swagger-ui"},D.a.createElement("div",{className:"loading-container"},E));var w=n.servers(),j=n.schemes(),O=w&&w.size,C=j&&j.size,_=!!n.securityDefinitions();return D.a.createElement("div",{className:"swagger-ui"},D.a.createElement(a,null),D.a.createElement(i,{isSwagger2:v,isOAS3:g,alsoShow:D.a.createElement(p,null)},D.a.createElement(p,null),D.a.createElement(u,{className:"information-container"},D.a.createElement(l,{mobile:12},D.a.createElement(o,null))),O||C||_?D.a.createElement("div",{className:"scheme-container"},D.a.createElement(l,{className:"schemes wrapper",mobile:12},O?D.a.createElement(f,null):null,C?D.a.createElement(d,null):null,_?D.a.createElement(h,null):null)):null,D.a.createElement(m,null),D.a.createElement(u,null,D.a.createElement(l,{mobile:12,desktop:12},D.a.createElement(s,null))),D.a.createElement(u,null,D.a.createElement(l,{mobile:12,desktop:12},D.a.createElement(c,null)))))}}]),n}(D.a.Component),Pr=n(279),Tr=n.n(Pr),Rr={value:"",onChange:function(){},schema:{},keyName:"",required:!1,errors:Object(B.List)()},Nr=function(e){ye()(n,e);var t=Ee()(n);function n(){return E()(this,n),t.apply(this,arguments)}return S()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.dispatchInitialValue,n=e.value,r=e.onChange;t&&r(n)}},{key:"render",value:function(){var e,t=this.props,n=t.schema,r=t.errors,a=t.value,o=t.onChange,i=t.getComponent,s=t.fn,u=t.disabled,l=n&&n.get?n.get("format"):null,p=n&&n.get?n.get("type"):null,f=function(e){return i(e,!1,{failSilently:!0})},d=p?f(l?c()(e="JsonSchema_".concat(p,"_")).call(e,l):"JsonSchema_".concat(p)):i("JsonSchema_string");return d||(d=i("JsonSchema_string")),D.a.createElement(d,An()({},this.props,{errors:r,fn:s,getComponent:i,value:a,onChange:o,schema:n,disabled:u}))}}]),n}(M.Component);y()(Nr,"defaultProps",Rr);var Mr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onChange",(function(e){var t=r.props.schema&&"file"===r.props.schema.get("type")?e.target.files[0]:e.target.value;r.props.onChange(t,r.props.keyName)})),y()(ve()(r),"onEnumChange",(function(e){return r.props.onChange(e)})),r}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.getComponent,n=e.value,r=e.schema,a=e.errors,o=e.required,i=e.description,s=e.disabled,c=r&&r.get?r.get("enum"):null,u=r&&r.get?r.get("format"):null,l=r&&r.get?r.get("type"):null,p=r&&r.get?r.get("in"):null;if(n||(n=""),a=a.toJS?a.toJS():[],c){var f=t("Select");return D.a.createElement(f,{className:a.length?"invalid":"",title:a.length?a:"",allowedValues:c,value:n,allowEmptyValue:!o,disabled:s,onChange:this.onEnumChange})}var d=s||p&&"formData"===p&&!("FormData"in window),h=t("Input");return l&&"file"===l?D.a.createElement(h,{type:"file",className:a.length?"invalid":"",title:a.length?a:"",onChange:this.onChange,disabled:d}):D.a.createElement(Tr.a,{type:u&&"password"===u?"password":"text",className:a.length?"invalid":"",title:a.length?a:"",value:n,minLength:0,debounceTimeout:350,placeholder:i,onChange:this.onChange,disabled:d})}}]),n}(M.Component);y()(Mr,"defaultProps",Rr);var Dr=function(e){ye()(n,e);var t=Ee()(n);function n(e,r){var a;return E()(this,n),a=t.call(this,e,r),y()(ve()(a),"onChange",(function(){a.props.onChange(a.state.value)})),y()(ve()(a),"onItemChange",(function(e,t){a.setState((function(n){return{value:n.value.set(t,e)}}),a.onChange)})),y()(ve()(a),"removeItem",(function(e){a.setState((function(t){return{value:t.value.delete(e)}}),a.onChange)})),y()(ve()(a),"addItem",(function(){var e=zr(a.state.value);a.setState((function(){return{value:e.push(Object($.o)(a.state.schema.get("items"),!1,{includeWriteOnly:!0}))}}),a.onChange)})),y()(ve()(a),"onEnumChange",(function(e){a.setState((function(){return{value:e}}),a.onChange)})),a.state={value:zr(e.value),schema:e.schema},a}return S()(n,[{key:"componentWillReceiveProps",value:function(e){var t=zr(e.value);t!==this.state.value&&this.setState({value:t}),e.schema!==this.state.schema&&this.setState({schema:e.schema})}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.getComponent,a=n.required,o=n.schema,i=n.errors,s=n.fn,u=n.disabled;i=i.toJS?i.toJS():I()(i)?i:[];var p,f,d=l()(i).call(i,(function(e){return"string"==typeof e})),h=N()(e=l()(i).call(i,(function(e){return void 0!==e.needRemove}))).call(e,(function(e){return e.error})),m=this.state.value,v=!!(m&&m.count&&m.count()>0),g=o.getIn(["items","enum"]),y=o.getIn(["items","type"]),b=o.getIn(["items","format"]),E=o.get("items"),x=!1,S="file"===y||"string"===y&&"binary"===b;y&&b?p=r(c()(f="JsonSchema_".concat(y,"_")).call(f,b)):"boolean"!==y&&"array"!==y&&"object"!==y||(p=r("JsonSchema_".concat(y)));if(p||S||(x=!0),g){var w=r("Select");return D.a.createElement(w,{className:i.length?"invalid":"",title:i.length?i:"",multiple:!0,value:m,disabled:u,allowedValues:g,allowEmptyValue:!a,onChange:this.onEnumChange})}var j=r("Button");return D.a.createElement("div",{className:"json-schema-array"},v?N()(m).call(m,(function(e,n){var a,o=Object(B.fromJS)(sn()(N()(a=l()(i).call(i,(function(e){return e.index===n}))).call(a,(function(e){return e.error}))));return D.a.createElement("div",{key:n,className:"json-schema-form-item"},S?D.a.createElement(Br,{value:e,onChange:function(e){return t.onItemChange(e,n)},disabled:u,errors:o,getComponent:r}):x?D.a.createElement(qr,{value:e,onChange:function(e){return t.onItemChange(e,n)},disabled:u,errors:o}):D.a.createElement(p,An()({},t.props,{value:e,onChange:function(e){return t.onItemChange(e,n)},disabled:u,errors:o,schema:E,getComponent:r,fn:s})),u?null:D.a.createElement(j,{className:"btn btn-sm json-schema-form-item-remove ".concat(h.length?"invalid":null),title:h.length?h:"",onClick:function(){return t.removeItem(n)}}," - "))})):null,u?null:D.a.createElement(j,{className:"btn btn-sm json-schema-form-item-add ".concat(d.length?"invalid":null),title:d.length?d:"",onClick:this.addItem},"Add ",y?"".concat(y," "):"","item"))}}]),n}(M.PureComponent);y()(Dr,"defaultProps",Rr);var qr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onChange",(function(e){var t=e.target.value;r.props.onChange(t,r.props.keyName)})),r}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.value,n=e.errors,r=e.description,a=e.disabled;return t||(t=""),n=n.toJS?n.toJS():[],D.a.createElement(Tr.a,{type:"text",className:n.length?"invalid":"",title:n.length?n:"",value:t,minLength:0,debounceTimeout:350,placeholder:r,onChange:this.onChange,disabled:a})}}]),n}(M.Component);y()(qr,"defaultProps",Rr);var Br=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onFileChange",(function(e){var t=e.target.files[0];r.props.onChange(t,r.props.keyName)})),r}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.getComponent,n=e.errors,r=e.disabled,a=t("Input"),o=r||!("FormData"in window);return D.a.createElement(a,{type:"file",className:n.length?"invalid":"",title:n.length?n:"",onChange:this.onFileChange,disabled:o})}}]),n}(M.Component);y()(Br,"defaultProps",Rr);var Lr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e,r;E()(this,n);for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=t.call.apply(t,c()(e=[this]).call(e,o)),y()(ve()(r),"onEnumChange",(function(e){return r.props.onChange(e)})),r}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.getComponent,n=e.value,r=e.errors,a=e.schema,o=e.required,i=e.disabled;r=r.toJS?r.toJS():[];var s=a&&a.get?a.get("enum"):null,c=!s||!o,u=!s&&Object(B.fromJS)(["true","false"]),l=t("Select");return D.a.createElement(l,{className:r.length?"invalid":"",title:r.length?r:"",value:String(n),disabled:i,allowedValues:s||u,allowEmptyValue:c,onChange:this.onEnumChange})}}]),n}(M.Component);y()(Lr,"defaultProps",Rr);var Ur=function(e){return N()(e).call(e,(function(e){var t,n=void 0!==e.propKey?e.propKey:e.index,r="string"==typeof e?e:"string"==typeof e.error?e.error:null;if(!n&&r)return r;for(var a=e.error,o="/".concat(e.propKey);"object"===i()(a);){var s=void 0!==a.propKey?a.propKey:a.index;if(void 0===s)break;if(o+="/".concat(s),!a.error)break;a=a.error}return c()(t="".concat(o,": ")).call(t,a)}))},Vr=function(e){ye()(n,e);var t=Ee()(n);function n(){var e;return E()(this,n),e=t.call(this),y()(ve()(e),"onChange",(function(t){e.props.onChange(t)})),y()(ve()(e),"handleOnChange",(function(t){var n=t.target.value;e.onChange(n)})),e}return S()(n,[{key:"render",value:function(){var e=this.props,t=e.getComponent,n=e.value,r=e.errors,a=e.disabled,o=t("TextArea");return r=r.toJS?r.toJS():I()(r)?r:[],D.a.createElement("div",null,D.a.createElement(o,{className:Kt()({invalid:r.length}),title:r.length?Ur(r).join(", "):"",value:Object($.J)(n),disabled:a,onChange:this.handleOnChange}))}}]),n}(M.PureComponent);function zr(e){return B.List.isList(e)?e:I()(e)?Object(B.fromJS)(e):Object(B.List)()}y()(Vr,"defaultProps",Rr);var Fr=function(){var e={components:{App:Oe,authorizationPopup:Ce,authorizeBtn:_e,AuthorizeBtnContainer:Ae,authorizeOperationBtn:ke,auths:Ie,AuthItem:Pe,authError:Te,oauth2:Ke,apiKeyAuth:Re,basicAuth:Ne,clear:Ge,liveResponse:Qe,InitializedInput:$n,info:Xn,InfoContainer:Qn,JumpToPath:er,onlineValidatorBadge:et.a,operations:rt,operation:lt,OperationSummary:dt,OperationSummaryMethod:ht,OperationSummaryPath:mt,highlightCode:zt,responses:Ft,response:Gt,ResponseExtension:Zt,responseBody:an,parameters:ln,parameterRow:mn,execute:En,headers:xn,errors:Sn,contentType:Cn,overview:Wn,footer:tr,FilterContainer:nr,ParamBody:ar,curl:lr,schemes:pr,SchemesContainer:fr,modelExample:hr,ModelWrapper:mr,ModelCollapse:dr,Model:vr.a,Models:gr,EnumModel:yr,ObjectModel:br,ArrayModel:Er,PrimitiveModel:Sr,Property:wr,TryItOutButton:jr,Markdown:kr.a,BaseLayout:Ir,VersionPragmaFilter:Or,VersionStamp:Cr,OperationExt:yt,OperationExtRow:bt,ParameterExt:pn,ParameterIncludeEmpty:dn,OperationTag:ut,OperationContainer:je,DeepLink:_r,InfoUrl:Zn,InfoBasePath:Yn,SvgAssets:Ar,Example:Me,ExamplesSelect:Be,ExamplesSelectValueRetainer:Ue}},t={components:r},n={components:a};return[pe.default,ue.default,ie.default,ae.default,re.default,te.default,ne.default,oe.default,e,t,se.default,n,ce.default,le.default,fe.default,de.default,he.default]},Jr=n(245);function Wr(){return[Fr,Jr.default]}var Hr=n(266);var $r=!0,Yr="g49172eb",Kr="3.44.1",Gr="ip-172-31-21-173",Zr="Thu, 04 Mar 2021 18:12:15 GMT";function Xr(e){var t;H.a.versions=H.a.versions||{},H.a.versions.swaggerUi={version:Kr,gitRevision:Yr,gitDirty:$r,buildTimestamp:Zr,machine:Gr};var n={dom_id:null,domNode:null,spec:{},url:"",urls:null,layout:"BaseLayout",docExpansion:"list",maxDisplayedTags:null,filter:null,validatorUrl:"https://validator.swagger.io/validator",oauth2RedirectUrl:c()(t="".concat(window.location.protocol,"//")).call(t,window.location.host,"/oauth2-redirect.html"),persistAuthorization:!1,configs:{},custom:{},displayOperationId:!1,displayRequestDuration:!1,deepLinking:!1,tryItOutEnabled:!1,requestInterceptor:function(e){return e},responseInterceptor:function(e){return e},showMutatedRequest:!0,defaultModelRendering:"example",defaultModelExpandDepth:1,defaultModelsExpandDepth:1,showExtensions:!1,showCommonExtensions:!1,withCredentials:void 0,supportedSubmitMethods:["get","put","post","delete","options","head","patch","trace"],presets:[Wr],plugins:[],initialState:{},fn:{},components:{},syntaxHighlight:{activated:!0,theme:"agate"}},r=Object($.D)(),a=e.domNode;delete e.domNode;var o=v()({},n,e,r),s={system:{configs:o.configs},plugins:o.presets,state:v()({layout:{layout:o.layout,filter:l()(o)},spec:{spec:"",url:o.url}},o.initialState)};if(o.initialState)for(var u in o.initialState)o.initialState.hasOwnProperty(u)&&void 0===o.initialState[u]&&delete s.state[u];var p=new K(s);p.register([o.plugins,function(){return{fn:o.fn,components:o.components,state:o.state}}]);var d=p.getSystem(),m=function(e){var t=d.specSelectors.getLocalConfig?d.specSelectors.getLocalConfig():{},n=v()({},t,o,e||{},r);if(a&&(n.domNode=a),p.setConfigs(n),d.configsActions.loaded(),null!==e&&(!r.url&&"object"===i()(n.spec)&&f()(n.spec).length?(d.specActions.updateUrl(""),d.specActions.updateLoadingStatus("success"),d.specActions.updateSpec(h()(n.spec))):d.specActions.download&&n.url&&!n.urls&&(d.specActions.updateUrl(n.url),d.specActions.download(n.url))),n.domNode)d.render(n.domNode,"App");else if(n.dom_id){var s=document.querySelector(n.dom_id);d.render(s,"App")}else null===n.dom_id||null===n.domNode||console.error("Skipped rendering: no `dom_id` or `domNode` was specified");return d},g=r.config||o.configUrl;return g&&d.specActions&&d.specActions.getConfigByUrl?(d.specActions.getConfigByUrl({url:g,loadRemoteConfig:!0,requestInterceptor:o.requestInterceptor,responseInterceptor:o.responseInterceptor},m),d):m()}Xr.presets={apis:Wr},Xr.plugins=Hr.default;t.default=Xr}]).default;
//# sourceMappingURL=swagger-ui-es-bundle-core.js.map |
src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js | panhongzhi02/react | /**
* Copyright 2013-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.
*
* @emails react-core
*/
'use strict';
var React;
var ReactCSSTransitionGroup;
// Most of the real functionality is covered in other unit tests, this just
// makes sure we're wired up correctly.
describe('ReactCSSTransitionGroup', function() {
var container;
beforeEach(function() {
React = require('React');
ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
container = document.createElement('div');
spyOn(console, 'error');
});
it('should warn after time with no transitionend', function() {
var a = React.render(
<ReactCSSTransitionGroup transitionName="yolo">
<span key="one" id="one" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(1);
setTimeout.mock.calls.length = 0;
React.render(
<ReactCSSTransitionGroup transitionName="yolo">
<span key="two" id="two" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(2);
expect(React.findDOMNode(a).childNodes[0].id).toBe('two');
expect(React.findDOMNode(a).childNodes[1].id).toBe('one');
// For some reason jst is adding extra setTimeout()s and grunt test isn't,
// so we need to do this disgusting hack.
for (var i = 0; i < setTimeout.mock.calls.length; i++) {
if (setTimeout.mock.calls[i][1] === 5000) {
setTimeout.mock.calls[i][0]();
break;
}
}
expect(React.findDOMNode(a).childNodes.length).toBe(2);
expect(console.error.argsForCall.length).toBe(1);
});
it('should keep both sets of DOM nodes around', function() {
var a = React.render(
<ReactCSSTransitionGroup transitionName="yolo">
<span key="one" id="one" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(1);
React.render(
<ReactCSSTransitionGroup transitionName="yolo">
<span key="two" id="two" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(2);
expect(React.findDOMNode(a).childNodes[0].id).toBe('two');
expect(React.findDOMNode(a).childNodes[1].id).toBe('one');
});
it('should switch transitionLeave from false to true', function() {
var a = React.render(
<ReactCSSTransitionGroup
transitionName="yolo"
transitionEnter={false}
transitionLeave={false}>
<span key="one" id="one" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(1);
React.render(
<ReactCSSTransitionGroup
transitionName="yolo"
transitionEnter={false}
transitionLeave={false}>
<span key="two" id="two" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(1);
React.render(
<ReactCSSTransitionGroup
transitionName="yolo"
transitionEnter={false}
transitionLeave={true}>
<span key="three" id="three" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(2);
expect(React.findDOMNode(a).childNodes[0].id).toBe('three');
expect(React.findDOMNode(a).childNodes[1].id).toBe('two');
});
it('should work with no children', function() {
React.render(
<ReactCSSTransitionGroup transitionName="yolo" />,
container
);
});
it('should work with a null child', function() {
React.render(
<ReactCSSTransitionGroup transitionName="yolo">
{[null]}
</ReactCSSTransitionGroup>,
container
);
});
it('should transition from one to null', function() {
var a = React.render(
<ReactCSSTransitionGroup transitionName="yolo">
<span key="one" id="one" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(1);
React.render(
<ReactCSSTransitionGroup transitionName="yolo">
{null}
</ReactCSSTransitionGroup>,
container
);
// (Here, we expect the original child to stick around but test that no
// exception is thrown)
expect(React.findDOMNode(a).childNodes.length).toBe(1);
expect(React.findDOMNode(a).childNodes[0].id).toBe('one');
});
it('should transition from false to one', function() {
var a = React.render(
<ReactCSSTransitionGroup transitionName="yolo">
{false}
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(0);
React.render(
<ReactCSSTransitionGroup transitionName="yolo">
<span key="one" id="one" />
</ReactCSSTransitionGroup>,
container
);
expect(React.findDOMNode(a).childNodes.length).toBe(1);
expect(React.findDOMNode(a).childNodes[0].id).toBe('one');
});
});
|
src/app/Translator.js | TimCliff/steemit.com | import React from 'react';
import { connect } from 'react-redux';
import { IntlProvider, addLocaleData } from 'react-intl';
import en from 'react-intl/locale-data/en';
import es from 'react-intl/locale-data/es';
import ru from 'react-intl/locale-data/ru';
import fr from 'react-intl/locale-data/fr';
import it from 'react-intl/locale-data/it';
import ko from 'react-intl/locale-data/ko';
import zh from 'react-intl/locale-data/zh';
import pl from 'react-intl/locale-data/pl';
import ja from 'react-intl/locale-data/ja';
import { DEFAULT_LANGUAGE } from 'app/client_config';
import tt from 'counterpart';
addLocaleData([...en, ...es, ...ru, ...fr, ...it, ...ko, ...zh, ...pl, ...ja]);
tt.registerTranslations('en', require('counterpart/locales/en'));
tt.registerTranslations('en', require('app/locales/en.json'));
tt.registerTranslations('es', require('app/locales/counterpart/es'));
tt.registerTranslations('es', require('app/locales/es.json'));
tt.registerTranslations('ru', require('counterpart/locales/ru'));
tt.registerTranslations('ru', require('app/locales/ru.json'));
tt.registerTranslations('fr', require('app/locales/counterpart/fr'));
tt.registerTranslations('fr', require('app/locales/fr.json'));
tt.registerTranslations('it', require('app/locales/counterpart/it'));
tt.registerTranslations('it', require('app/locales/it.json'));
tt.registerTranslations('ko', require('app/locales/counterpart/ko'));
tt.registerTranslations('ko', require('app/locales/ko.json'));
tt.registerTranslations('zh', require('app/locales/counterpart/zh'));
tt.registerTranslations('zh', require('app/locales/zh.json'));
tt.registerTranslations('pl', require('app/locales/counterpart/pl'));
tt.registerTranslations('pl', require('app/locales/pl.json'));
tt.registerTranslations('ja', require('app/locales/counterpart/ja'));
tt.registerTranslations('ja', require('app/locales/ja.json'));
if (process.env.NODE_ENV === 'production') {
tt.setFallbackLocale('en');
}
class Translator extends React.Component {
render() {
const language = this.props.locale;
tt.setLocale(language);
return (
<IntlProvider
// to ensure dynamic language change, "key" property with same "locale" info must be added
// see: https://github.com/yahoo/react-intl/wiki/Components#multiple-intl-contexts
key={language}
locale={language}
defaultLocale={DEFAULT_LANGUAGE}
>
{this.props.children}
</IntlProvider>
);
}
}
export default connect((state, ownProps) => {
const locale = state.app.getIn(['user_preferences', 'locale']);
return { ...ownProps, locale };
})(Translator);
export const FormattedHTMLMessage = ({ id, params, className }) => (
<div
className={'FormattedHTMLMessage' + (className ? ` ${className}` : '')}
dangerouslySetInnerHTML={{ __html: tt(id, params) }}
/>
);
|
ajax/libs/react/0.5.1/react-with-addons.js | jtangelder/cdnjs | /**
* React (with addons) v0.5.1
*/
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.React=e():"undefined"!=typeof global?global.React=e():"undefined"!=typeof self&&(self.React=e())}(function(){var define,module,exports;
return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule $
* @typechecks
*/
var ge = require("./ge");
var ex = require("./ex");
/**
* Find a node by ID.
*
* If your application code depends on the existence of the element, use $,
* which will throw if the element doesn't exist.
*
* If you're not sure whether or not the element exists, use ge instead, and
* manually check for the element's existence in your application code.
*
* @param {string|DOMDocument|DOMElement|DOMTextNode|Comment} id
* @return {DOMDocument|DOMElement|DOMTextNode|Comment}
*/
function $(id) {
var element = ge(id);
if (!element) {
throw new Error(ex(
'Tried to get element with id of "%s" but it is not present on the page.',
id
));
}
return element;
}
module.exports = $;
},{"./ex":94,"./ge":98}],2:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CSSCore
* @typechecks
*/
var invariant = require("./invariant");
/**
* The CSSCore module specifies the API (and implements most of the methods)
* that should be used when dealing with the display of elements (via their
* CSS classes and visibility on screeni. It is an API focused on mutating the
* display and not reading it as no logical state should be encoded in the
* display of elements.
*/
/**
* Tests whether the element has the class specified.
*
* Note: This function is not exported in CSSCore because CSS classNames should
* not store any logical information about the element. Use DataStore to store
* information on an element.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @returns {boolean} true if the element has the class, false if not
*/
function hasClass(element, className) {
if (element.classList) {
return !!className && element.classList.contains(className);
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
}
var CSSCore = {
/**
* Adds the class passed in to the element if it doesn't already have it.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
addClass: function(element, className) {
invariant(
!/\s/.test(className),
'CSSCore.addClass takes only a single class name. "%s" contains ' +
'multiple classes.', className
);
if (className) {
if (element.classList) {
element.classList.add(className);
} else if (!hasClass(element, className)) {
element.className = element.className + ' ' + className;
}
}
return element;
},
/**
* Removes the class passed in from the element
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
removeClass: function(element, className) {
invariant(
!/\s/.test(className),
'CSSCore.removeClass takes only a single class name. "%s" contains ' +
'multiple classes.', className
);
if (className) {
if (element.classList) {
element.classList.remove(className);
} else if (hasClass(element, className)) {
element.className = element.className
.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
.replace(/\s+/g, ' ') // multiple spaces to one
.replace(/^\s*|\s*$/g, ''); // trim the ends
}
}
return element;
},
/**
* Helper to add or remove a class from an element based on a condition.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @param {*} bool condition to whether to add or remove the class
* @return {DOMElement} the element passed in
*/
conditionClass: function(element, className, bool) {
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
}
};
module.exports = CSSCore;
},{"./invariant":106}],3:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CSSProperty
*/
"use strict";
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
fillOpacity: true,
fontWeight: true,
lineHeight: true,
opacity: true,
orphans: true,
zIndex: true,
zoom: true
};
/**
* 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: {
backgroundImage: true,
backgroundPosition: true,
backgroundRepeat: true,
backgroundColor: 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
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
},{}],4:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CSSPropertyOperations
* @typechecks static-only
*/
"use strict";
var CSSProperty = require("./CSSProperty");
var dangerousStyleValue = require("./dangerousStyleValue");
var escapeTextForBrowser = require("./escapeTextForBrowser");
var hyphenate = require("./hyphenate");
var memoizeStringOnly = require("./memoizeStringOnly");
var processStyleName = memoizeStringOnly(function(styleName) {
return escapeTextForBrowser(hyphenate(styleName));
});
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
*
* @param {object} styles
* @return {?string}
*/
createMarkupForStyles: function(styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
*/
setValueForStyles: function(node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
module.exports = CSSPropertyOperations;
},{"./CSSProperty":3,"./dangerousStyleValue":91,"./escapeTextForBrowser":93,"./hyphenate":105,"./memoizeStringOnly":114}],5:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CallbackRegistry
* @typechecks static-only
*/
"use strict";
var listenerBank = {};
/**
* Stores "listeners" by `registrationName`/`id`. There should be at most one
* "listener" per `registrationName`/`id` in the `listenerBank`.
*
* Access listeners via `listenerBank[registrationName][id]`.
*
* @class CallbackRegistry
* @internal
*/
var CallbackRegistry = {
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
putListener: function(id, registrationName, listener) {
var bankForRegistrationName =
listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
},
/**
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function(id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
/**
* Deletes a listener from the registration bank.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function(id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {string} id ID of the DOM element.
*/
deleteAllListeners: function(id) {
for (var registrationName in listenerBank) {
delete listenerBank[registrationName][id];
}
},
/**
* This is needed for tests only. Do not use!
*/
__purge: function() {
listenerBank = {};
}
};
module.exports = CallbackRegistry;
},{}],6:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ChangeEventPlugin
*/
"use strict";
var EventConstants = require("./EventConstants");
var EventPluginHub = require("./EventPluginHub");
var EventPropagators = require("./EventPropagators");
var ExecutionEnvironment = require("./ExecutionEnvironment");
var SyntheticEvent = require("./SyntheticEvent");
var isEventSupported = require("./isEventSupported");
var isTextInputElement = require("./isTextInputElement");
var keyOf = require("./keyOf");
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: keyOf({onChange: null}),
captured: keyOf({onChangeCapture: null})
}
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementID = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
return (
elem.nodeName === 'SELECT' ||
(elem.nodeName === 'INPUT' && elem.type === 'file')
);
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (
!('documentMode' in document) || document.documentMode > 8
);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
activeElementID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change bubbled, we'd just bind to it like all the other events
// and have it go through ReactEventTopLevelCallback. Since it doesn't, we
// manually listen for the change event and so we have to enqueue and
// process the abstract event manually.
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue();
}
function startWatchingForChangeEventIE8(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementID = null;
}
function getTargetIDForChangeEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
function handleEventsForChangeEventIE8(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
isInputEventSupported = isEventSupported('input') && (
!('documentMode' in document) || document.documentMode > 9
);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function() {
return activeElementValueProp.get.call(this);
},
set: function(val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For old IE.) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(
target.constructor.prototype,
'value'
);
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
/**
* (For old IE.) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementID = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For old IE.) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetIDForInputEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return topLevelTargetID;
}
}
// For IE8 and IE9.
function handleEventsForInputEventIE(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetIDForInputEventIE(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topSelectionChange ||
topLevelType === topLevelTypes.topKeyUp ||
topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementID;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return (
elem.nodeName === 'INPUT' &&
(elem.type === 'checkbox' || elem.type === 'radio')
);
}
function getTargetIDForClickEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
if (doesChangeEventBubble) {
getTargetIDFunc = getTargetIDForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(topLevelTarget)) {
if (isInputEventSupported) {
getTargetIDFunc = getTargetIDForInputEvent;
} else {
getTargetIDFunc = getTargetIDForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(topLevelTarget)) {
getTargetIDFunc = getTargetIDForClickEvent;
}
if (getTargetIDFunc) {
var targetID = getTargetIDFunc(
topLevelType,
topLevelTarget,
topLevelTargetID
);
if (targetID) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
targetID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(
topLevelType,
topLevelTarget,
topLevelTargetID
);
}
}
};
module.exports = ChangeEventPlugin;
},{"./EventConstants":15,"./EventPluginHub":17,"./EventPropagators":20,"./ExecutionEnvironment":21,"./SyntheticEvent":75,"./isEventSupported":107,"./isTextInputElement":109,"./keyOf":113}],7:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CompositionEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = require("./EventConstants");
var EventPropagators = require("./EventPropagators");
var ExecutionEnvironment = require("./ExecutionEnvironment");
var ReactInputSelection = require("./ReactInputSelection");
var SyntheticCompositionEvent = require("./SyntheticCompositionEvent");
var getTextContentAccessor = require("./getTextContentAccessor");
var keyOf = require("./keyOf");
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var useCompositionEvent = ExecutionEnvironment.canUseDOM &&
'CompositionEvent' in window;
var topLevelTypes = EventConstants.topLevelTypes;
var currentComposition = null;
// Events and their corresponding property names.
var eventTypes = {
compositionEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionEnd: null}),
captured: keyOf({onCompositionEndCapture: null})
}
},
compositionStart: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionStart: null}),
captured: keyOf({onCompositionStartCapture: null})
}
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionUpdate: null}),
captured: keyOf({onCompositionUpdateCapture: null})
}
}
};
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case topLevelTypes.topCompositionStart:
return eventTypes.compositionStart;
case topLevelTypes.topCompositionEnd:
return eventTypes.compositionEnd;
case topLevelTypes.topCompositionUpdate:
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackStart(topLevelType, nativeEvent) {
return (
topLevelType === topLevelTypes.topKeyDown &&
nativeEvent.keyCode === START_KEYCODE
);
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return (nativeEvent.keyCode !== START_KEYCODE);
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Helper class stores information about selection and document state
* so we can figure out what changed at a later date.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this.root = root;
this.startSelection = ReactInputSelection.getSelection(root);
this.startValue = this.getText();
}
/**
* Get current text of input.
*
* @return {string}
*/
FallbackCompositionState.prototype.getText = function() {
return this.root.value || this.root[getTextContentAccessor()];
};
/**
* Text that has changed since the start of composition.
*
* @return {string}
*/
FallbackCompositionState.prototype.getData = function() {
var endValue = this.getText();
var prefixLength = this.startSelection.start;
var suffixLength = this.startValue.length - this.startSelection.end;
return endValue.substr(
prefixLength,
endValue.length - suffixLength - prefixLength
);
};
/**
* This plugin creates `onCompositionStart`, `onCompositionUpdate` and
* `onCompositionEnd` events on inputs, textareas and contentEditable
* nodes.
*/
var CompositionEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var eventType;
var data;
if (useCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackStart(topLevelType, nativeEvent)) {
eventType = eventTypes.start;
currentComposition = new FallbackCompositionState(topLevelTarget);
}
} else if (isFallbackEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
data = currentComposition.getData();
currentComposition = null;
}
if (eventType) {
var event = SyntheticCompositionEvent.getPooled(
eventType,
topLevelTargetID,
nativeEvent
);
if (data) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = data;
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
};
module.exports = CompositionEventPlugin;
},{"./EventConstants":15,"./EventPropagators":20,"./ExecutionEnvironment":21,"./ReactInputSelection":49,"./SyntheticCompositionEvent":74,"./getTextContentAccessor":104,"./keyOf":113}],8:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DOMChildrenOperations
* @typechecks static-only
*/
"use strict";
var Danger = require("./Danger");
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
var getTextContentAccessor = require("./getTextContentAccessor");
/**
* The DOM property to use when setting text content.
*
* @type {string}
* @private
*/
var textContentAccessor = getTextContentAccessor() || 'NA';
/**
* 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
*/
function insertChildAt(parentNode, childNode, index) {
var childNodes = parentNode.childNodes;
if (childNodes[index] === childNode) {
return;
}
// If `childNode` is already a child of `parentNode`, remove it so that
// computing `childNodes[index]` takes into account the removal.
if (childNode.parentNode === parentNode) {
parentNode.removeChild(childNode);
}
if (index >= childNodes.length) {
parentNode.appendChild(childNode);
} else {
parentNode.insertBefore(childNode, childNodes[index]);
}
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
/**
* 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.
* @param {array<string>} markupList List of markup strings.
* @internal
*/
processUpdates: function(updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
// List of children that will be moved or removed.
var updatedChildren = null;
for (var i = 0; update = updates[i]; i++) {
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;
updatedChildren = updatedChildren || [];
updatedChildren.push(updatedChild);
}
}
var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
for (var j = 0; j < updatedChildren.length; j++) {
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
}
}
for (var k = 0; update = updates[k]; k++) {
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
insertChildAt(
update.parentNode,
renderedMarkup[update.markupIndex],
update.toIndex
);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
insertChildAt(
update.parentNode,
initialChildren[update.parentID][update.fromIndex],
update.toIndex
);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
update.parentNode[textContentAccessor] = update.textContent;
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
break;
}
}
}
};
module.exports = DOMChildrenOperations;
},{"./Danger":11,"./ReactMultiChildUpdateTypes":56,"./getTextContentAccessor":104}],9:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
/*jslint bitwise: true */
"use strict";
var invariant = require("./invariant");
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_ATTRIBUTE: 0x1,
MUST_USE_PROPERTY: 0x2,
HAS_BOOLEAN_VALUE: 0x4,
HAS_SIDE_EFFECTS: 0x8,
/**
* 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.
*
* 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(domPropertyConfig) {
var Properties = domPropertyConfig.Properties || {};
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) {
invariant(
!DOMProperty.isStandardName[propName],
'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
);
DOMProperty.isStandardName[propName] = true;
var lowerCased = propName.toLowerCase();
DOMProperty.getPossibleStandardName[lowerCased] = propName;
var attributeName = DOMAttributeNames[propName];
if (attributeName) {
DOMProperty.getPossibleStandardName[attributeName] = propName;
}
DOMProperty.getAttributeName[propName] = attributeName || lowerCased;
DOMProperty.getPropertyName[propName] =
DOMPropertyNames[propName] || propName;
var mutationMethod = DOMMutationMethods[propName];
if (mutationMethod) {
DOMProperty.getMutationMethod[propName] = mutationMethod;
}
var propConfig = Properties[propName];
DOMProperty.mustUseAttribute[propName] =
propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE;
DOMProperty.mustUseProperty[propName] =
propConfig & DOMPropertyInjection.MUST_USE_PROPERTY;
DOMProperty.hasBooleanValue[propName] =
propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;
DOMProperty.hasSideEffects[propName] =
propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;
invariant(
!DOMProperty.mustUseAttribute[propName] ||
!DOMProperty.mustUseProperty[propName],
'DOMProperty: Cannot use require using both attribute and property: %s',
propName
);
invariant(
DOMProperty.mustUseProperty[propName] ||
!DOMProperty.hasSideEffects[propName],
'DOMProperty: Properties that have side effects must use property: %s',
propName
);
}
}
};
var defaultValueCache = {};
/**
* 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 = {
/**
* Checks whether a property name is a standard property.
* @type {Object}
*/
isStandardName: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties.
* @type {Object}
*/
getPossibleStandardName: {},
/**
* Mapping from normalized names to attribute names that differ. Attribute
* names are used when rendering markup or with `*Attribute()`.
* @type {Object}
*/
getAttributeName: {},
/**
* Mapping from normalized names to properties on DOM node instances.
* (This includes properties that mutate due to external factors.)
* @type {Object}
*/
getPropertyName: {},
/**
* Mapping from normalized names to mutation methods. This will only exist if
* mutation cannot be set simply by the property or `setAttribute()`.
* @type {Object}
*/
getMutationMethod: {},
/**
* Whether the property must be accessed and mutated as an object property.
* @type {Object}
*/
mustUseAttribute: {},
/**
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* @type {Object}
*/
mustUseProperty: {},
/**
* Whether the property should be removed when set to a falsey value.
* @type {Object}
*/
hasBooleanValue: {},
/**
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. We must ensure that
* the value is only set if it has changed.
* @type {Object}
*/
hasSideEffects: {},
/**
* All of the isCustomAttribute() functions that have been injected.
*/
_isCustomAttributeFunctions: [],
/**
* Checks whether a property name is a custom attribute.
* @method
*/
isCustomAttribute: function(attributeName) {
return DOMProperty._isCustomAttributeFunctions.some(
function(isCustomAttributeFn) {
return isCustomAttributeFn.call(null, attributeName);
}
);
},
/**
* Returns the default property value for a DOM property (i.e., not an
* attribute). Most default values are '' or false, but not all. Worse yet,
* some (in particular, `type`) vary depending on the type of element.
*
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
getDefaultValueForProperty: function(nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
defaultValueCache[nodeName] = nodeDefaults = {};
}
if (!(prop in nodeDefaults)) {
testElement = document.createElement(nodeName);
nodeDefaults[prop] = testElement[prop];
}
return nodeDefaults[prop];
},
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
},{"./invariant":106}],10:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DOMPropertyOperations
* @typechecks static-only
*/
"use strict";
var DOMProperty = require("./DOMProperty");
var escapeTextForBrowser = require("./escapeTextForBrowser");
var memoizeStringOnly = require("./memoizeStringOnly");
var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
return escapeTextForBrowser(name) + '="';
});
if (true) {
var reactProps = {
__owner__: true,
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true
};
var warnedProperties = {};
var warnUnknownProperty = function(name) {
if (reactProps[name] || warnedProperties[name]) {
return;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ?
lowerCasedName : DOMProperty.getPossibleStandardName[lowerCasedName];
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
if (standardName != null) {
console.warn(
'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'
);
}
};
}
/**
* Operations for dealing with DOM properties.
*/
var DOMPropertyOperations = {
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function(name, value) {
if (DOMProperty.isStandardName[name]) {
if (value == null || DOMProperty.hasBooleanValue[name] && !value) {
return '';
}
var attributeName = DOMProperty.getAttributeName[name];
return processAttributeNameAndPrefix(attributeName) +
escapeTextForBrowser(value) + '"';
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return processAttributeNameAndPrefix(name) +
escapeTextForBrowser(value) + '"';
} else if (true) {
warnUnknownProperty(name);
}
return null;
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function(node, name, value) {
if (DOMProperty.isStandardName[name]) {
var mutationMethod = DOMProperty.getMutationMethod[name];
if (mutationMethod) {
mutationMethod(node, value);
} else if (DOMProperty.mustUseAttribute[name]) {
if (DOMProperty.hasBooleanValue[name] && !value) {
node.removeAttribute(DOMProperty.getAttributeName[name]);
} else {
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
}
} else {
var propName = DOMProperty.getPropertyName[name];
if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) {
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.setAttribute(name, '' + value);
} else if (true) {
warnUnknownProperty(name);
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function(node, name) {
if (DOMProperty.isStandardName[name]) {
var mutationMethod = DOMProperty.getMutationMethod[name];
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (DOMProperty.mustUseAttribute[name]) {
node.removeAttribute(DOMProperty.getAttributeName[name]);
} else {
var propName = DOMProperty.getPropertyName[name];
node[propName] = DOMProperty.getDefaultValueForProperty(
node.nodeName,
name
);
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
} else if (true) {
warnUnknownProperty(name);
}
}
};
module.exports = DOMPropertyOperations;
},{"./DOMProperty":9,"./escapeTextForBrowser":93,"./memoizeStringOnly":114}],11:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule Danger
* @typechecks static-only
*/
/*jslint evil: true, sub: true */
"use strict";
var ExecutionEnvironment = require("./ExecutionEnvironment");
var createNodesFromMarkup = require("./createNodesFromMarkup");
var emptyFunction = require("./emptyFunction");
var getMarkupWrap = require("./getMarkupWrap");
var invariant = require("./invariant");
var mutateHTMLNodeWithMarkup = require("./mutateHTMLNodeWithMarkup");
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function(markupList) {
invariant(
ExecutionEnvironment.canUseDOM,
'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' +
'thread. This is likely a bug in the framework. Please report ' +
'immediately.'
);
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
invariant(
markupList[i],
'dangerouslyRenderMarkup(...): Missing markup.'
);
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
for (var resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(
OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
);
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(
markupListByNodeName.join(''),
emptyFunction // Do nothing special with <script> tags.
);
for (i = 0; i < renderNodes.length; ++i) {
var renderNode = renderNodes[i];
if (renderNode.hasAttribute &&
renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
invariant(
!resultList.hasOwnProperty(resultIndex),
'Danger: Assigning to an already-occupied result index.'
);
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if (true) {
console.error(
"Danger: Discarding unexpected node:",
renderNode
);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
invariant(
resultListAssignmentCount === resultList.length,
'Danger: Did not assign to every index of resultList.'
);
invariant(
resultList.length === markupList.length,
'Danger: Expected markup to render %s nodes, but rendered %s.',
markupList.length,
resultList.length
);
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
invariant(
ExecutionEnvironment.canUseDOM,
'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
'worker thread. This is likely a bug in the framework. Please report ' +
'immediately.'
);
invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.');
// createNodesFromMarkup() won't work if the markup is rooted by <html>
// since it has special semantic meaning. So we use an alternatie strategy.
if (oldChild.tagName.toLowerCase() === 'html') {
mutateHTMLNodeWithMarkup(oldChild, markup);
return;
}
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
},{"./ExecutionEnvironment":21,"./createNodesFromMarkup":88,"./emptyFunction":92,"./getMarkupWrap":101,"./invariant":106,"./mutateHTMLNodeWithMarkup":119}],12:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DefaultDOMPropertyConfig
*/
/*jslint bitwise: true*/
"use strict";
var DOMProperty = require("./DOMProperty");
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var DefaultDOMPropertyConfig = {
isCustomAttribute: RegExp.prototype.test.bind(
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
),
Properties: {
/**
* Standard Properties
*/
accept: null,
accessKey: null,
action: null,
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
allowTransparency: MUST_USE_ATTRIBUTE,
alt: null,
autoComplete: null,
autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
className: MUST_USE_PROPERTY,
colSpan: null,
content: null,
contentEditable: null,
contextMenu: MUST_USE_ATTRIBUTE,
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
draggable: null,
encType: null,
form: MUST_USE_ATTRIBUTE,
frameBorder: MUST_USE_ATTRIBUTE,
height: MUST_USE_ATTRIBUTE,
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
href: null,
htmlFor: null,
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
label: null,
lang: null,
list: null,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
method: null,
min: null,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
pattern: null,
placeholder: null,
poster: null,
preload: null,
radioGroup: null,
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rowSpan: null,
scrollLeft: MUST_USE_PROPERTY,
scrollTop: MUST_USE_PROPERTY,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
size: null,
spellCheck: null,
src: null,
step: null,
style: null,
tabIndex: null,
target: null,
title: null,
type: null,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
autoCapitalize: null, // Supported in Mobile Safari for keyboard hints
/**
* SVG Properties
*/
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
fill: MUST_USE_ATTRIBUTE,
fx: MUST_USE_ATTRIBUTE,
fy: MUST_USE_ATTRIBUTE,
gradientTransform: MUST_USE_ATTRIBUTE,
gradientUnits: MUST_USE_ATTRIBUTE,
offset: MUST_USE_ATTRIBUTE,
points: MUST_USE_ATTRIBUTE,
r: MUST_USE_ATTRIBUTE,
rx: MUST_USE_ATTRIBUTE,
ry: MUST_USE_ATTRIBUTE,
spreadMethod: MUST_USE_ATTRIBUTE,
stopColor: MUST_USE_ATTRIBUTE,
stopOpacity: MUST_USE_ATTRIBUTE,
stroke: MUST_USE_ATTRIBUTE,
strokeLinecap: MUST_USE_ATTRIBUTE,
strokeWidth: MUST_USE_ATTRIBUTE,
transform: MUST_USE_ATTRIBUTE,
version: MUST_USE_ATTRIBUTE,
viewBox: MUST_USE_ATTRIBUTE,
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
className: 'class',
gradientTransform: 'gradientTransform',
gradientUnits: 'gradientUnits',
htmlFor: 'for',
spreadMethod: 'spreadMethod',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strokeLinecap: 'stroke-linecap',
strokeWidth: 'stroke-width',
viewBox: 'viewBox'
},
DOMPropertyNames: {
autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
encType: 'enctype',
radioGroup: 'radiogroup',
spellCheck: 'spellcheck'
},
DOMMutationMethods: {
/**
* Setting `className` to null may cause it to be set to the string "null".
*
* @param {DOMElement} node
* @param {*} value
*/
className: function(node, value) {
node.className = value || '';
}
}
};
module.exports = DefaultDOMPropertyConfig;
},{"./DOMProperty":9}],13:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DefaultEventPluginOrder
*/
"use strict";
var keyOf = require("./keyOf");
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = [
keyOf({ResponderEventPlugin: null}),
keyOf({SimpleEventPlugin: null}),
keyOf({TapEventPlugin: null}),
keyOf({EnterLeaveEventPlugin: null}),
keyOf({ChangeEventPlugin: null}),
keyOf({SelectEventPlugin: null}),
keyOf({CompositionEventPlugin: null}),
keyOf({AnalyticsEventPlugin: null}),
keyOf({MobileSafariClickEventPlugin: null})
];
module.exports = DefaultEventPluginOrder;
},{"./keyOf":113}],14:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EnterLeaveEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = require("./EventConstants");
var EventPropagators = require("./EventPropagators");
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
var ReactMount = require("./ReactMount");
var keyOf = require("./keyOf");
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {registrationName: keyOf({onMouseEnter: null})},
mouseLeave: {registrationName: keyOf({onMouseLeave: null})}
};
var extractedEvents = [null, null];
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
if (topLevelType === topLevelTypes.topMouseOver &&
(nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== topLevelTypes.topMouseOut &&
topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var from, to;
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
to =
getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
window;
} else {
from = window;
to = topLevelTarget;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var fromID = from ? ReactMount.getID(from) : '';
var toID = to ? ReactMount.getID(to) : '';
var leave = SyntheticMouseEvent.getPooled(
eventTypes.mouseLeave,
fromID,
nativeEvent
);
var enter = SyntheticMouseEvent.getPooled(
eventTypes.mouseEnter,
toID,
nativeEvent
);
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
extractedEvents[0] = leave;
extractedEvents[1] = enter;
return extractedEvents;
}
};
module.exports = EnterLeaveEventPlugin;
},{"./EventConstants":15,"./EventPropagators":20,"./ReactMount":53,"./SyntheticMouseEvent":78,"./keyOf":113}],15:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventConstants
*/
"use strict";
var keyMirror = require("./keyMirror");
var PropagationPhases = keyMirror({bubbled: null, captured: null});
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
topBlur: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
topCompositionStart: null,
topCompositionUpdate: null,
topCopy: null,
topCut: null,
topDoubleClick: null,
topDrag: null,
topDragEnd: null,
topDragEnter: null,
topDragExit: null,
topDragLeave: null,
topDragOver: null,
topDragStart: null,
topDrop: null,
topFocus: null,
topInput: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
topScroll: null,
topSelectionChange: null,
topSubmit: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
topWheel: null
});
var EventConstants = {
topLevelTypes: topLevelTypes,
PropagationPhases: PropagationPhases
};
module.exports = EventConstants;
},{"./keyMirror":112}],16:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventListener
*/
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listens to bubbled events on a DOM node.
*
* @param {Element} el DOM element to register listener on.
* @param {string} handlerBaseName 'click'/'mouseover'
* @param {Function!} cb Callback function
*/
listen: function(el, handlerBaseName, cb) {
if (el.addEventListener) {
el.addEventListener(handlerBaseName, cb, false);
} else if (el.attachEvent) {
el.attachEvent('on' + handlerBaseName, cb);
}
},
/**
* Listens to captured events on a DOM node.
*
* @see `EventListener.listen` for params.
* @throws Exception if addEventListener is not supported.
*/
capture: function(el, handlerBaseName, cb) {
if (!el.addEventListener) {
if (true) {
console.error(
'You are attempting to use addEventlistener ' +
'in a browser that does not support it support it.' +
'This likely means that you will not receive events that ' +
'your application relies on (such as scroll).');
}
return;
} else {
el.addEventListener(handlerBaseName, cb, true);
}
}
};
module.exports = EventListener;
},{}],17:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPluginHub
*/
"use strict";
var CallbackRegistry = require("./CallbackRegistry");
var EventPluginRegistry = require("./EventPluginRegistry");
var EventPluginUtils = require("./EventPluginUtils");
var EventPropagators = require("./EventPropagators");
var ExecutionEnvironment = require("./ExecutionEnvironment");
var accumulate = require("./accumulate");
var forEachAccumulated = require("./forEachAccumulated");
var invariant = require("./invariant");
/**
* 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.
* @private
*/
var executeDispatchesAndRelease = function(event) {
if (event) {
var executeDispatch = EventPluginUtils.executeDispatch;
// Plugins can provide custom behavior when dispatching events.
var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
if (PluginModule && PluginModule.executeDispatch) {
executeDispatch = PluginModule.executeDispatch;
}
EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
/**
* 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 {object} InjectedInstanceHandle
* @public
*/
injectInstanceHandle: EventPropagators.injection.injectInstanceHandle,
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
registrationNames: EventPluginRegistry.registrationNames,
putListener: CallbackRegistry.putListener,
getListener: CallbackRegistry.getListener,
deleteListener: CallbackRegistry.deleteListener,
deleteAllListeners: CallbackRegistry.deleteAllListeners,
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0, l = plugins.length; i < l; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
if (extractedEvents) {
events = accumulate(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(events) {
if (events) {
eventQueue = accumulate(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function() {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
invariant(
!eventQueue,
'processEventQueue(): Additional events were enqueued while processing ' +
'an event queue. Support for this has not yet been implemented.'
);
}
};
if (ExecutionEnvironment.canUseDOM) {
window.EventPluginHub = EventPluginHub;
}
module.exports = EventPluginHub;
},{"./CallbackRegistry":5,"./EventPluginRegistry":18,"./EventPluginUtils":19,"./EventPropagators":20,"./ExecutionEnvironment":21,"./accumulate":84,"./forEachAccumulated":97,"./invariant":106}],18:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPluginRegistry
* @typechecks static-only
*/
"use strict";
var invariant = require("./invariant");
/**
* 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);
invariant(
pluginIndex > -1,
'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
'the plugin ordering, `%s`.',
pluginName
);
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
invariant(
PluginModule.extractEvents,
'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
'method, but `%s` does not.',
pluginName
);
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
invariant(
publishEventForPlugin(publishedEvents[eventName], PluginModule),
'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
eventName,
pluginName
);
}
}
}
/**
* 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) {
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(phasedRegistrationName, PluginModule);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(dispatchConfig.registrationName, PluginModule);
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) {
invariant(
!EventPluginRegistry.registrationNames[registrationName],
'EventPluginHub: More than one plugin attempted to publish the same ' +
'registration name, `%s`.',
registrationName
);
EventPluginRegistry.registrationNames[registrationName] = PluginModule;
EventPluginRegistry.registrationNamesKeys.push(registrationName);
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
var EventPluginRegistry = {
/**
* Ordered list of injected plugins.
*/
plugins: [],
/**
* Mapping from registration names to plugin modules.
*/
registrationNames: {},
/**
* The keys of `registrationNames`.
*/
registrationNamesKeys: [],
/**
* 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(InjectedEventPluginOrder) {
invariant(
!EventPluginOrder,
'EventPluginRegistry: Cannot inject event plugin ordering more than once.'
);
// 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(injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
if (namesToPlugins[pluginName] !== PluginModule) {
invariant(
!namesToPlugins[pluginName],
'EventPluginRegistry: Cannot inject two different event plugins ' +
'using the same name, `%s`.',
pluginName
);
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(event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNames[
dispatchConfig.registrationName
] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNames[
dispatchConfig.phasedRegistrationNames[phase]
];
if (PluginModule) {
return PluginModule;
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function() {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
delete namesToPlugins[pluginName];
}
}
EventPluginRegistry.plugins.length = 0;
var registrationNames = EventPluginRegistry.registrationNames;
for (var registrationName in registrationNames) {
if (registrationNames.hasOwnProperty(registrationName)) {
delete registrationNames[registrationName];
}
}
EventPluginRegistry.registrationNamesKeys.length = 0;
}
};
module.exports = EventPluginRegistry;
},{"./invariant":106}],19:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPluginUtils
*/
"use strict";
var EventConstants = require("./EventConstants");
var invariant = require("./invariant");
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
return topLevelType === topLevelTypes.topMouseUp ||
topLevelType === topLevelTypes.topTouchEnd ||
topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
return topLevelType === topLevelTypes.topMouseMove ||
topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
return topLevelType === topLevelTypes.topMouseDown ||
topLevelType === topLevelTypes.topTouchStart;
}
var validateEventDispatches;
if (true) {
validateEventDispatches = function(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ?
dispatchListeners.length :
dispatchListeners ? 1 : 0;
invariant(
idsIsArr === listenersIsArr && IDsLen === listenersLen,
'EventPluginUtils: Invalid `event`.'
);
};
}
/**
* Invokes `cb(event, listener, id)`. Avoids using call if no scope is
* provided. The `(listener,id)` pair effectively forms the "dispatch" but are
* kept separate to conserve memory.
*/
function forEachEventDispatch(event, cb) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if (true) {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
cb(event, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
cb(event, dispatchListeners, dispatchIDs);
}
}
/**
* Default implementation of PluginModule.executeDispatch().
* @param {SyntheticEvent} SyntheticEvent to handle
* @param {function} Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, listener, domID) {
listener(event, domID);
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, executeDispatch) {
forEachEventDispatch(event, executeDispatch);
event._dispatchListeners = null;
event._dispatchIDs = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return id of the first dispatch execution who's listener returns true, or
* null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrue(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if (true) {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchIDs[i])) {
return dispatchIDs[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchIDs)) {
return dispatchIDs;
}
}
return null;
}
/**
* 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 (true) {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
invariant(
!Array.isArray(dispatchListener),
'executeDirectDispatch(...): Invalid `event`.'
);
var res = dispatchListener ?
dispatchListener(event, dispatchID) :
null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {bool} 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,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
executeDirectDispatch: executeDirectDispatch,
hasDispatches: hasDispatches,
executeDispatch: executeDispatch
};
module.exports = EventPluginUtils;
},{"./EventConstants":15,"./invariant":106}],20:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPropagators
*/
"use strict";
var CallbackRegistry = require("./CallbackRegistry");
var EventConstants = require("./EventConstants");
var accumulate = require("./accumulate");
var forEachAccumulated = require("./forEachAccumulated");
var getListener = CallbackRegistry.getListener;
var PropagationPhases = EventConstants.PropagationPhases;
/**
* Injected dependencies:
*/
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
* hierarchy given ids of the logical DOM elements involved.
*/
var injection = {
InstanceHandle: null,
injectInstanceHandle: function(InjectedInstanceHandle) {
injection.InstanceHandle = InjectedInstanceHandle;
if (true) {
injection.validate();
}
},
validate: function() {
var invalid = !injection.InstanceHandle||
!injection.InstanceHandle.traverseTwoPhase ||
!injection.InstanceHandle.traverseEnterLeave;
if (invalid) {
throw new Error('InstanceHandle not injected before use!');
}
}
};
/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
var registrationName =
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, 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(domID, upwards, event) {
if (true) {
if (!domID) {
throw new Error('Dispatching id must not be null');
}
injection.validate();
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
event._dispatchListeners = accumulate(event._dispatchListeners, listener);
event._dispatchIDs = accumulate(event._dispatchIDs, domID);
}
}
/**
* 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 can not 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) {
injection.InstanceHandle.traverseTwoPhase(
event.dispatchMarker,
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(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners = accumulate(event._dispatchListeners, listener);
event._dispatchIDs = accumulate(event._dispatchIDs, id);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event.dispatchMarker, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
if (true) {
injection.validate();
}
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
if (true) {
injection.validate();
}
injection.InstanceHandle.traverseEnterLeave(
fromID,
toID,
accumulateDispatches,
leave,
enter
);
}
function accumulateDirectDispatches(events) {
if (true) {
injection.validate();
}
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,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches,
injection: injection
};
module.exports = EventPropagators;
},{"./CallbackRegistry":5,"./EventConstants":15,"./accumulate":84,"./forEachAccumulated":97}],21:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ExecutionEnvironment
*/
/*jslint evil: true */
"use strict";
var canUseDOM = typeof window !== 'undefined';
/**
* 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',
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
},{}],22:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule LinkedStateMixin
* @typechecks static-only
*/
"use strict";
var ReactLink = require("./ReactLink");
var ReactStateSetters = require("./ReactStateSetters");
/**
* A simple mixin around ReactLink.forState().
*/
var LinkedStateMixin = {
/**
* Create a ReactLink that's linked to part of this component's state. The
* ReactLink will have the current value of this.state[key] and will call
* setState() when a change is requested.
*
* @param {string} key state key to update. Note: you may want to use keyOf()
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
linkState: function(key) {
return new ReactLink(
this.state[key],
ReactStateSetters.createStateKeySetter(this, key)
);
}
};
module.exports = LinkedStateMixin;
},{"./ReactLink":51,"./ReactStateSetters":63}],23:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule LinkedValueMixin
* @typechecks static-only
*/
"use strict";
var invariant = require("./invariant");
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueMixin = {
_assertLink: function() {
invariant(
this.props.value == null && this.props.onChange == null,
'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'
);
},
/**
* @return {*} current value of the input either from value prop or link.
*/
getValue: function() {
if (this.props.valueLink) {
this._assertLink();
return this.props.valueLink.value;
}
return this.props.value;
},
/**
* @return {function} change callback either from onChange prop or link.
*/
getOnChange: function() {
if (this.props.valueLink) {
this._assertLink();
return this._handleLinkedValueChange;
}
return this.props.onChange;
},
/**
* @param {SyntheticEvent} e change event to handle
*/
_handleLinkedValueChange: function(e) {
this.props.valueLink.requestChange(e.target.value);
}
};
module.exports = LinkedValueMixin;
},{"./invariant":106}],24:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule MobileSafariClickEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = require("./EventConstants");
var emptyFunction = require("./emptyFunction");
var topLevelTypes = EventConstants.topLevelTypes;
/**
* Mobile Safari does not fire properly bubble click events on non-interactive
* elements, which means delegated click listeners do not fire. The workaround
* for this bug involves attaching an empty click listener on the target node.
*
* This particular plugin works around the bug by attaching an empty click
* listener on `touchstart` (which does fire on every element).
*/
var MobileSafariClickEventPlugin = {
eventTypes: null,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
if (topLevelType === topLevelTypes.topTouchStart) {
var target = nativeEvent.target;
if (target && !target.onclick) {
target.onclick = emptyFunction;
}
}
}
};
module.exports = MobileSafariClickEventPlugin;
},{"./EventConstants":15,"./emptyFunction":92}],25:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule PooledClass
*/
"use strict";
/**
* 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(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(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(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 fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function(instance) {
var Klass = this;
if (instance.destructor) {
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 (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function(CopyConstructor, pooler) {
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,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
},{}],26:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule React
*/
"use strict";
var ReactComponent = require("./ReactComponent");
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactCurrentOwner = require("./ReactCurrentOwner");
var ReactDOM = require("./ReactDOM");
var ReactDOMComponent = require("./ReactDOMComponent");
var ReactDefaultInjection = require("./ReactDefaultInjection");
var ReactInstanceHandles = require("./ReactInstanceHandles");
var ReactMount = require("./ReactMount");
var ReactMultiChild = require("./ReactMultiChild");
var ReactPerf = require("./ReactPerf");
var ReactPropTypes = require("./ReactPropTypes");
var ReactServerRendering = require("./ReactServerRendering");
var ReactTextComponent = require("./ReactTextComponent");
ReactDefaultInjection.inject();
var React = {
DOM: ReactDOM,
PropTypes: ReactPropTypes,
initializeTouchEvents: function(shouldUseTouch) {
ReactMount.useTouchEvents = shouldUseTouch;
},
createClass: ReactCompositeComponent.createClass,
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
renderComponent: ReactPerf.measure(
'React',
'renderComponent',
ReactMount.renderComponent
),
renderComponentToString: ReactServerRendering.renderComponentToString,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
unmountAndReleaseReactRootNode: ReactMount.unmountAndReleaseReactRootNode,
isValidClass: ReactCompositeComponent.isValidClass,
isValidComponent: ReactComponent.isValidComponent,
__internals: {
Component: ReactComponent,
CurrentOwner: ReactCurrentOwner,
DOMComponent: ReactDOMComponent,
InstanceHandles: ReactInstanceHandles,
Mount: ReactMount,
MultiChild: ReactMultiChild,
TextComponent: ReactTextComponent
}
};
// Version exists only in the open-source version of React, not in Facebook's
// internal version.
React.version = '0.5.1';
module.exports = React;
},{"./ReactComponent":28,"./ReactCompositeComponent":31,"./ReactCurrentOwner":32,"./ReactDOM":33,"./ReactDOMComponent":35,"./ReactDefaultInjection":44,"./ReactInstanceHandles":50,"./ReactMount":53,"./ReactMultiChild":55,"./ReactPerf":58,"./ReactPropTypes":60,"./ReactServerRendering":62,"./ReactTextComponent":64}],27:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactChildren
*/
"use strict";
var PooledClass = require("./PooledClass");
var invariant = require("./invariant");
var traverseAllChildren = require("./traverseAllChildren");
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var threeArgumentPooler = PooledClass.threeArgumentPooler;
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.forEachFunction = forEachFunction;
this.forEachContext = forEachContext;
}
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(traverseContext, child, name, i) {
var forEachBookKeeping = traverseContext;
forEachBookKeeping.forEachFunction.call(
forEachBookKeeping.forEachContext, child, i);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {array} children
* @param {function(*, int)} forEachFunc.
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext =
ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, mapFunction, mapContext) {
this.mapResult = mapResult;
this.mapFunction = mapFunction;
this.mapContext = mapContext;
}
PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
function mapSingleChildIntoContext(traverseContext, child, name, i) {
var mapBookKeeping = traverseContext;
var mapResult = mapBookKeeping.mapResult;
var mappedChild =
mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
// We found a component instance
invariant(
!mapResult.hasOwnProperty(name),
'ReactChildren.map(...): Encountered two children with the same key, ' +
'`%s`. Children keys must be unique.',
name
);
mapResult[name] = mappedChild;
}
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* TODO: This may likely break any calls to `ReactChildren.map` that were
* previously relying on the fact that we guarded against null children.
*
* @param {array} children
* @param {function(*, int)} mapFunction.
* @param {*} mapContext Context for mapFunction.
* @return {array} mirrored array with mapped children.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var mapResult = {};
var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
return mapResult;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren
};
module.exports = ReactChildren;
},{"./PooledClass":25,"./invariant":106,"./traverseAllChildren":125}],28:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactComponent
*/
"use strict";
var ReactComponentEnvironment = require("./ReactComponentEnvironment");
var ReactCurrentOwner = require("./ReactCurrentOwner");
var ReactOwner = require("./ReactOwner");
var ReactUpdates = require("./ReactUpdates");
var invariant = require("./invariant");
var keyMirror = require("./keyMirror");
var merge = require("./merge");
/**
* Every React component is in one of these life cycles.
*/
var ComponentLifeCycle = keyMirror({
/**
* Mounted components have a DOM node representation and are capable of
* receiving new props.
*/
MOUNTED: null,
/**
* Unmounted components are inactive and cannot receive new props.
*/
UNMOUNTED: null
});
/**
* Warn if there's no key explicitly set on dynamic arrays of children.
* This allows us to keep track of children between updates.
*/
var ownerHasWarned = {};
/**
* Warn if the component doesn't have an explicit key assigned to it.
* This component is in an array. The array could grow and shrink or be
* reordered. All children, that hasn't already been validated, are required to
* have a "key" property assigned to it.
*
* @internal
* @param {ReactComponent} component Component that requires a key.
*/
function validateExplicitKey(component) {
if (component.__keyValidated__ || component.props.key != null) {
return;
}
component.__keyValidated__ = true;
// We can't provide friendly warnings for top level components.
if (!ReactCurrentOwner.current) {
return;
}
// Name of the component whose render method tried to pass children.
var currentName = ReactCurrentOwner.current.constructor.displayName;
if (ownerHasWarned.hasOwnProperty(currentName)) {
return;
}
ownerHasWarned[currentName] = true;
var message = 'Each child in an array should have a unique "key" prop. ' +
'Check the render method of ' + currentName + '.';
if (!component.isOwnedBy(ReactCurrentOwner.current)) {
// Name of the component that originally created this child.
var childOwnerName =
component.props.__owner__ &&
component.props.__owner__.constructor.displayName;
// 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.
message += ' It was passed a child from ' + childOwnerName + '.';
}
console.warn(message);
}
/**
* Ensure that every component either is passed in a static location or, if
* if it's passed in an array, has an explicit key property defined.
*
* @internal
* @param {*} component Statically passed child of any type.
* @return {boolean}
*/
function validateChildKeys(component) {
if (Array.isArray(component)) {
for (var i = 0; i < component.length; i++) {
var child = component[i];
if (ReactComponent.isValidComponent(child)) {
validateExplicitKey(child);
}
}
} else if (ReactComponent.isValidComponent(component)) {
// This component was passed in a valid location.
component.__keyValidated__ = true;
}
}
/**
* Components are the basic units of composition in React.
*
* Every component accepts a set of keyed input parameters known as "props" that
* are initialized by the constructor. Once a component is mounted, the props
* can be mutated using `setProps` or `replaceProps`.
*
* Every component is capable of the following operations:
*
* `mountComponent`
* Initializes the component, renders markup, and registers event listeners.
*
* `receiveProps`
* Updates the rendered DOM nodes given a new set of props.
*
* `unmountComponent`
* Releases any resources allocated by this component.
*
* Components can also be "owned" by other components. Being owned by another
* component means being constructed by that component. This is different from
* being the child of a component, which means having a DOM representation that
* is a child of the DOM representation of that component.
*
* @class ReactComponent
*/
var ReactComponent = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
isValidComponent: function(object) {
return !!(
object &&
typeof object.mountComponentIntoNode === 'function' &&
typeof object.receiveProps === 'function'
);
},
/**
* 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}
* @internal
*/
getKey: function(component, index) {
if (component && component.props && component.props.key != null) {
// Explicit key
return '{' + component.props.key + '}';
}
// Implicit key determined by the index in the set
return '[' + index + ']';
},
/**
* @internal
*/
LifeCycle: ComponentLifeCycle,
/**
* Injected module that provides ability to mutate individual properties.
* Injected into the base class because many different subclasses need access
* to this.
*
* @internal
*/
DOMIDOperations: ReactComponentEnvironment.DOMIDOperations,
/**
* Optionally injectable environment dependent cleanup hook. (server vs.
* browser etc). Example: A browser system caches DOM nodes based on component
* ID and must remove that cache entry when this instance is unmounted.
*
* @private
*/
unmountIDFromEnvironment: ReactComponentEnvironment.unmountIDFromEnvironment,
/**
* The "image" of a component tree, is the platform specific (typically
* serialized) data that represents a tree of lower level UI building blocks.
* On the web, this "image" is HTML markup which describes a construction of
* low level `div` and `span` nodes. Other platforms may have different
* encoding of this "image". This must be injected.
*
* @private
*/
mountImageIntoNode: ReactComponentEnvironment.mountImageIntoNode,
/**
* React references `ReactReconcileTransaction` using this property in order
* to allow dependency injection.
*
* @internal
*/
ReactReconcileTransaction:
ReactComponentEnvironment.ReactReconcileTransaction,
/**
* Base functionality for every ReactComponent constructor. Mixed into the
* `ReactComponent` prototype, but exposed statically for easy access.
*
* @lends {ReactComponent.prototype}
*/
Mixin: merge(ReactComponentEnvironment.Mixin, {
/**
* Checks whether or not this component is mounted.
*
* @return {boolean} True if mounted, false otherwise.
* @final
* @protected
*/
isMounted: function() {
return this._lifeCycleState === ComponentLifeCycle.MOUNTED;
},
/**
* Sets a subset of the props.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
*/
setProps: function(partialProps, callback) {
// Merge with `_pendingProps` if it exists, otherwise with existing props.
this.replaceProps(
merge(this._pendingProps || this.props, partialProps),
callback
);
},
/**
* Replaces all of the props.
*
* @param {object} props New props.
* @param {?function} callback Called after props are updated.
* @final
* @public
*/
replaceProps: function(props, callback) {
invariant(
!this.props.__owner__,
'replaceProps(...): You called `setProps` or `replaceProps` on a ' +
'component with an owner. This is an anti-pattern since props will ' +
'get reactively updated when rendered. Instead, change the owner\'s ' +
'`render` method to pass the correct value as props to the component ' +
'where it is created.'
);
invariant(
this.isMounted(),
'replaceProps(...): Can only update a mounted component.'
);
this._pendingProps = props;
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Base constructor for all React component.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.construct.call(this, ...)`.
*
* @param {?object} initialProps
* @param {*} children
* @internal
*/
construct: function(initialProps, children) {
this.props = initialProps || {};
// Record the component responsible for creating this component.
this.props.__owner__ = ReactCurrentOwner.current;
// All components start unmounted.
this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
this._pendingProps = null;
this._pendingCallbacks = null;
// Children can be more than one argument
var childrenLength = arguments.length - 1;
if (childrenLength === 1) {
if (true) {
validateChildKeys(children);
}
this.props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
if (true) {
validateChildKeys(arguments[i + 1]);
}
childArray[i] = arguments[i + 1];
}
this.props.children = childArray;
}
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* NOTE: This does not insert any nodes into the DOM.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.mountComponent.call(this, ...)`.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy.
* @return {?string} Rendered markup to be inserted into the DOM.
* @internal
*/
mountComponent: function(rootID, transaction, mountDepth) {
invariant(
!this.isMounted(),
'mountComponent(%s, ...): Can only mount an unmounted component.',
rootID
);
var props = this.props;
if (props.ref != null) {
ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__);
}
this._rootNodeID = rootID;
this._lifeCycleState = ComponentLifeCycle.MOUNTED;
this._mountDepth = mountDepth;
// Effectively: return '';
},
/**
* Releases any resources allocated by `mountComponent`.
*
* NOTE: This does not remove any nodes from the DOM.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.unmountComponent.call(this)`.
*
* @internal
*/
unmountComponent: function() {
invariant(
this.isMounted(),
'unmountComponent(): Can only unmount a mounted component.'
);
var props = this.props;
if (props.ref != null) {
ReactOwner.removeComponentAsRefFrom(this, props.ref, props.__owner__);
}
ReactComponent.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
},
/**
* Updates the rendered DOM nodes given a new set of props.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.receiveProps.call(this, ...)`.
*
* @param {object} nextProps Next set of properties.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveProps: function(nextProps, transaction) {
invariant(
this.isMounted(),
'receiveProps(...): Can only update a mounted component.'
);
this._pendingProps = nextProps;
this._performUpdateIfNecessary(transaction);
},
/**
* Call `_performUpdateIfNecessary` within a new transaction.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function() {
var transaction = ReactComponent.ReactReconcileTransaction.getPooled();
transaction.perform(this._performUpdateIfNecessary, this, transaction);
ReactComponent.ReactReconcileTransaction.release(transaction);
},
/**
* If `_pendingProps` is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_performUpdateIfNecessary: function(transaction) {
if (this._pendingProps == null) {
return;
}
var prevProps = this.props;
this.props = this._pendingProps;
this._pendingProps = null;
this.updateComponent(transaction, prevProps);
},
/**
* Updates the component's currently mounted representation.
*
* @param {ReactReconcileTransaction} transaction
* @param {object} prevProps
* @internal
*/
updateComponent: function(transaction, prevProps) {
var props = this.props;
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`.
if (props.__owner__ !== prevProps.__owner__ ||
props.ref !== prevProps.ref) {
if (prevProps.ref != null) {
ReactOwner.removeComponentAsRefFrom(
this, prevProps.ref, prevProps.__owner__
);
}
// Correct, even if the owner is the same, and only the ref has changed.
if (props.ref != null) {
ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__);
}
}
},
/**
* Mounts this component and inserts it into the DOM.
*
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
* @final
* @internal
* @see {ReactMount.renderComponent}
*/
mountComponentIntoNode: function(rootID, container, shouldReuseMarkup) {
var transaction = ReactComponent.ReactReconcileTransaction.getPooled();
transaction.perform(
this._mountComponentIntoNode,
this,
rootID,
container,
transaction,
shouldReuseMarkup
);
ReactComponent.ReactReconcileTransaction.release(transaction);
},
/**
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
* @final
* @private
*/
_mountComponentIntoNode: function(
rootID,
container,
transaction,
shouldReuseMarkup) {
var markup = this.mountComponent(rootID, transaction, 0);
ReactComponent.mountImageIntoNode(markup, container, shouldReuseMarkup);
},
/**
* Checks if this component is owned by the supplied `owner` component.
*
* @param {ReactComponent} owner Component to check.
* @return {boolean} True if `owners` owns this component.
* @final
* @internal
*/
isOwnedBy: function(owner) {
return this.props.__owner__ === owner;
},
/**
* Gets another component, that shares the same owner as this one, by ref.
*
* @param {string} ref of a sibling Component.
* @return {?ReactComponent} the actual sibling Component.
* @final
* @internal
*/
getSiblingByRef: function(ref) {
var owner = this.props.__owner__;
if (!owner || !owner.refs) {
return null;
}
return owner.refs[ref];
}
})
};
module.exports = ReactComponent;
},{"./ReactComponentEnvironment":30,"./ReactCurrentOwner":32,"./ReactOwner":57,"./ReactUpdates":69,"./invariant":106,"./keyMirror":112,"./merge":115}],29:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactComponentBrowserEnvironment
*/
/*jslint evil: true */
"use strict";
var ReactDOMIDOperations = require("./ReactDOMIDOperations");
var ReactMarkupChecksum = require("./ReactMarkupChecksum");
var ReactMount = require("./ReactMount");
var ReactReconcileTransaction = require("./ReactReconcileTransaction");
var getReactRootElementInContainer = require("./getReactRootElementInContainer");
var invariant = require("./invariant");
var mutateHTMLNodeWithMarkup = require("./mutateHTMLNodeWithMarkup");
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
/**
* Abstracts away all functionality of `ReactComponent` requires knowledge of
* the browser context.
*/
var ReactComponentBrowserEnvironment = {
/**
* Mixed into every component instance.
*/
Mixin: {
/**
* Returns the DOM node rendered by this component.
*
* @return {DOMElement} The root node of this component.
* @final
* @protected
*/
getDOMNode: function() {
invariant(
this.isMounted(),
'getDOMNode(): A component must be mounted to have a DOM node.'
);
return ReactMount.getNode(this._rootNodeID);
}
},
ReactReconcileTransaction: ReactReconcileTransaction,
DOMIDOperations: ReactDOMIDOperations,
/**
* If a particular environment requires that some resources be cleaned up,
* specify this in the injected Mixin. In the DOM, we would likely want to
* purge any cached node ID lookups.
*
* @private
*/
unmountIDFromEnvironment: function(rootNodeID) {
ReactMount.purgeID(rootNodeID);
},
/**
* @param {string} markup Markup string to place into the DOM Element.
* @param {DOMElement} container DOM Element to insert markup into.
* @param {boolean} shouldReuseMarkup Should reuse the existing markup in the
* container if possible.
*/
mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
invariant(
container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender
),
'mountComponentIntoNode(...): Target container is not valid.'
);
if (shouldReuseMarkup) {
if (ReactMarkupChecksum.canReuseMarkup(
markup,
getReactRootElementInContainer(container))) {
return;
} else {
if (true) {
console.warn(
'React attempted to use 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.'
);
}
}
}
// You can't naively set the innerHTML of the entire document. You need
// to mutate documentElement which requires doing some crazy tricks. See
// mutateHTMLNodeWithMarkup()
if (container.nodeType === DOC_NODE_TYPE) {
mutateHTMLNodeWithMarkup(container.documentElement, markup);
return;
}
// Asynchronously inject markup by ensuring that the container is not in
// the document when settings its `innerHTML`.
var parent = container.parentNode;
if (parent) {
var next = container.nextSibling;
parent.removeChild(container);
container.innerHTML = markup;
if (next) {
parent.insertBefore(container, next);
} else {
parent.appendChild(container);
}
} else {
container.innerHTML = markup;
}
}
};
module.exports = ReactComponentBrowserEnvironment;
},{"./ReactDOMIDOperations":37,"./ReactMarkupChecksum":52,"./ReactMount":53,"./ReactReconcileTransaction":61,"./getReactRootElementInContainer":103,"./invariant":106,"./mutateHTMLNodeWithMarkup":119}],30:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactComponentEnvironment
*/
var ReactComponentBrowserEnvironment =
require("./ReactComponentBrowserEnvironment");
var ReactComponentEnvironment = ReactComponentBrowserEnvironment;
module.exports = ReactComponentEnvironment;
},{"./ReactComponentBrowserEnvironment":29}],31:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactCompositeComponent
*/
"use strict";
var ReactComponent = require("./ReactComponent");
var ReactCurrentOwner = require("./ReactCurrentOwner");
var ReactOwner = require("./ReactOwner");
var ReactPerf = require("./ReactPerf");
var ReactPropTransferer = require("./ReactPropTransferer");
var ReactUpdates = require("./ReactUpdates");
var invariant = require("./invariant");
var keyMirror = require("./keyMirror");
var merge = require("./merge");
var mixInto = require("./mixInto");
var objMap = require("./objMap");
/**
* Policies that describe methods in `ReactCompositeComponentInterface`.
*/
var SpecPolicy = keyMirror({
/**
* These methods may be defined only once by the class specification or mixin.
*/
DEFINE_ONCE: null,
/**
* These methods may be defined by both the class specification and mixins.
* Subsequent definitions will be chained. These methods must return void.
*/
DEFINE_MANY: null,
/**
* These methods are overriding the base ReactCompositeComponent class.
*/
OVERRIDE_BASE: null,
/**
* These methods are similar to DEFINE_MANY, except we assume they return
* objects. We try to merge the keys of the return values of all the mixed in
* functions. If there is a key conflict we throw.
*/
DEFINE_MANY_MERGED: null
});
/**
* Composite components are higher-level components that compose other composite
* or native components.
*
* To create a new type of `ReactCompositeComponent`, 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 `ReactCompositeComponentInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will available on the prototype.
*
* @interface ReactCompositeComponentInterface
* @internal
*/
var ReactCompositeComponentInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: SpecPolicy.DEFINE_MANY,
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: SpecPolicy.DEFINE_ONCE,
// ==== 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: SpecPolicy.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: SpecPolicy.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}
* @nosideeffects
* @required
*/
render: SpecPolicy.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: SpecPolicy.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: SpecPolicy.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) {
* 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: SpecPolicy.DEFINE_MANY,
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props and state.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props and state will not require a component update.
*
* shouldComponentUpdate: function(nextProps, nextState) {
* return !equal(nextProps, this.props) || !equal(nextState, this.state);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
/**
* Invoked when the component is about to update due to a transition from
* `this.props` and `this.state` to `nextProps` and `nextState`.
*
* 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 {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: SpecPolicy.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 {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: SpecPolicy.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: SpecPolicy.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: SpecPolicy.OVERRIDE_BASE
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared in the specification when defining classes
* using `React.createClass`, they will not be on the component's prototype.
*/
var RESERVED_SPEC_KEYS = {
displayName: function(Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function(Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
propTypes: function(Constructor, propTypes) {
Constructor.propTypes = propTypes;
}
};
function validateMethodOverride(proto, name) {
var specPolicy = ReactCompositeComponentInterface[name];
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactCompositeComponentMixin.hasOwnProperty(name)) {
invariant(
specPolicy === SpecPolicy.OVERRIDE_BASE,
'ReactCompositeComponentInterface: 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 (proto.hasOwnProperty(name)) {
invariant(
specPolicy === SpecPolicy.DEFINE_MANY ||
specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
'ReactCompositeComponentInterface: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be due ' +
'to a mixin.',
name
);
}
}
function validateLifeCycleOnReplaceState(instance) {
var compositeLifeCycleState = instance._compositeLifeCycleState;
invariant(
instance.isMounted() ||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING,
'replaceState(...): Can only update a mounted or mounting component.'
);
invariant(
compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&
compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
'replaceState(...): Cannot update while unmounting component or during ' +
'an existing state transition (such as within `render`).'
);
}
/**
* Custom version of `mixInto` which handles policy validation and reserved
* specification keys when building `ReactCompositeComponent` classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
var proto = Constructor.prototype;
for (var name in spec) {
var property = spec[name];
if (!spec.hasOwnProperty(name) || !property) {
continue;
}
validateMethodOverride(proto, 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 ReactCompositeComponent methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isCompositeComponentMethod = name in ReactCompositeComponentInterface;
var isInherited = name in proto;
var markedDontBind = property.__reactDontBind;
var isFunction = typeof property === 'function';
var shouldAutoBind =
isFunction &&
!isCompositeComponentMethod &&
!isInherited &&
!markedDontBind;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isInherited) {
// For methods which are defined more than once, call the existing
// methods before calling the new property.
if (ReactCompositeComponentInterface[name] ===
SpecPolicy.DEFINE_MANY_MERGED) {
proto[name] = createMergedResultFunction(proto[name], property);
} else {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[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 mergeObjectsWithNoDuplicateKeys(one, two) {
invariant(
one && two && typeof one === 'object' && typeof two === 'object',
'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects'
);
objMap(two, function(value, key) {
invariant(
one[key] === undefined,
'mergeObjectsWithNoDuplicateKeys(): ' +
'Tried to merge two objects with the same key: %s',
key
);
one[key] = value;
});
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() {
return mergeObjectsWithNoDuplicateKeys(
one.apply(this, arguments),
two.apply(this, arguments)
);
};
}
/**
* 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);
};
}
/**
* `ReactCompositeComponent` maintains an auxiliary life cycle state in
* `this._compositeLifeCycleState` (which can be null).
*
* This is different from the life cycle state maintained by `ReactComponent` in
* `this._lifeCycleState`. The following diagram shows how the states overlap in
* time. There are times when the CompositeLifeCycle is null - at those times it
* is only meaningful to look at ComponentLifeCycle alone.
*
* Top Row: ReactComponent.ComponentLifeCycle
* Low Row: ReactComponent.CompositeLifeCycle
*
* +-------+------------------------------------------------------+--------+
* | UN | MOUNTED | UN |
* |MOUNTED| | MOUNTED|
* +-------+------------------------------------------------------+--------+
* | ^--------+ +------+ +------+ +------+ +--------^ |
* | | | | | | | | | | | |
* | 0--|MOUNTING|-0-|RECEIV|-0-|RECEIV|-0-|RECEIV|-0-| UN |--->0 |
* | | | |PROPS | | PROPS| | STATE| |MOUNTING| |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +--------+ +------+ +------+ +------+ +--------+ |
* | | | |
* +-------+------------------------------------------------------+--------+
*/
var CompositeLifeCycle = keyMirror({
/**
* Components in the process of being mounted respond to state changes
* differently.
*/
MOUNTING: null,
/**
* Components in the process of being unmounted are guarded against state
* changes.
*/
UNMOUNTING: null,
/**
* Components that are mounted and receiving new props respond to state
* changes differently.
*/
RECEIVING_PROPS: null,
/**
* Components that are mounted and receiving new state are guarded against
* additional state changes.
*/
RECEIVING_STATE: null
});
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {?object} initialProps
* @param {*} children
* @final
* @internal
*/
construct: function(initialProps, children) {
// Children can be either an array or more than one argument
ReactComponent.Mixin.construct.apply(this, arguments);
this.state = null;
this._pendingState = null;
this._compositeLifeCycleState = null;
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function() {
return ReactComponent.Mixin.isMounted.call(this) &&
this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: ReactPerf.measure(
'ReactCompositeComponent',
'mountComponent',
function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
this,
rootID,
transaction,
mountDepth
);
this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING;
this._defaultProps = this.getDefaultProps ? this.getDefaultProps() : null;
this._processProps(this.props);
if (this.__reactAutoBindMap) {
this._bindAutoBindMethods();
}
this.state = this.getInitialState ? this.getInitialState() : null;
this._pendingState = null;
this._pendingForceUpdate = false;
if (this.componentWillMount) {
this.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingState` without triggering a re-render.
if (this._pendingState) {
this.state = this._pendingState;
this._pendingState = null;
}
}
this._renderedComponent = this._renderValidatedComponent();
// Done with mounting, `setState` will now trigger UI changes.
this._compositeLifeCycleState = null;
var markup = this._renderedComponent.mountComponent(
rootID,
transaction,
mountDepth + 1
);
if (this.componentDidMount) {
transaction.getReactMountReady().enqueue(this, this.componentDidMount);
}
return markup;
}
),
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function() {
this._compositeLifeCycleState = CompositeLifeCycle.UNMOUNTING;
if (this.componentWillUnmount) {
this.componentWillUnmount();
}
this._compositeLifeCycleState = null;
this._defaultProps = null;
ReactComponent.Mixin.unmountComponent.call(this);
this._renderedComponent.unmountComponent();
this._renderedComponent = null;
if (this.refs) {
this.refs = null;
}
// Some existing components rely on this.props even after they've been
// destroyed (in event handlers).
// TODO: this.props = null;
// TODO: this.state = null;
},
/**
* Sets a subset of the state. Always use this or `replaceState` 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.
*
* @param {object} partialState Next partial state to be merged with state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
setState: function(partialState, callback) {
// Merge with `_pendingState` if it exists, otherwise with existing state.
this.replaceState(
merge(this._pendingState || this.state, partialState),
callback
);
},
/**
* 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 {object} completeState Next state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
replaceState: function(completeState, callback) {
validateLifeCycleOnReplaceState(this);
this._pendingState = completeState;
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid.
*
* @param {object} props
* @private
*/
_processProps: function(props) {
var propName;
var defaultProps = this._defaultProps;
for (propName in defaultProps) {
if (!(propName in props)) {
props[propName] = defaultProps[propName];
}
}
var propTypes = this.constructor.propTypes;
if (propTypes) {
var componentName = this.constructor.displayName;
for (propName in propTypes) {
var checkProp = propTypes[propName];
if (checkProp) {
checkProp(props, propName, componentName);
}
}
}
},
performUpdateIfNecessary: function() {
var compositeLifeCycleState = this._compositeLifeCycleState;
// Do not trigger a state transition if we are in the middle of mounting or
// receiving props because both of those will already be doing this.
if (compositeLifeCycleState === CompositeLifeCycle.MOUNTING ||
compositeLifeCycleState === CompositeLifeCycle.RECEIVING_PROPS) {
return;
}
ReactComponent.Mixin.performUpdateIfNecessary.call(this);
},
/**
* If any of `_pendingProps`, `_pendingState`, or `_pendingForceUpdate` is
* set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_performUpdateIfNecessary: function(transaction) {
if (this._pendingProps == null &&
this._pendingState == null &&
!this._pendingForceUpdate) {
return;
}
var nextProps = this.props;
if (this._pendingProps != null) {
nextProps = this._pendingProps;
this._processProps(nextProps);
this._pendingProps = null;
this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS;
if (this.componentWillReceiveProps) {
this.componentWillReceiveProps(nextProps, transaction);
}
}
this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_STATE;
var nextState = this._pendingState || this.state;
this._pendingState = null;
if (this._pendingForceUpdate ||
!this.shouldComponentUpdate ||
this.shouldComponentUpdate(nextProps, nextState)) {
this._pendingForceUpdate = false;
// Will set `this.props` and `this.state`.
this._performComponentUpdate(nextProps, nextState, transaction);
} else {
// If it's determined that a component should not update, we still want
// to set props and state.
this.props = nextProps;
this.state = nextState;
}
this._compositeLifeCycleState = null;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {object} nextProps Next object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_performComponentUpdate: function(nextProps, nextState, transaction) {
var prevProps = this.props;
var prevState = this.state;
if (this.componentWillUpdate) {
this.componentWillUpdate(nextProps, nextState, transaction);
}
this.props = nextProps;
this.state = nextState;
this.updateComponent(transaction, prevProps, prevState);
if (this.componentDidUpdate) {
transaction.getReactMountReady().enqueue(
this,
this.componentDidUpdate.bind(this, prevProps, prevState)
);
}
},
/**
* 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
* @param {object} prevProps
* @param {?object} prevState
* @internal
* @overridable
*/
updateComponent: ReactPerf.measure(
'ReactCompositeComponent',
'updateComponent',
function(transaction, prevProps, prevState) {
ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);
var currentComponent = this._renderedComponent;
var nextComponent = this._renderValidatedComponent();
if (currentComponent.constructor === nextComponent.constructor) {
currentComponent.receiveProps(nextComponent.props, transaction);
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var currentComponentID = currentComponent._rootNodeID;
currentComponent.unmountComponent();
this._renderedComponent = nextComponent;
var nextMarkup = nextComponent.mountComponent(
thisID,
transaction,
this._mountDepth + 1
);
ReactComponent.DOMIDOperations.dangerouslyReplaceNodeWithMarkupByID(
currentComponentID,
nextMarkup
);
}
}
),
/**
* 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 `shouldUpdateComponent`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
forceUpdate: function(callback) {
var compositeLifeCycleState = this._compositeLifeCycleState;
invariant(
this.isMounted() ||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING,
'forceUpdate(...): Can only force an update on mounted or mounting ' +
'components.'
);
invariant(
compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&
compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
'forceUpdate(...): Cannot force an update while unmounting component ' +
'or during an existing state transition (such as within `render`).'
);
this._pendingForceUpdate = true;
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* @private
*/
_renderValidatedComponent: function() {
var renderedComponent;
ReactCurrentOwner.current = this;
try {
renderedComponent = this.render();
} catch (error) {
// IE8 requires `catch` in order to use `finally`.
throw error;
} finally {
ReactCurrentOwner.current = null;
}
invariant(
ReactComponent.isValidComponent(renderedComponent),
'%s.render(): A valid ReactComponent must be returned.',
this.constructor.displayName || 'ReactCompositeComponent'
);
return renderedComponent;
},
/**
* @private
*/
_bindAutoBindMethods: function() {
for (var autoBindKey in this.__reactAutoBindMap) {
if (!this.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
continue;
}
var method = this.__reactAutoBindMap[autoBindKey];
this[autoBindKey] = this._bindAutoBindMethod(method);
}
},
/**
* Binds a method to the component.
*
* @param {function} method Method to be bound.
* @private
*/
_bindAutoBindMethod: function(method) {
var component = this;
var boundMethod = function() {
return method.apply(component, arguments);
};
if (true) {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
boundMethod.bind = function(newThis) {
// 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) {
console.warn(
'bind(): React component methods may only be bound to the ' +
'component instance. See ' + componentName
);
} else if (arguments.length === 1) {
console.warn(
'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 ' + componentName
);
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments =
Array.prototype.slice.call(arguments, 1);
return reboundMethod;
};
}
return boundMethod;
}
};
var ReactCompositeComponentBase = function() {};
mixInto(ReactCompositeComponentBase, ReactComponent.Mixin);
mixInto(ReactCompositeComponentBase, ReactOwner.Mixin);
mixInto(ReactCompositeComponentBase, ReactPropTransferer.Mixin);
mixInto(ReactCompositeComponentBase, ReactCompositeComponentMixin);
/**
* Module for creating composite components.
*
* @class ReactCompositeComponent
* @extends ReactComponent
* @extends ReactOwner
* @extends ReactPropTransferer
*/
var ReactCompositeComponent = {
LifeCycle: CompositeLifeCycle,
Base: ReactCompositeComponentBase,
/**
* Creates a composite component class given a class specification.
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function(spec) {
var Constructor = function() {};
Constructor.prototype = new ReactCompositeComponentBase();
Constructor.prototype.constructor = Constructor;
mixSpecIntoComponent(Constructor, spec);
invariant(
Constructor.prototype.render,
'createClass(...): Class specification must implement a `render` method.'
);
if (true) {
if (Constructor.prototype.componentShouldUpdate) {
console.warn(
(spec.displayName || 'A component') + ' 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.'
);
}
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactCompositeComponentInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
var ConvenienceConstructor = function(props, children) {
var instance = new Constructor();
instance.construct.apply(instance, arguments);
return instance;
};
ConvenienceConstructor.componentConstructor = Constructor;
ConvenienceConstructor.originalSpec = spec;
return ConvenienceConstructor;
},
/**
* Checks if a value is a valid component constructor.
*
* @param {*}
* @return {boolean}
* @public
*/
isValidClass: function(componentClass) {
return componentClass instanceof Function &&
'componentConstructor' in componentClass &&
componentClass.componentConstructor instanceof Function;
}
};
module.exports = ReactCompositeComponent;
},{"./ReactComponent":28,"./ReactCurrentOwner":32,"./ReactOwner":57,"./ReactPerf":58,"./ReactPropTransferer":59,"./ReactUpdates":69,"./invariant":106,"./keyMirror":112,"./merge":115,"./mixInto":118,"./objMap":121}],32:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactCurrentOwner
*/
"use strict";
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*
* The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
},{}],33:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOM
* @typechecks static-only
*/
"use strict";
var ReactDOMComponent = require("./ReactDOMComponent");
var mergeInto = require("./mergeInto");
var objMapKeyVal = require("./objMapKeyVal");
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @param {string} tag Tag name (e.g. `div`).
* @param {boolean} omitClose True if the close tag should be omitted.
* @private
*/
function createDOMComponentClass(tag, omitClose) {
var Constructor = function() {};
Constructor.prototype = new ReactDOMComponent(tag, omitClose);
Constructor.prototype.constructor = Constructor;
Constructor.displayName = tag;
var ConvenienceConstructor = function(props, children) {
var instance = new Constructor();
instance.construct.apply(instance, arguments);
return instance;
};
ConvenienceConstructor.componentConstructor = Constructor;
return ConvenienceConstructor;
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOM = objMapKeyVal({
a: false,
abbr: false,
address: false,
area: false,
article: false,
aside: false,
audio: false,
b: false,
base: false,
bdi: false,
bdo: false,
big: false,
blockquote: false,
body: false,
br: true,
button: false,
canvas: false,
caption: false,
cite: false,
code: false,
col: true,
colgroup: false,
data: false,
datalist: false,
dd: false,
del: false,
details: false,
dfn: false,
div: false,
dl: false,
dt: false,
em: false,
embed: true,
fieldset: false,
figcaption: false,
figure: false,
footer: false,
form: false, // NOTE: Injected, see `ReactDOMForm`.
h1: false,
h2: false,
h3: false,
h4: false,
h5: false,
h6: false,
head: false,
header: false,
hr: true,
html: false,
i: false,
iframe: false,
img: true,
input: true,
ins: false,
kbd: false,
keygen: true,
label: false,
legend: false,
li: false,
link: false,
main: false,
map: false,
mark: false,
menu: false,
menuitem: false, // NOTE: Close tag should be omitted, but causes problems.
meta: true,
meter: false,
nav: false,
noscript: false,
object: false,
ol: false,
optgroup: false,
option: false,
output: false,
p: false,
param: true,
pre: false,
progress: false,
q: false,
rp: false,
rt: false,
ruby: false,
s: false,
samp: false,
script: false,
section: false,
select: false,
small: false,
source: false,
span: false,
strong: false,
style: false,
sub: false,
summary: false,
sup: false,
table: false,
tbody: false,
td: false,
textarea: false, // NOTE: Injected, see `ReactDOMTextarea`.
tfoot: false,
th: false,
thead: false,
time: false,
title: false,
tr: false,
track: true,
u: false,
ul: false,
'var': false,
video: false,
wbr: false,
// SVG
circle: false,
g: false,
line: false,
path: false,
polyline: false,
rect: false,
svg: false,
text: false
}, createDOMComponentClass);
var injection = {
injectComponentClasses: function(componentClasses) {
mergeInto(ReactDOM, componentClasses);
}
};
ReactDOM.injection = injection;
module.exports = ReactDOM;
},{"./ReactDOMComponent":35,"./mergeInto":117,"./objMapKeyVal":122}],34:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMButton
*/
"use strict";
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactDOM = require("./ReactDOM");
var keyMirror = require("./keyMirror");
// Store a reference to the <button> `ReactDOMComponent`.
var button = ReactDOM.button;
var mouseListenerNames = keyMirror({
onClick: true,
onDoubleClick: true,
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
});
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = ReactCompositeComponent.createClass({
render: function() {
var props = {};
// Copy the props; except the mouse listeners if we're disabled
for (var key in this.props) {
if (this.props.hasOwnProperty(key) &&
(!this.props.disabled || !mouseListenerNames[key])) {
props[key] = this.props[key];
}
}
return button(props, this.props.children);
}
});
module.exports = ReactDOMButton;
},{"./ReactCompositeComponent":31,"./ReactDOM":33,"./keyMirror":112}],35:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMComponent
* @typechecks static-only
*/
"use strict";
var CSSPropertyOperations = require("./CSSPropertyOperations");
var DOMProperty = require("./DOMProperty");
var DOMPropertyOperations = require("./DOMPropertyOperations");
var ReactComponent = require("./ReactComponent");
var ReactEventEmitter = require("./ReactEventEmitter");
var ReactMultiChild = require("./ReactMultiChild");
var ReactMount = require("./ReactMount");
var ReactPerf = require("./ReactPerf");
var escapeTextForBrowser = require("./escapeTextForBrowser");
var invariant = require("./invariant");
var keyOf = require("./keyOf");
var merge = require("./merge");
var mixInto = require("./mixInto");
var putListener = ReactEventEmitter.putListener;
var deleteListener = ReactEventEmitter.deleteListener;
var registrationNames = ReactEventEmitter.registrationNames;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = {'string': true, 'number': true};
var STYLE = keyOf({style: null});
/**
* @param {?object} props
*/
function assertValidProps(props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
invariant(
props.children == null || props.dangerouslySetInnerHTML == null,
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
);
invariant(
props.style == null || typeof props.style === 'object',
'The `style` prop expects a mapping from style properties to values, ' +
'not a string.'
);
}
/**
* @constructor ReactDOMComponent
* @extends ReactComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(tag, omitClose) {
this._tagOpen = '<' + tag;
this._tagClose = omitClose ? '' : '</' + tag + '>';
this.tagName = tag.toUpperCase();
}
ReactDOMComponent.Mixin = {
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy
* @return {string} The computed markup.
*/
mountComponent: ReactPerf.measure(
'ReactDOMComponent',
'mountComponent',
function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
this,
rootID,
transaction,
mountDepth
);
assertValidProps(this.props);
return (
this._createOpenTagMarkup() +
this._createContentMarkup(transaction) +
this._tagClose
);
}
),
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkup: function() {
var props = this.props;
var ret = this._tagOpen;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNames[propKey]) {
putListener(this._rootNodeID, propKey, propValue);
} else {
if (propKey === STYLE) {
if (propValue) {
propValue = props.style = merge(props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
var markup =
DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
if (markup) {
ret += ' ' + markup;
}
}
}
var escapedID = escapeTextForBrowser(this._rootNodeID);
return ret + ' ' + ReactMount.ATTR_NAME + '="' + escapedID + '">';
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction} transaction
* @return {string} Content markup.
*/
_createContentMarkup: function(transaction) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = this.props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
return innerHTML.__html;
}
} else {
var contentToUse =
CONTENT_TYPES[typeof this.props.children] ? this.props.children : null;
var childrenToUse = contentToUse != null ? null : this.props.children;
if (contentToUse != null) {
return escapeTextForBrowser(contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(
childrenToUse,
transaction
);
return mountImages.join('');
}
}
return '';
},
receiveProps: function(nextProps, transaction) {
assertValidProps(nextProps);
ReactComponent.Mixin.receiveProps.call(this, nextProps, transaction);
},
/**
* Updates a native DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {object} prevProps
* @internal
* @overridable
*/
updateComponent: ReactPerf.measure(
'ReactDOMComponent',
'updateComponent',
function(transaction, prevProps) {
ReactComponent.Mixin.updateComponent.call(this, transaction, prevProps);
this._updateDOMProperties(prevProps);
this._updateDOMChildren(prevProps, transaction);
}
),
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
*/
_updateDOMProperties: function(lastProps) {
var nextProps = this.props;
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) ||
!lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
var lastStyle = lastProps[propKey];
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
} else if (registrationNames[propKey]) {
deleteListener(this._rootNodeID, propKey);
} else if (
DOMProperty.isStandardName[propKey] ||
DOMProperty.isCustomAttribute(propKey)) {
ReactComponent.DOMIDOperations.deletePropertyByID(
this._rootNodeID,
propKey
);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
nextProp = nextProps.style = merge(nextProp);
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) &&
!nextProp.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) &&
lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNames[propKey]) {
putListener(this._rootNodeID, propKey, nextProp);
} else if (
DOMProperty.isStandardName[propKey] ||
DOMProperty.isCustomAttribute(propKey)) {
ReactComponent.DOMIDOperations.updatePropertyByID(
this._rootNodeID,
propKey,
nextProp
);
}
}
if (styleUpdates) {
ReactComponent.DOMIDOperations.updateStylesByID(
this._rootNodeID,
styleUpdates
);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {ReactReconcileTransaction} transaction
*/
_updateDOMChildren: function(lastProps, transaction) {
var nextProps = this.props;
var lastContent =
CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent =
CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml =
lastProps.dangerouslySetInnerHTML &&
lastProps.dangerouslySetInnerHTML.__html;
var nextHtml =
nextProps.dangerouslySetInnerHTML &&
nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
ReactComponent.DOMIDOperations.updateInnerHTMLByID(
this._rootNodeID,
nextHtml
);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction);
}
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function() {
ReactEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponent.Mixin.unmountComponent.call(this);
this.unmountChildren();
}
};
mixInto(ReactDOMComponent, ReactComponent.Mixin);
mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
mixInto(ReactDOMComponent, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
},{"./CSSPropertyOperations":4,"./DOMProperty":9,"./DOMPropertyOperations":10,"./ReactComponent":28,"./ReactEventEmitter":46,"./ReactMount":53,"./ReactMultiChild":55,"./ReactPerf":58,"./escapeTextForBrowser":93,"./invariant":106,"./keyOf":113,"./merge":115,"./mixInto":118}],36:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMForm
*/
"use strict";
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactDOM = require("./ReactDOM");
var ReactEventEmitter = require("./ReactEventEmitter");
var EventConstants = require("./EventConstants");
// Store a reference to the <form> `ReactDOMComponent`.
var form = ReactDOM.form;
/**
* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
* to capture it on the <form> element itself. There are lots of hacks we could
* do to accomplish this, but the most reliable is to make <form> a
* composite component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMForm = ReactCompositeComponent.createClass({
render: function() {
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
// `jshint` fails to parse JSX so in order for linting to work in the open
// source repo, we need to just use `ReactDOM.form`.
return this.transferPropsTo(form(null, this.props.children));
},
componentDidMount: function(node) {
ReactEventEmitter.trapBubbledEvent(
EventConstants.topLevelTypes.topSubmit,
'submit',
node
);
}
});
module.exports = ReactDOMForm;
},{"./EventConstants":15,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactEventEmitter":46}],37:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMIDOperations
* @typechecks static-only
*/
/*jslint evil: true */
"use strict";
var CSSPropertyOperations = require("./CSSPropertyOperations");
var DOMChildrenOperations = require("./DOMChildrenOperations");
var DOMPropertyOperations = require("./DOMPropertyOperations");
var ReactMount = require("./ReactMount");
var getTextContentAccessor = require("./getTextContentAccessor");
var invariant = require("./invariant");
/**
* Errors for properties that should not be updated with `updatePropertyById()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
dangerouslySetInnerHTML:
'`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
* The DOM property to use when setting text content.
*
* @type {string}
* @private
*/
var textContentAccessor = getTextContentAccessor() || 'NA';
var LEADING_SPACE = /^ /;
/**
* Operations used to process updates to DOM nodes. This is made injectable via
* `ReactComponent.DOMIDOperations`.
*/
var ReactDOMIDOperations = {
/**
* Updates a DOM node with new property values. This should only be used to
* update DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name, see `DOMProperty`.
* @param {*} value New value of the property.
* @internal
*/
updatePropertyByID: function(id, name, value) {
var node = ReactMount.getNode(id);
invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
);
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (value != null) {
DOMPropertyOperations.setValueForProperty(node, name, value);
} else {
DOMPropertyOperations.deleteValueForProperty(node, name);
}
},
/**
* Updates a DOM node to remove a property. This should only be used to remove
* DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A property name to remove, see `DOMProperty`.
* @internal
*/
deletePropertyByID: function(id, name, value) {
var node = ReactMount.getNode(id);
invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
);
DOMPropertyOperations.deleteValueForProperty(node, name, value);
},
/**
* This should almost never be used instead of `updatePropertyByID()` due to
* the extra object allocation required by the API. That said, this is useful
* for batching up several operations across worker thread boundaries.
*
* @param {string} id ID of the node to update.
* @param {object} properties A mapping of valid property names.
* @internal
* @see {ReactDOMIDOperations.updatePropertyByID}
*/
updatePropertiesByID: function(id, properties) {
for (var name in properties) {
if (!properties.hasOwnProperty(name)) {
continue;
}
ReactDOMIDOperations.updatePropertiesByID(id, name, properties[name]);
}
},
/**
* Updates a DOM node with new style values. If a value is specified as '',
* the corresponding style property will be unset.
*
* @param {string} id ID of the node to update.
* @param {object} styles Mapping from styles to values.
* @internal
*/
updateStylesByID: function(id, styles) {
var node = ReactMount.getNode(id);
CSSPropertyOperations.setValueForStyles(node, styles);
},
/**
* Updates a DOM node's innerHTML.
*
* @param {string} id ID of the node to update.
* @param {string} html An HTML string.
* @internal
*/
updateInnerHTMLByID: function(id, html) {
var node = ReactMount.getNode(id);
// HACK: IE8- normalize whitespace in innerHTML, removing leading spaces.
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
node.innerHTML = html.replace(LEADING_SPACE, ' ');
},
/**
* Updates a DOM node's text content set by `props.content`.
*
* @param {string} id ID of the node to update.
* @param {string} content Text content.
* @internal
*/
updateTextContentByID: function(id, content) {
var node = ReactMount.getNode(id);
node[textContentAccessor] = content;
},
/**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
* @param {string} markup Dangerous markup to inject in place of child.
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markup List of markup strings.
* @internal
*/
dangerouslyProcessChildrenUpdates: function(updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
DOMChildrenOperations.processUpdates(updates, markup);
}
};
module.exports = ReactDOMIDOperations;
},{"./CSSPropertyOperations":4,"./DOMChildrenOperations":8,"./DOMPropertyOperations":10,"./ReactMount":53,"./getTextContentAccessor":104,"./invariant":106}],38:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMInput
*/
"use strict";
var DOMPropertyOperations = require("./DOMPropertyOperations");
var LinkedValueMixin = require("./LinkedValueMixin");
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactDOM = require("./ReactDOM");
var ReactMount = require("./ReactMount");
var invariant = require("./invariant");
var merge = require("./merge");
// Store a reference to the <input> `ReactDOMComponent`.
var input = ReactDOM.input;
var instancesByReactID = {};
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = ReactCompositeComponent.createClass({
mixins: [LinkedValueMixin],
getInitialState: function() {
var defaultValue = this.props.defaultValue;
return {
checked: this.props.defaultChecked || false,
value: defaultValue != null ? defaultValue : ''
};
},
shouldComponentUpdate: function() {
// Defer any updates to this component during the `onChange` handler.
return !this._isChanging;
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
props.defaultChecked = null;
props.defaultValue = null;
props.checked =
this.props.checked != null ? this.props.checked : this.state.checked;
var value = this.getValue();
props.value = value != null ? value : this.state.value;
props.onChange = this._handleChange;
return input(props, this.props.children);
},
componentDidMount: function(rootNode) {
var id = ReactMount.getID(rootNode);
instancesByReactID[id] = this;
},
componentWillUnmount: function() {
var rootNode = this.getDOMNode();
var id = ReactMount.getID(rootNode);
delete instancesByReactID[id];
},
componentDidUpdate: function(prevProps, prevState, rootNode) {
if (this.props.checked != null) {
DOMPropertyOperations.setValueForProperty(
rootNode,
'checked',
this.props.checked || false
);
}
var value = this.getValue();
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = this.getOnChange();
if (onChange) {
this._isChanging = true;
returnValue = onChange(event);
this._isChanging = false;
}
this.setState({
checked: event.target.checked,
value: event.target.value
});
var name = this.props.name;
if (this.props.type === 'radio' && name != null) {
var rootNode = this.getDOMNode();
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `getElementsByName` to ensure we don't miss anything.
var group = document.getElementsByName(name);
for (var i = 0, groupLen = group.length; i < groupLen; i++) {
var otherNode = group[i];
if (otherNode === rootNode ||
otherNode.nodeName !== 'INPUT' || otherNode.type !== 'radio' ||
otherNode.form !== rootNode.form) {
continue;
}
var otherID = ReactMount.getID(otherNode);
invariant(
otherID,
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
'same `name` is not supported.'
);
var otherInstance = instancesByReactID[otherID];
invariant(
otherInstance,
'ReactDOMInput: Unknown radio button ID %s.',
otherID
);
// In some cases, this will actually change the `checked` state value.
// In other cases, there's no change but this forces a reconcile upon
// which componentDidUpdate will reset the DOM property to whatever it
// should be.
otherInstance.setState({
checked: false
});
}
}
return returnValue;
}
});
module.exports = ReactDOMInput;
},{"./DOMPropertyOperations":10,"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactMount":53,"./invariant":106,"./merge":115}],39:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMOption
*/
"use strict";
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactDOM = require("./ReactDOM");
// Store a reference to the <option> `ReactDOMComponent`.
var option = ReactDOM.option;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = ReactCompositeComponent.createClass({
componentWillMount: function() {
// TODO (yungsters): Remove support for `selected` in <option>.
if (this.props.selected != null) {
if (true) {
console.warn(
'Use the `defaultValue` or `value` props on <select> instead of ' +
'setting `selected` on <option>.'
);
}
}
},
render: function() {
return option(this.props, this.props.children);
}
});
module.exports = ReactDOMOption;
},{"./ReactCompositeComponent":31,"./ReactDOM":33}],40:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMSelect
*/
"use strict";
var LinkedValueMixin = require("./LinkedValueMixin");
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactDOM = require("./ReactDOM");
var invariant = require("./invariant");
var merge = require("./merge");
// Store a reference to the <select> `ReactDOMComponent`.
var select = ReactDOM.select;
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function selectValueType(props, propName, componentName) {
if (props[propName] == null) {
return;
}
if (props.multiple) {
invariant(
Array.isArray(props[propName]),
'The `%s` prop supplied to <select> must be an array if `multiple` is ' +
'true.',
propName
);
} else {
invariant(
!Array.isArray(props[propName]),
'The `%s` prop supplied to <select> must be a scalar value if ' +
'`multiple` is false.',
propName
);
}
}
/**
* If `value` is supplied, updates <option> elements on mount and update.
* @private
*/
function updateOptions() {
/*jshint validthis:true */
var propValue = this.getValue();
var value = propValue != null ? propValue : this.state.value;
var options = this.getDOMNode().options;
var selectedValue = '' + value;
for (var i = 0, l = options.length; i < l; i++) {
var selected = this.props.multiple ?
selectedValue.indexOf(options[i].value) >= 0 :
selected = options[i].value === selectedValue;
if (selected !== options[i].selected) {
options[i].selected = selected;
}
}
}
/**
* Implements a <select> native component that allows optionally setting the
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
* string. If `multiple` is true, the prop must be an array of strings.
*
* 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 = ReactCompositeComponent.createClass({
mixins: [LinkedValueMixin],
propTypes: {
defaultValue: selectValueType,
value: selectValueType
},
getInitialState: function() {
return {value: this.props.defaultValue || (this.props.multiple ? [] : '')};
},
componentWillReceiveProps: function(nextProps) {
if (!this.props.multiple && nextProps.multiple) {
this.setState({value: [this.state.value]});
} else if (this.props.multiple && !nextProps.multiple) {
this.setState({value: this.state.value[0]});
}
},
shouldComponentUpdate: function() {
// Defer any updates to this component during the `onChange` handler.
return !this._isChanging;
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
props.onChange = this._handleChange;
props.value = null;
return select(props, this.props.children);
},
componentDidMount: updateOptions,
componentDidUpdate: updateOptions,
_handleChange: function(event) {
var returnValue;
var onChange = this.getOnChange();
if (onChange) {
this._isChanging = true;
returnValue = onChange(event);
this._isChanging = false;
}
var selectedValue;
if (this.props.multiple) {
selectedValue = [];
var options = event.target.options;
for (var i = 0, l = options.length; i < l; i++) {
if (options[i].selected) {
selectedValue.push(options[i].value);
}
}
} else {
selectedValue = event.target.value;
}
this.setState({value: selectedValue});
return returnValue;
}
});
module.exports = ReactDOMSelect;
},{"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./invariant":106,"./merge":115}],41:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMSelection
*/
"use strict";
var getNodeForCharacterOffset = require("./getNodeForCharacterOffset");
var getTextContentAccessor = require("./getTextContentAccessor");
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection();
if (selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
var rangeLength = currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var start = tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
detectionRange.detach();
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (typeof offsets.end === 'undefined') {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = typeof offsets.end === 'undefined' ?
start : Math.min(offsets.end, length);
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
range.detach();
}
}
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: function(node) {
var getOffsets = document.selection ? getIEOffsets : getModernOffsets;
return getOffsets(node);
},
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: function(node, offsets) {
var setOffsets = document.selection ? setIEOffsets : setModernOffsets;
setOffsets(node, offsets);
}
};
module.exports = ReactDOMSelection;
},{"./getNodeForCharacterOffset":102,"./getTextContentAccessor":104}],42:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMTextarea
*/
"use strict";
var DOMPropertyOperations = require("./DOMPropertyOperations");
var LinkedValueMixin = require("./LinkedValueMixin");
var ReactCompositeComponent = require("./ReactCompositeComponent");
var ReactDOM = require("./ReactDOM");
var invariant = require("./invariant");
var merge = require("./merge");
// Store a reference to the <textarea> `ReactDOMComponent`.
var textarea = ReactDOM.textarea;
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = ReactCompositeComponent.createClass({
mixins: [LinkedValueMixin],
getInitialState: function() {
var defaultValue = this.props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = this.props.children;
if (children != null) {
if (true) {
console.warn(
'Use the `defaultValue` or `value` props instead of setting ' +
'children on <textarea>.'
);
}
invariant(
defaultValue == null,
'If you supply `defaultValue` on a <textarea>, do not pass children.'
);
if (Array.isArray(children)) {
invariant(
children.length <= 1,
'<textarea> can only have at most one child.'
);
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
var value = this.getValue();
return {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue),
value: defaultValue
};
},
shouldComponentUpdate: function() {
// Defer any updates to this component during the `onChange` handler.
return !this._isChanging;
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
var value = this.getValue();
invariant(
props.dangerouslySetInnerHTML == null,
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
);
props.defaultValue = null;
props.value = value != null ? value : this.state.value;
props.onChange = this._handleChange;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
return textarea(props, this.state.initialValue);
},
componentDidUpdate: function(prevProps, prevState, rootNode) {
var value = this.getValue();
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = this.getOnChange();
if (onChange) {
this._isChanging = true;
returnValue = onChange(event);
this._isChanging = false;
}
this.setState({value: event.target.value});
return returnValue;
}
});
module.exports = ReactDOMTextarea;
},{"./DOMPropertyOperations":10,"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./invariant":106,"./merge":115}],43:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultBatchingStrategy
*/
"use strict";
var ReactUpdates = require("./ReactUpdates");
var Transaction = require("./Transaction");
var emptyFunction = require("./emptyFunction");
var mixInto = require("./mixInto");
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function() {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
mixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin);
mixInto(ReactDefaultBatchingStrategyTransaction, {
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
}
});
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function(callback, param) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(param);
} else {
transaction.perform(callback, null, param);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
},{"./ReactUpdates":69,"./Transaction":82,"./emptyFunction":92,"./mixInto":118}],44:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultInjection
*/
"use strict";
var ReactDOM = require("./ReactDOM");
var ReactDOMButton = require("./ReactDOMButton");
var ReactDOMForm = require("./ReactDOMForm");
var ReactDOMInput = require("./ReactDOMInput");
var ReactDOMOption = require("./ReactDOMOption");
var ReactDOMSelect = require("./ReactDOMSelect");
var ReactDOMTextarea = require("./ReactDOMTextarea");
var ReactEventEmitter = require("./ReactEventEmitter");
var ReactEventTopLevelCallback = require("./ReactEventTopLevelCallback");
var ReactPerf = require("./ReactPerf");
var DefaultDOMPropertyConfig = require("./DefaultDOMPropertyConfig");
var DOMProperty = require("./DOMProperty");
var ChangeEventPlugin = require("./ChangeEventPlugin");
var CompositionEventPlugin = require("./CompositionEventPlugin");
var DefaultEventPluginOrder = require("./DefaultEventPluginOrder");
var EnterLeaveEventPlugin = require("./EnterLeaveEventPlugin");
var EventPluginHub = require("./EventPluginHub");
var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
var ReactInstanceHandles = require("./ReactInstanceHandles");
var SelectEventPlugin = require("./SelectEventPlugin");
var SimpleEventPlugin = require("./SimpleEventPlugin");
var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
var ReactUpdates = require("./ReactUpdates");
function inject() {
ReactEventEmitter.TopLevelCallbackCreator = ReactEventTopLevelCallback;
/**
* Inject module for resolving DOM hierarchy and plugin ordering.
*/
EventPluginHub.injection.injectEventPluginOrder(DefaultEventPluginOrder);
EventPluginHub.injection.injectInstanceHandle(ReactInstanceHandles);
/**
* Some important event plugins included by default (without having to require
* them).
*/
EventPluginHub.injection.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
CompositionEventPlugin: CompositionEventPlugin,
MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin
});
ReactDOM.injection.injectComponentClasses({
button: ReactDOMButton,
form: ReactDOMForm,
input: ReactDOMInput,
option: ReactDOMOption,
select: ReactDOMSelect,
textarea: ReactDOMTextarea
});
DOMProperty.injection.injectDOMPropertyConfig(DefaultDOMPropertyConfig);
if (true) {
ReactPerf.injection.injectMeasure(require("./ReactDefaultPerf").measure);
}
ReactUpdates.injection.injectBatchingStrategy(
ReactDefaultBatchingStrategy
);
}
module.exports = {
inject: inject
};
},{"./ChangeEventPlugin":6,"./CompositionEventPlugin":7,"./DOMProperty":9,"./DefaultDOMPropertyConfig":12,"./DefaultEventPluginOrder":13,"./EnterLeaveEventPlugin":14,"./EventPluginHub":17,"./MobileSafariClickEventPlugin":24,"./ReactDOM":33,"./ReactDOMButton":34,"./ReactDOMForm":36,"./ReactDOMInput":38,"./ReactDOMOption":39,"./ReactDOMSelect":40,"./ReactDOMTextarea":42,"./ReactDefaultBatchingStrategy":43,"./ReactDefaultPerf":45,"./ReactEventEmitter":46,"./ReactEventTopLevelCallback":48,"./ReactInstanceHandles":50,"./ReactPerf":58,"./ReactUpdates":69,"./SelectEventPlugin":71,"./SimpleEventPlugin":72}],45:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultPerf
* @typechecks static-only
*/
"use strict";
var performanceNow = require("./performanceNow");
var ReactDefaultPerf = {};
if (true) {
ReactDefaultPerf = {
/**
* Gets the stored information for a given object's function.
*
* @param {string} objName
* @param {string} fnName
* @return {?object}
*/
getInfo: function(objName, fnName) {
if (!this.info[objName] || !this.info[objName][fnName]) {
return null;
}
return this.info[objName][fnName];
},
/**
* Gets the logs pertaining to a given object's function.
*
* @param {string} objName
* @param {string} fnName
* @return {?array<object>}
*/
getLogs: function(objName, fnName) {
if (!this.getInfo(objName, fnName)) {
return null;
}
return this.logs.filter(function(log) {
return log.objName === objName && log.fnName === fnName;
});
},
/**
* Runs through the logs and builds an array of arrays, where each array
* walks through the mounting/updating of each component underneath.
*
* @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]'
* @return {array<array>}
*/
getRawRenderHistory: function(rootID) {
var history = [];
/**
* Since logs are added after the method returns, the logs are in a sense
* upside-down: the inner-most elements from mounting/updating are logged
* first, and the last addition to the log is the top renderComponent.
* Therefore, we flip the logs upside down for ease of processing, and
* reverse the history array at the end so the earliest event has index 0.
*/
var logs = this.logs.filter(function(log) {
return log.reactID.indexOf(rootID) === 0;
}).reverse();
var subHistory = [];
logs.forEach(function(log, i) {
if (i && log.reactID === rootID && logs[i - 1].reactID !== rootID) {
subHistory.length && history.push(subHistory);
subHistory = [];
}
subHistory.push(log);
});
if (subHistory.length) {
history.push(subHistory);
}
return history.reverse();
},
/**
* Runs through the logs and builds an array of strings, where each string
* is a multiline formatted way of walking through the mounting/updating
* underneath.
*
* @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]'
* @return {array<string>}
*/
getRenderHistory: function(rootID) {
var history = this.getRawRenderHistory(rootID);
return history.map(function(subHistory) {
var headerString = (
'log# Component (execution time) [bloat from logging]\n' +
'================================================================\n'
);
return headerString + subHistory.map(function(log) {
// Add two spaces for every layer in the reactID.
var indents = '\t' + Array(log.reactID.split('.[').length).join(' ');
var delta = _microTime(log.timing.delta);
var bloat = _microTime(log.timing.timeToLog);
return log.index + indents + log.name + ' (' + delta + 'ms)' +
' [' + bloat + 'ms]';
}).join('\n');
});
},
/**
* Print the render history from `getRenderHistory` using console.log.
* This is currently the best way to display perf data from
* any React component; working on that.
*
* @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]'
* @param {number} index
*/
printRenderHistory: function(rootID, index) {
var history = this.getRenderHistory(rootID);
if (!history[index]) {
console.warn(
'Index', index, 'isn\'t available! ' +
'The render history is', history.length, 'long.'
);
return;
}
console.log(
'Loading render history #' + (index + 1) +
' of ' + history.length + ':\n' + history[index]
);
},
/**
* Prints the heatmap legend to console, showing how the colors correspond
* with render times. This relies on console.log styles.
*/
printHeatmapLegend: function() {
if (!this.options.heatmap.enabled) {
return;
}
var max = this.info.React
&& this.info.React.renderComponent
&& this.info.React.renderComponent.max;
if (max) {
var logStr = 'Heatmap: ';
for (var ii = 0; ii <= 10 * max; ii += max) {
logStr += '%c ' + (Math.round(ii) / 10) + 'ms ';
}
console.log(
logStr,
'background-color: hsla(100, 100%, 50%, 0.6);',
'background-color: hsla( 90, 100%, 50%, 0.6);',
'background-color: hsla( 80, 100%, 50%, 0.6);',
'background-color: hsla( 70, 100%, 50%, 0.6);',
'background-color: hsla( 60, 100%, 50%, 0.6);',
'background-color: hsla( 50, 100%, 50%, 0.6);',
'background-color: hsla( 40, 100%, 50%, 0.6);',
'background-color: hsla( 30, 100%, 50%, 0.6);',
'background-color: hsla( 20, 100%, 50%, 0.6);',
'background-color: hsla( 10, 100%, 50%, 0.6);',
'background-color: hsla( 0, 100%, 50%, 0.6);'
);
}
},
/**
* Measure a given function with logging information, and calls a callback
* if there is one.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function(objName, fnName, func) {
var info = _getNewInfo(objName, fnName);
var fnArgs = _getFnArguments(func);
return function() {
var timeBeforeFn = performanceNow();
var fnReturn = func.apply(this, arguments);
var timeAfterFn = performanceNow();
/**
* Hold onto arguments in a readable way: args[1] -> args.component.
* args is also passed to the callback, so if you want to save an
* argument in the log, do so in the callback.
*/
var args = {};
for (var i = 0; i < arguments.length; i++) {
args[fnArgs[i]] = arguments[i];
}
var log = {
index: ReactDefaultPerf.logs.length,
fnName: fnName,
objName: objName,
timing: {
before: timeBeforeFn,
after: timeAfterFn,
delta: timeAfterFn - timeBeforeFn
}
};
ReactDefaultPerf.logs.push(log);
/**
* The callback gets:
* - this (the component)
* - the original method's arguments
* - what the method returned
* - the log object, and
* - the wrapped method's info object.
*/
var callback = _getCallback(objName, fnName);
callback && callback(this, args, fnReturn, log, info);
log.timing.timeToLog = performanceNow() - timeAfterFn;
return fnReturn;
};
},
/**
* Holds information on wrapped objects/methods.
* For instance, ReactDefaultPerf.info.React.renderComponent
*/
info: {},
/**
* Holds all of the logs. Filter this to pull desired information.
*/
logs: [],
/**
* Toggle settings for ReactDefaultPerf
*/
options: {
/**
* The heatmap sets the background color of the React containers
* according to how much total time has been spent rendering them.
* The most temporally expensive component is set as pure red,
* and the others are colored from green to red as a fraction
* of that max component time.
*/
heatmap: {
enabled: true
}
}
};
/**
* Gets a info area for a given object's function, adding a new one if
* necessary.
*
* @param {string} objName
* @param {string} fnName
* @return {object}
*/
var _getNewInfo = function(objName, fnName) {
var info = ReactDefaultPerf.getInfo(objName, fnName);
if (info) {
return info;
}
ReactDefaultPerf.info[objName] = ReactDefaultPerf.info[objName] || {};
return ReactDefaultPerf.info[objName][fnName] = {
getLogs: function() {
return ReactDefaultPerf.getLogs(objName, fnName);
}
};
};
/**
* Gets a list of the argument names from a function's definition.
* This is useful for storing arguments by their names within wrapFn().
*
* @param {function} fn
* @return {array<string>}
*/
var _getFnArguments = function(fn) {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var fnStr = fn.toString().replace(STRIP_COMMENTS, '');
fnStr = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'));
return fnStr.match(/([^\s,]+)/g);
};
/**
* Store common callbacks within ReactDefaultPerf.
*
* @param {string} objName
* @param {string} fnName
* @return {?function}
*/
var _getCallback = function(objName, fnName) {
switch (objName + '.' + fnName) {
case 'React.renderComponent':
return _renderComponentCallback;
case 'ReactDOMComponent.mountComponent':
case 'ReactDOMComponent.updateComponent':
return _nativeComponentCallback;
case 'ReactCompositeComponent.mountComponent':
case 'ReactCompositeComponent.updateComponent':
return _compositeComponentCallback;
default:
return null;
}
};
/**
* Callback function for React.renderComponent
*
* @param {object} component
* @param {object} args
* @param {?object} fnReturn
* @param {object} log
* @param {object} info
*/
var _renderComponentCallback =
function(component, args, fnReturn, log, info) {
log.name = args.nextComponent.constructor.displayName || '[unknown]';
log.reactID = fnReturn._rootNodeID || null;
if (ReactDefaultPerf.options.heatmap.enabled) {
var container = args.container;
if (!container.loggedByReactDefaultPerf) {
container.loggedByReactDefaultPerf = true;
info.components = info.components || [];
info.components.push(container);
}
container.count = container.count || 0;
container.count += log.timing.delta;
info.max = info.max || 0;
if (container.count > info.max) {
info.max = container.count;
info.components.forEach(function(component) {
_setHue(component, 100 - 100 * component.count / info.max);
});
} else {
_setHue(container, 100 - 100 * container.count / info.max);
}
}
};
/**
* Callback function for ReactDOMComponent
*
* @param {object} component
* @param {object} args
* @param {?object} fnReturn
* @param {object} log
* @param {object} info
*/
var _nativeComponentCallback =
function(component, args, fnReturn, log, info) {
log.name = component.tagName || '[unknown]';
log.reactID = component._rootNodeID;
};
/**
* Callback function for ReactCompositeComponent
*
* @param {object} component
* @param {object} args
* @param {?object} fnReturn
* @param {object} log
* @param {object} info
*/
var _compositeComponentCallback =
function(component, args, fnReturn, log, info) {
log.name = component.constructor.displayName || '[unknown]';
log.reactID = component._rootNodeID;
};
/**
* Using the hsl() background-color attribute, colors an element.
*
* @param {DOMElement} el
* @param {number} hue [0 for red, 120 for green, 240 for blue]
*/
var _setHue = function(el, hue) {
el.style.backgroundColor = 'hsla(' + hue + ', 100%, 50%, 0.6)';
};
/**
* Round to the thousandth place.
* @param {number} time
* @return {number}
*/
var _microTime = function(time) {
return Math.round(time * 1000) / 1000;
};
}
module.exports = ReactDefaultPerf;
},{"./performanceNow":123}],46:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactEventEmitter
* @typechecks static-only
*/
"use strict";
var EventConstants = require("./EventConstants");
var EventListener = require("./EventListener");
var EventPluginHub = require("./EventPluginHub");
var ExecutionEnvironment = require("./ExecutionEnvironment");
var ReactEventEmitterMixin = require("./ReactEventEmitterMixin");
var ViewportMetrics = require("./ViewportMetrics");
var invariant = require("./invariant");
var isEventSupported = require("./isEventSupported");
var merge = require("./merge");
/**
* Summary of `ReactEventEmitter` event handling:
*
* - Top-level delegation is used to trap native browser events. We normalize
* and de-duplicate events to account for browser quirks.
*
* - 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 | .
* +------------+ . +-----------+
* + . +--------+|SimpleEvent|
* | . | |Plugin |
* +-----|------+ . v +-----------+
* | | | . +--------------+ +------------+
* | +-----------.--->|EventPluginHub| | Event |
* | | . | | +-----------+ | Propagators|
* | ReactEvent | . | | |TapEvent | |------------|
* | Emitter | . | |<---+|Plugin | |other plugin|
* | | . | | +-----------+ | utilities |
* | +-----------.---------+ | +------------+
* | | | . +----|---------+
* +-----|------+ . | ^ +-----------+
* | . | | |Enter/Leave|
* + . | +-------+|Plugin |
* +-------------+ . v +-----------+
* | application | . +----------+
* |-------------| . | callback |
* | | . | registry |
* | | . +----------+
* +-------------+ .
* .
* React Core . General Purpose Event Plugin System
*/
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {DOMEventTarget} element Element on which to attach listener.
* @internal
*/
function trapBubbledEvent(topLevelType, handlerBaseName, element) {
EventListener.listen(
element,
handlerBaseName,
ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback(
topLevelType
)
);
}
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {DOMEventTarget} element Element on which to attach listener.
* @internal
*/
function trapCapturedEvent(topLevelType, handlerBaseName, element) {
EventListener.capture(
element,
handlerBaseName,
ReactEventEmitter.TopLevelCallbackCreator.createTopLevelCallback(
topLevelType
)
);
}
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* NOTE: Scroll events do not bubble.
*
* @private
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
function registerScrollValueMonitoring() {
var refresh = ViewportMetrics.refreshScrollValues;
EventListener.listen(window, 'scroll', refresh);
EventListener.listen(window, 'resize', refresh);
}
/**
* `ReactEventEmitter` is used to attach top-level event listeners. For example:
*
* ReactEventEmitter.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
var ReactEventEmitter = merge(ReactEventEmitterMixin, {
/**
* React references `ReactEventTopLevelCallback` using this property in order
* to allow dependency injection.
*/
TopLevelCallbackCreator: null,
/**
* Ensures that top-level event delegation listeners are installed.
*
* There are issues with listening to both touch events and mouse events on
* the top-level, so we make the caller choose which one to listen to. (If
* there's a touch top-level listeners, anchors don't receive clicks for some
* reason, and only in some cases).
*
* @param {boolean} touchNotMouse Listen to touch events instead of mouse.
* @param {DOMDocument} contentDocument DOM document to listen on
*/
ensureListening: function(touchNotMouse, contentDocument) {
invariant(
ExecutionEnvironment.canUseDOM,
'ensureListening(...): Cannot toggle event listening in a Worker ' +
'thread. This is likely a bug in the framework. Please report ' +
'immediately.'
);
invariant(
ReactEventEmitter.TopLevelCallbackCreator,
'ensureListening(...): Cannot be called without a top level callback ' +
'creator being injected.'
);
// Call out to base implementation.
ReactEventEmitterMixin.ensureListening.call(
ReactEventEmitter,
{
touchNotMouse: touchNotMouse,
contentDocument: contentDocument
}
);
},
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function(enabled) {
invariant(
ExecutionEnvironment.canUseDOM,
'setEnabled(...): Cannot toggle event listening in a Worker thread. ' +
'This is likely a bug in the framework. Please report immediately.'
);
if (ReactEventEmitter.TopLevelCallbackCreator) {
ReactEventEmitter.TopLevelCallbackCreator.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function() {
return !!(
ReactEventEmitter.TopLevelCallbackCreator &&
ReactEventEmitter.TopLevelCallbackCreator.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 {boolean} touchNotMouse Listen to touch events instead of mouse.
* @param {DOMDocument} contentDocument Document which owns the container
* @private
* @see http://www.quirksmode.org/dom/events/keys.html.
*/
listenAtTopLevel: function(touchNotMouse, contentDocument) {
invariant(
!contentDocument._isListening,
'listenAtTopLevel(...): Cannot setup top-level listener more than once.'
);
var topLevelTypes = EventConstants.topLevelTypes;
var mountAt = contentDocument;
registerScrollValueMonitoring();
trapBubbledEvent(topLevelTypes.topMouseOver, 'mouseover', mountAt);
trapBubbledEvent(topLevelTypes.topMouseDown, 'mousedown', mountAt);
trapBubbledEvent(topLevelTypes.topMouseUp, 'mouseup', mountAt);
trapBubbledEvent(topLevelTypes.topMouseMove, 'mousemove', mountAt);
trapBubbledEvent(topLevelTypes.topMouseOut, 'mouseout', mountAt);
trapBubbledEvent(topLevelTypes.topClick, 'click', mountAt);
trapBubbledEvent(topLevelTypes.topDoubleClick, 'dblclick', mountAt);
if (touchNotMouse) {
trapBubbledEvent(topLevelTypes.topTouchStart, 'touchstart', mountAt);
trapBubbledEvent(topLevelTypes.topTouchEnd, 'touchend', mountAt);
trapBubbledEvent(topLevelTypes.topTouchMove, 'touchmove', mountAt);
trapBubbledEvent(topLevelTypes.topTouchCancel, 'touchcancel', mountAt);
}
trapBubbledEvent(topLevelTypes.topKeyUp, 'keyup', mountAt);
trapBubbledEvent(topLevelTypes.topKeyPress, 'keypress', mountAt);
trapBubbledEvent(topLevelTypes.topKeyDown, 'keydown', mountAt);
trapBubbledEvent(topLevelTypes.topInput, 'input', mountAt);
trapBubbledEvent(topLevelTypes.topChange, 'change', mountAt);
trapBubbledEvent(
topLevelTypes.topSelectionChange,
'selectionchange',
mountAt
);
trapBubbledEvent(
topLevelTypes.topCompositionEnd,
'compositionend',
mountAt
);
trapBubbledEvent(
topLevelTypes.topCompositionStart,
'compositionstart',
mountAt
);
trapBubbledEvent(
topLevelTypes.topCompositionUpdate,
'compositionupdate',
mountAt
);
if (isEventSupported('drag')) {
trapBubbledEvent(topLevelTypes.topDrag, 'drag', mountAt);
trapBubbledEvent(topLevelTypes.topDragEnd, 'dragend', mountAt);
trapBubbledEvent(topLevelTypes.topDragEnter, 'dragenter', mountAt);
trapBubbledEvent(topLevelTypes.topDragExit, 'dragexit', mountAt);
trapBubbledEvent(topLevelTypes.topDragLeave, 'dragleave', mountAt);
trapBubbledEvent(topLevelTypes.topDragOver, 'dragover', mountAt);
trapBubbledEvent(topLevelTypes.topDragStart, 'dragstart', mountAt);
trapBubbledEvent(topLevelTypes.topDrop, 'drop', mountAt);
}
if (isEventSupported('wheel')) {
trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
// IE<9 does not support capturing so just trap the bubbled event there.
if (isEventSupported('scroll', true)) {
trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
trapBubbledEvent(topLevelTypes.topScroll, 'scroll', window);
}
if (isEventSupported('focus', true)) {
trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
trapCapturedEvent(topLevelTypes.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
trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
if (isEventSupported('copy')) {
trapBubbledEvent(topLevelTypes.topCopy, 'copy', mountAt);
trapBubbledEvent(topLevelTypes.topCut, 'cut', mountAt);
trapBubbledEvent(topLevelTypes.topPaste, 'paste', mountAt);
}
},
registrationNames: EventPluginHub.registrationNames,
putListener: EventPluginHub.putListener,
getListener: EventPluginHub.getListener,
deleteListener: EventPluginHub.deleteListener,
deleteAllListeners: EventPluginHub.deleteAllListeners,
trapBubbledEvent: trapBubbledEvent,
trapCapturedEvent: trapCapturedEvent
});
module.exports = ReactEventEmitter;
},{"./EventConstants":15,"./EventListener":16,"./EventPluginHub":17,"./ExecutionEnvironment":21,"./ReactEventEmitterMixin":47,"./ViewportMetrics":83,"./invariant":106,"./isEventSupported":107,"./merge":115}],47:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactEventEmitterMixin
*/
"use strict";
var EventPluginHub = require("./EventPluginHub");
var ReactUpdates = require("./ReactUpdates");
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue();
}
var ReactEventEmitterMixin = {
/**
* Whether or not `ensureListening` has been invoked.
* @type {boolean}
* @private
*/
_isListening: false,
/**
* Function, must be implemented. Listens to events on the top level of the
* application.
*
* @abstract
*
* listenAtTopLevel: null,
*/
/**
* Ensures that top-level event delegation listeners are installed.
*
* There are issues with listening to both touch events and mouse events on
* the top-level, so we make the caller choose which one to listen to. (If
* there's a touch top-level listeners, anchors don't receive clicks for some
* reason, and only in some cases).
*
* @param {*} config Configuration passed through to `listenAtTopLevel`.
*/
ensureListening: function(config) {
if (!config.contentDocument._reactIsListening) {
this.listenAtTopLevel(config.touchNotMouse, config.contentDocument);
config.contentDocument._reactIsListening = true;
}
},
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
handleTopLevel: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var events = EventPluginHub.extractEvents(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
// Event queue being processed in the same cycle allows `preventDefault`.
ReactUpdates.batchedUpdates(runEventQueueInBatch, events);
}
};
module.exports = ReactEventEmitterMixin;
},{"./EventPluginHub":17,"./ReactUpdates":69}],48:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactEventTopLevelCallback
* @typechecks static-only
*/
"use strict";
var ReactEventEmitter = require("./ReactEventEmitter");
var ReactMount = require("./ReactMount");
var getEventTarget = require("./getEventTarget");
/**
* @type {boolean}
* @private
*/
var _topLevelListenersEnabled = true;
/**
* Top-level callback creator used to implement event handling using delegation.
* This is used via dependency injection.
*/
var ReactEventTopLevelCallback = {
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function(enabled) {
_topLevelListenersEnabled = !!enabled;
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function() {
return _topLevelListenersEnabled;
},
/**
* Creates a callback for the supplied `topLevelType` that could be added as
* a listener to the document. The callback computes a `topLevelTarget` which
* should be the root node of a mounted React component where the listener
* is attached.
*
* @param {string} topLevelType Record from `EventConstants`.
* @return {function} Callback for handling top-level events.
*/
createTopLevelCallback: function(topLevelType) {
return function(nativeEvent) {
if (!_topLevelListenersEnabled) {
return;
}
// TODO: Remove when synthetic events are ready, this is for IE<9.
if (nativeEvent.srcElement &&
nativeEvent.srcElement !== nativeEvent.target) {
nativeEvent.target = nativeEvent.srcElement;
}
var topLevelTarget = ReactMount.getFirstReactDOM(
getEventTarget(nativeEvent)
) || window;
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
ReactEventEmitter.handleTopLevel(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
};
}
};
module.exports = ReactEventTopLevelCallback;
},{"./ReactEventEmitter":46,"./ReactMount":53,"./getEventTarget":100}],49:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactInputSelection
*/
"use strict";
var ReactDOMSelection = require("./ReactDOMSelection");
var getActiveElement = require("./getActiveElement");
var nodeContains = require("./nodeContains");
function isInDocument(node) {
return nodeContains(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(elem) {
return elem && (
(elem.nodeName === 'INPUT' && elem.type === 'text') ||
elem.nodeName === 'TEXTAREA' ||
elem.contentEditable === 'true'
);
},
getSelectionInformation: function() {
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(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
);
}
priorFocusedElem.focus();
}
},
/**
* @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(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') {
// 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(input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof 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') {
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;
},{"./ReactDOMSelection":41,"./getActiveElement":99,"./nodeContains":120}],50:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactInstanceHandles
* @typechecks static-only
*/
"use strict";
var invariant = require("./invariant");
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
var MAX_TREE_DEPTH = 100;
/**
* Size of the reactRoot ID space. We generate random numbers for React root
* IDs and if there's a collision the events and DOM update system will
* get confused. If we assume 100 React components per page, and a user
* loads 1 page per minute 24/7 for 50 years, with a mount point space of
* 9,999,999 the likelihood of never having a collision is 99.997%.
*/
var GLOBAL_MOUNT_POINT_MAX = 9999999;
/**
* Creates a DOM ID prefix to use when mounting React components.
*
* @param {number} index A unique integer
* @return {string} React root ID.
* @internal
*/
function getReactRootIDString(index) {
return SEPARATOR + 'r[' + index.toString(36) + ']';
}
/**
* Checks if a character in the supplied ID is a separator or the end.
*
* @param {string} id A React DOM ID.
* @param {number} index Index of the character to check.
* @return {boolean} True if the character is a separator or end of the ID.
* @private
*/
function isBoundary(id, index) {
return id.charAt(index) === SEPARATOR || index === id.length;
}
/**
* Checks if the supplied string is a valid React DOM ID.
*
* @param {string} id A React DOM ID, maybe.
* @return {boolean} True if the string is a valid React DOM ID.
* @private
*/
function isValidID(id) {
return id === '' || (
id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
);
}
/**
* Checks if the first ID is an ancestor of or equal to the second ID.
*
* @param {string} ancestorID
* @param {string} descendantID
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
return (
descendantID.indexOf(ancestorID) === 0 &&
isBoundary(descendantID, ancestorID.length)
);
}
/**
* Gets the parent ID of the supplied React DOM ID, `id`.
*
* @param {string} id ID of a component.
* @return {string} ID of the parent, or an empty string.
* @private
*/
function getParentID(id) {
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
}
/**
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
* supplied `destinationID`. If they are equal, the ID is returned.
*
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
* @param {string} destinationID ID of the destination node.
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
invariant(
isValidID(ancestorID) && isValidID(destinationID),
'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
ancestorID,
destinationID
);
invariant(
isAncestorIDOf(ancestorID, destinationID),
'getNextDescendantID(...): React has made an invalid assumption about ' +
'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
ancestorID,
destinationID
);
if (ancestorID === destinationID) {
return ancestorID;
}
// Skip over the ancestor and the immediate separator. Traverse until we hit
// another separator or we reach the end of `destinationID`.
var start = ancestorID.length + SEPARATOR_LENGTH;
for (var i = start; i < destinationID.length; i++) {
if (isBoundary(destinationID, i)) {
break;
}
}
return destinationID.substr(0, i);
}
/**
* Gets the nearest common ancestor ID of two IDs.
*
* Using this ID scheme, the nearest common ancestor ID is the longest common
* prefix of the two IDs that immediately preceded a "marker" in both strings.
*
* @param {string} oneID
* @param {string} twoID
* @return {string} Nearest common ancestor ID, or the empty string if none.
* @private
*/
function getFirstCommonAncestorID(oneID, twoID) {
var minLength = Math.min(oneID.length, twoID.length);
if (minLength === 0) {
return '';
}
var lastCommonMarkerIndex = 0;
// Use `<=` to traverse until the "EOL" of the shorter string.
for (var i = 0; i <= minLength; i++) {
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
lastCommonMarkerIndex = i;
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
break;
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
invariant(
isValidID(longestCommonID),
'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
oneID,
twoID,
longestCommonID
);
return longestCommonID;
}
/**
* Traverses the parent path between two IDs (either up or down). The IDs must
* not be the same, and there must exist a parent path between them.
*
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
*/
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
invariant(
start !== stop,
'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
start
);
var traverseUp = isAncestorIDOf(stop, start);
invariant(
traverseUp || isAncestorIDOf(start, stop),
'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
'not have a parent path.',
start,
stop
);
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
for (var id = start; /* until break */; id = traverse(id, stop)) {
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
cb(id, traverseUp, arg);
}
if (id === stop) {
// Only break //after// visiting `stop`.
break;
}
invariant(
depth++ < MAX_TREE_DEPTH,
'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
start, stop
);
}
}
/**
* Manages the IDs assigned to DOM representations of React components. This
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
* order to simulate events).
*
* @internal
*/
var ReactInstanceHandles = {
createReactRootID: function() {
return getReactRootIDString(
Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX)
);
},
/**
* Constructs a React ID by joining a root ID with a name.
*
* @param {string} rootID Root ID of a parent component.
* @param {string} name A component's name (as flattened children).
* @return {string} A React ID.
* @internal
*/
createReactID: function(rootID, name) {
return rootID + SEPARATOR + name;
},
/**
* Gets the DOM ID of the React component that is the root of the tree that
* contains the React component with the supplied DOM ID.
*
* @param {string} id DOM ID of a React component.
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
getReactRootIDFromNodeID: function(id) {
var regexResult = /\.r\[[^\]]+\]/.exec(id);
return regexResult && regexResult[0];
},
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* NOTE: Does not invoke the callback on the nearest common ancestor because
* nothing "entered" or "left" that element.
*
* @param {string} leaveID ID being left.
* @param {string} enterID ID being entered.
* @param {function} cb Callback to invoke on each entered/left ID.
* @param {*} upArg Argument to invoke the callback with on left IDs.
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
}
if (ancestorID !== enterID) {
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
}
},
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseTwoPhase: function(targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
}
},
/**
* Exposed for unit testing.
* @private
*/
_getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
* @private
*/
_getNextDescendantID: getNextDescendantID,
isAncestorIDOf: isAncestorIDOf,
SEPARATOR: SEPARATOR
};
module.exports = ReactInstanceHandles;
},{"./invariant":106}],51:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactLink
* @typechecks static-only
*/
"use strict";
/**
* ReactLink encapsulates a common pattern in which a component wants to modify
* a prop received from its parent. ReactLink allows the parent to pass down a
* value coupled with a callback that, when invoked, expresses an intent to
* modify that value. For example:
*
* React.createClass({
* getInitialState: function() {
* return {value: ''};
* },
* render: function() {
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
* this._handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
*
* We have provided some sugary mixins to make the creation and
* consumption of ReactLink easier; see LinkedValueMixin and LinkedStateMixin.
*/
/**
* @param {*} value current value of the link
* @param {function} requestChange callback to request a change
*/
function ReactLink(value, requestChange) {
this.value = value;
this.requestChange = requestChange;
}
module.exports = ReactLink;
},{}],52:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMarkupChecksum
*/
"use strict";
var adler32 = require("./adler32");
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function(markup) {
var checksum = adler32(markup);
return markup.replace(
'>',
' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
);
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function(markup, element) {
var existingChecksum = element.getAttribute(
ReactMarkupChecksum.CHECKSUM_ATTR_NAME
);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
},{"./adler32":85}],53:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMount
*/
"use strict";
var ReactEventEmitter = require("./ReactEventEmitter");
var ReactInstanceHandles = require("./ReactInstanceHandles");
var $ = require("./$");
var getReactRootElementInContainer = require("./getReactRootElementInContainer");
var invariant = require("./invariant");
var nodeContains = require("./nodeContains");
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var ATTR_NAME = 'data-reactid';
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
if (true) {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
function getReactRootID(container) {
var rootElement = getReactRootElementInContainer(container);
return rootElement && ReactMount.getID(rootElement);
}
/**
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
* element can return its control whose name or ID equals ATTR_NAME. All
* DOM nodes support `getAttributeNode` but this can also get called on
* other objects so just return '' if we're given something other than a
* DOM node (such as window).
*
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
* @return {string} ID of the supplied `domNode`.
*/
function getID(node) {
var id = internalGetID(node);
if (id) {
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
invariant(
!isValid(cached, id),
'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
ATTR_NAME, id
);
nodeCache[id] = node;
}
} else {
nodeCache[id] = node;
}
}
return id;
}
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 && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Sets the React-specific ID of the given node.
*
* @param {DOMElement} node The DOM node whose ID will be set.
* @param {string} id The value of the ID attribute.
*/
function setID(node, id) {
var oldID = internalGetID(node);
if (oldID !== id) {
delete nodeCache[oldID];
}
node.setAttribute(ATTR_NAME, id);
nodeCache[id] = node;
}
/**
* Finds the node with the supplied React-generated DOM ID.
*
* @param {string} id A React-generated DOM ID.
* @return {DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNode(id) {
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* A node is "valid" if it is contained by a currently mounted container.
*
* This means that the node does not have to be contained by a document in
* order to be considered valid.
*
* @param {?DOMElement} node The candidate DOM node.
* @param {string} id The expected ID of the node.
* @return {boolean} Whether the node is contained by a mounted container.
*/
function isValid(node, id) {
if (node) {
invariant(
internalGetID(node) === id,
'ReactMount: Unexpected modification of `%s`',
ATTR_NAME
);
var container = ReactMount.findReactContainerForID(id);
if (container && nodeContains(container, node)) {
return true;
}
}
return false;
}
/**
* Causes the cache to forget about one React-specific ID.
*
* @param {string} id The ID to forget.
*/
function purgeID(id) {
delete nodeCache[id];
}
/**
* Mounting is the process of initializing a React component by creatings its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
*
* ReactMount.renderComponent(component, $('container'));
*
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".r[3]"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
/**
* Safety guard to prevent accidentally rendering over the entire HTML tree.
*/
allowFullPageRender: false,
/** Time spent generating markup. */
totalInstantiationTime: 0,
/** Time spent inserting markup into the DOM. */
totalInjectionTime: 0,
/** Whether support for touch events should be initialized. */
useTouchEvents: false,
/** Exposed for debugging purposes **/
_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(container, renderCallback) {
renderCallback();
},
/**
* Ensures that the top-level event delegation listener is set up. This will
* be invoked some time before the first time any React component is rendered.
* @param {DOMElement} container container we're rendering into
*
* @private
*/
prepareEnvironmentForDOM: function(container) {
invariant(
container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE
),
'prepareEnvironmentForDOM(...): Target container is not a DOM element.'
);
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
container.ownerDocument :
container;
ReactEventEmitter.ensureListening(ReactMount.useTouchEvents, doc);
},
/**
* Take a component that's already mounted into the DOM and replace its props
* @param {ReactComponent} prevComponent component instance already in the DOM
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
_updateRootComponent: function(
prevComponent,
nextComponent,
container,
callback) {
var nextProps = nextComponent.props;
ReactMount.scrollMonitor(container, function() {
prevComponent.replaceProps(nextProps, callback);
});
if (true) {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[getReactRootID(container)] =
getReactRootElementInContainer(container);
}
return prevComponent;
},
/**
* Register a component into the instance map and start the events system.
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
_registerComponent: function(nextComponent, container) {
ReactMount.prepareEnvironmentForDOM(container);
var reactRootID = ReactMount.registerContainer(container);
instancesByReactRootID[reactRootID] = nextComponent;
return reactRootID;
},
/**
* Render a new component into the DOM.
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: function(
nextComponent,
container,
shouldReuseMarkup) {
var reactRootID = ReactMount._registerComponent(nextComponent, container);
nextComponent.mountComponentIntoNode(
reactRootID,
container,
shouldReuseMarkup
);
if (true) {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[reactRootID] =
getReactRootElementInContainer(container);
}
return nextComponent;
},
/**
* 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} nextComponent Component instance to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderComponent: function(nextComponent, container, callback) {
var registeredComponent = instancesByReactRootID[getReactRootID(container)];
if (registeredComponent) {
if (registeredComponent.constructor === nextComponent.constructor) {
return ReactMount._updateRootComponent(
registeredComponent,
nextComponent,
container,
callback
);
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup =
reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
var shouldReuseMarkup = containerHasReactMarkup && !registeredComponent;
var component = ReactMount._renderNewRootComponent(
nextComponent,
container,
shouldReuseMarkup
);
callback && callback();
return component;
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into the supplied `container`.
*
* @param {function} constructor React component constructor.
* @param {?object} props Initial props of the component instance.
* @param {DOMElement} container DOM element to render into.
* @return {ReactComponent} Component instance rendered in `container`.
*/
constructAndRenderComponent: function(constructor, props, container) {
return ReactMount.renderComponent(constructor(props), container);
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into a container node identified by supplied `id`.
*
* @param {function} componentConstructor React component constructor
* @param {?object} props Initial props of the component instance.
* @param {string} id ID of the DOM element to render into.
* @return {ReactComponent} Component instance rendered in the container node.
*/
constructAndRenderComponentByID: function(constructor, props, id) {
return ReactMount.constructAndRenderComponent(constructor, props, $(id));
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reatRoot" ID that will be assigned to the element
* rendered within.
*
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
registerContainer: function(container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
}
if (!reactRootID) {
// No valid "reactRoot" ID found, create one.
reactRootID = ReactInstanceHandles.createReactRootID();
}
containersByReactRootID[reactRootID] = container;
return reactRootID;
},
/**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function(container) {
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
return false;
}
ReactMount.unmountComponentFromNode(component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
if (true) {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
* @deprecated
*/
unmountAndReleaseReactRootNode: function() {
if (true) {
console.warn(
'unmountAndReleaseReactRootNode() has been renamed to ' +
'unmountComponentAtNode() and will be removed in the next ' +
'version of React.'
);
}
return ReactMount.unmountComponentAtNode.apply(this, arguments);
},
/**
* 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}
*/
unmountComponentFromNode: function(instance, container) {
instance.unmountComponent();
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
},
/**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
findReactContainerForID: function(id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if (true) {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
invariant(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID,
'ReactMount: Root element ID differed from reactRootID.'
);
var containerChild = container.firstChild;
if (containerChild &&
reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
console.warn(
'ReactMount: Root element has been removed from its original ' +
'container. New container:', rootElement.parentNode
);
}
}
}
return container;
},
/**
* Finds an element rendered by React with the supplied ID.
*
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
findReactNodeByID: function(id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
* True if the supplied `node` is rendered by React.
*
* @param {*} node DOM Element to check.
* @return {boolean} True if the DOM Element appears to be rendered by React.
* @internal
*/
isRenderedByReact: function(node) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
return false;
}
var id = ReactMount.getID(node);
return id ? id.charAt(0) === SEPARATOR : false;
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
getFirstReactDOM: function(node) {
var current = node;
while (current && current.parentNode !== current) {
if (ReactMount.isRenderedByReact(current)) {
return current;
}
current = current.parentNode;
}
return null;
},
/**
* Finds a node with the supplied `id` inside of the supplied `ancestorNode`.
* Exploits the ID naming scheme to perform the search quickly.
*
* @param {DOMEventTarget} ancestorNode Search from this root.
* @pararm {string} id ID of the DOM representation of the component.
* @return {DOMEventTarget} DOM node with the supplied `id`.
* @internal
*/
findComponentRoot: function(ancestorNode, id) {
var firstChildren = [ancestorNode.firstChild];
var childIndex = 0;
while (childIndex < firstChildren.length) {
var child = firstChildren[childIndex++];
while (child) {
var childID = ReactMount.getID(child);
if (childID) {
if (id === childID) {
return child;
} else if (ReactInstanceHandles.isAncestorIDOf(childID, id)) {
// If we find a child whose ID is an ancestor of the given ID,
// then we can be sure that we only want to search the subtree
// rooted at this child, so we can throw out the rest of the
// search state.
firstChildren.length = childIndex = 0;
firstChildren.push(child.firstChild);
break;
} else {
// TODO This should not be necessary if the ID hierarchy is
// correct, but is occasionally necessary if the DOM has been
// modified in unexpected ways.
firstChildren.push(child.firstChild);
}
} else {
// If this child had no ID, then there's a chance that it was
// injected automatically by the browser, as when a `<table>`
// element sprouts an extra `<tbody>` child as a side effect of
// `.innerHTML` parsing. Optimistically continue down this
// branch, but not before examining the other siblings.
firstChildren.push(child.firstChild);
}
child = child.nextSibling;
}
}
if (true) {
console.error(
'Error while invoking `findComponentRoot` with the following ' +
'ancestor node:',
ancestorNode
);
}
invariant(
false,
'findComponentRoot(..., %s): Unable to find element. This probably ' +
'means the DOM was unexpectedly mutated (e.g. by the browser).',
id,
ReactMount.getID(ancestorNode)
);
},
/**
* React ID utilities.
*/
ATTR_NAME: ATTR_NAME,
getReactRootID: getReactRootID,
getID: getID,
setID: setID,
getNode: getNode,
purgeID: purgeID,
injection: {}
};
module.exports = ReactMount;
},{"./$":1,"./ReactEventEmitter":46,"./ReactInstanceHandles":50,"./getReactRootElementInContainer":103,"./invariant":106,"./nodeContains":120}],54:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMountReady
*/
"use strict";
var PooledClass = require("./PooledClass");
var mixInto = require("./mixInto");
/**
* 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 `ReactMountReady.getPooled()`.
*
* @param {?array<function>} initialCollection
* @class ReactMountReady
* @implements PooledClass
* @internal
*/
function ReactMountReady(initialCollection) {
this._queue = initialCollection || null;
}
mixInto(ReactMountReady, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked. This is used
* to enqueue calls to `componentDidMount` and `componentDidUpdate`.
*
* @param {ReactComponent} component Component being rendered.
* @param {function(DOMElement)} callback Invoked when `notifyAll` is invoked.
* @internal
*/
enqueue: function(component, callback) {
this._queue = this._queue || [];
this._queue.push({component: component, callback: callback});
},
/**
* Invokes all enqueued callbacks and clears the queue. This is invoked after
* the DOM representation of a component has been created or updated.
*
* @internal
*/
notifyAll: function() {
var queue = this._queue;
if (queue) {
this._queue = null;
for (var i = 0, l = queue.length; i < l; i++) {
var component = queue[i].component;
var callback = queue[i].callback;
callback.call(component, component.getDOMNode());
}
queue.length = 0;
}
},
/**
* Resets the internal queue.
*
* @internal
*/
reset: function() {
this._queue = null;
},
/**
* `PooledClass` looks for this.
*/
destructor: function() {
this.reset();
}
});
PooledClass.addPoolingTo(ReactMountReady);
module.exports = ReactMountReady;
},{"./PooledClass":25,"./mixInto":118}],55:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
"use strict";
var ReactComponent = require("./ReactComponent");
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
var flattenChildren = require("./flattenChildren");
/**
* Given a `curChild` and `newChild`, determines if `curChild` should be
* updated as opposed to being destroyed or replaced.
*
* @param {?ReactComponent} curChild
* @param {?ReactComponent} newChild
* @return {boolean} True if `curChild` should be updated with `newChild`.
* @protected
*/
function shouldUpdateChild(curChild, newChild) {
return curChild && newChild && curChild.constructor === newChild.constructor;
}
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
fromIndex: null,
textContent: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
textContent: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponent.DOMIDOperations.dangerouslyProcessChildrenUpdates(
updateQueue,
markupQueue
);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function(nestedChildren, transaction) {
var children = flattenChildren(nestedChildren);
var mountImages = [];
var index = 0;
this._renderedChildren = children;
for (var name in children) {
var child = children[name];
if (children.hasOwnProperty(name) && child) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + '.' + name;
var mountImage = child.mountComponent(
rootID,
transaction,
this._mountDepth + 1
);
child._mountImage = mountImage;
child._mountIndex = index;
mountImages.push(mountImage);
index++;
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function(nextContent) {
updateDepth++;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
prevChildren[name]) {
this._unmountChildByName(prevChildren[name], name);
}
}
// Set new text content.
this.setTextContent(nextContent);
} catch (error) {
updateDepth--;
updateDepth || clearQueue();
throw error;
}
updateDepth--;
updateDepth || processQueue();
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function(nextNestedChildren, transaction) {
updateDepth++;
try {
this._updateChildren(nextNestedChildren, transaction);
} catch (error) {
updateDepth--;
updateDepth || clearQueue();
throw error;
}
updateDepth--;
updateDepth || processQueue();
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function(nextNestedChildren, transaction) {
var nextChildren = flattenChildren(nextNestedChildren);
var prevChildren = this._renderedChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (shouldUpdateChild(prevChild, nextChild)) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild.receiveProps(nextChild.props, transaction);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChildByName(prevChild, name);
}
if (nextChild) {
this._mountChildByNameAtIndex(
nextChild, name, nextIndex, transaction
);
}
}
if (nextChild) {
nextIndex++;
}
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
prevChildren[name] &&
!(nextChildren && nextChildren[name])) {
this._unmountChildByName(prevChildren[name], name);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function() {
var renderedChildren = this._renderedChildren;
for (var name in renderedChildren) {
var renderedChild = renderedChildren[name];
if (renderedChild && renderedChild.unmountComponent) {
renderedChild.unmountComponent();
}
}
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function(child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @protected
*/
createChild: function(child) {
enqueueMarkup(this._rootNodeID, child._mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function(child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function(textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function(child, name, index, transaction) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + '.' + name;
var mountImage = child.mountComponent(
rootID,
transaction,
this._mountDepth + 1
);
child._mountImage = mountImage;
child._mountIndex = index;
this.createChild(child);
this._renderedChildren = this._renderedChildren || {};
this._renderedChildren[name] = child;
},
/**
* Unmounts a rendered child by name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
_unmountChildByName: function(child, name) {
if (ReactComponent.isValidComponent(child)) {
this.removeChild(child);
child._mountImage = null;
child._mountIndex = null;
child.unmountComponent();
delete this._renderedChildren[name];
}
}
}
};
module.exports = ReactMultiChild;
},{"./ReactComponent":28,"./ReactMultiChildUpdateTypes":56,"./flattenChildren":96}],56:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMultiChildUpdateTypes
*/
var keyMirror = require("./keyMirror");
/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
},{"./keyMirror":112}],57:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactOwner
*/
"use strict";
var invariant = require("./invariant");
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function(object) {
return !!(
object &&
typeof object.attachRef === 'function' &&
typeof object.detachRef === 'function'
);
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function(component, ref, owner) {
invariant(
ReactOwner.isValidOwner(owner),
'addComponentAsRefTo(...): Only a ReactOwner can have refs.'
);
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function(component, ref, owner) {
invariant(
ReactOwner.isValidOwner(owner),
'removeComponentAsRefFrom(...): Only a ReactOwner can have refs.'
);
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.refs[ref] === component) {
owner.detachRef(ref);
}
},
/**
* A ReactComponent must mix this in to have refs.
*
* @lends {ReactOwner.prototype}
*/
Mixin: {
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function(ref, component) {
invariant(
component.isOwnedBy(this),
'attachRef(%s, ...): Only a component\'s owner can store a ref to it.',
ref
);
var refs = this.refs || (this.refs = {});
refs[ref] = component;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function(ref) {
delete this.refs[ref];
}
}
};
module.exports = ReactOwner;
},{"./invariant":106}],58:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPerf
* @typechecks static-only
*/
"use strict";
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
* accidental logging and perf loss.
*/
enableMeasure: false,
/**
* Holds onto the measure function in use. By default, don't measure
* anything, but we'll override this if we inject a measure function.
*/
storedMeasure: _noMeasure,
/**
* Use this to wrap methods you want to measure.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function(objName, fnName, func) {
if (true) {
var measuredFunc = null;
return function() {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
}
return measuredFunc.apply(this, arguments);
}
return func.apply(this, arguments);
};
}
return func;
},
injection: {
/**
* @param {function} measure
*/
injectMeasure: function(measure) {
ReactPerf.storedMeasure = measure;
}
}
};
if (true) {
var ExecutionEnvironment = require("./ExecutionEnvironment");
var URL = ExecutionEnvironment.canUseDOM ? window.location.href : '';
ReactPerf.enableMeasure = ReactPerf.enableMeasure ||
!!URL.match(/[?&]react_perf\b/);
}
/**
* Simply passes through the measured function, without measuring it.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
function _noMeasure(objName, fnName, func) {
return func;
}
module.exports = ReactPerf;
},{"./ExecutionEnvironment":21}],59:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPropTransferer
*/
"use strict";
var emptyFunction = require("./emptyFunction");
var invariant = require("./invariant");
var joinClasses = require("./joinClasses");
var merge = require("./merge");
/**
* Creates a transfer strategy that will merge prop values using the supplied
* `mergeStrategy`. If a prop was previously unset, this just sets it.
*
* @param {function} mergeStrategy
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
return function(props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
props[key] = mergeStrategy(props[key], value);
}
};
}
/**
* Transfer strategies dictate how props are transferred by `transferPropsTo`.
*/
var TransferStrategies = {
/**
* Never transfer `children`.
*/
children: emptyFunction,
/**
* Transfer the `className` prop by merging them.
*/
className: createTransferStrategy(joinClasses),
/**
* Never transfer the `ref` prop.
*/
ref: emptyFunction,
/**
* Transfer the `style` prop (which is an object) by merging them.
*/
style: createTransferStrategy(merge)
};
/**
* ReactPropTransferer are capable of transferring props to another component
* using a `transferPropsTo` method.
*
* @class ReactPropTransferer
*/
var ReactPropTransferer = {
TransferStrategies: TransferStrategies,
/**
* @lends {ReactPropTransferer.prototype}
*/
Mixin: {
/**
* Transfer props from this component to a target component.
*
* Props that do not have an explicit transfer strategy will be transferred
* only if the target component does not already have the prop set.
*
* This is usually used to pass down props to a returned root component.
*
* @param {ReactComponent} component Component receiving the properties.
* @return {ReactComponent} The supplied `component`.
* @final
* @protected
*/
transferPropsTo: function(component) {
invariant(
component.props.__owner__ === this,
'%s: You can\'t call transferPropsTo() on a component that you ' +
'don\'t own, %s. This usually means you are calling ' +
'transferPropsTo() on a component passed in as props or children.',
this.constructor.displayName,
component.constructor.displayName
);
var props = {};
for (var thatKey in component.props) {
if (component.props.hasOwnProperty(thatKey)) {
props[thatKey] = component.props[thatKey];
}
}
for (var thisKey in this.props) {
if (!this.props.hasOwnProperty(thisKey)) {
continue;
}
var transferStrategy = TransferStrategies[thisKey];
if (transferStrategy) {
transferStrategy(props, thisKey, this.props[thisKey]);
} else if (!props.hasOwnProperty(thisKey)) {
props[thisKey] = this.props[thisKey];
}
}
component.props = props;
return component;
}
}
};
module.exports = ReactPropTransferer;
},{"./emptyFunction":92,"./invariant":106,"./joinClasses":111,"./merge":115}],60:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPropTypes
*/
"use strict";
var createObjectFrom = require("./createObjectFrom");
var invariant = require("./invariant");
/**
* 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 Props = require('ReactPropTypes');
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* invariant(
* propValue == null ||
* typeof propValue === 'string' ||
* propValue instanceof URI,
* 'Invalid `%s` supplied to `%s`, expected string or URI.',
* propName,
* componentName
* );
* }
* },
* render: function() { ... }
* });
*
* @internal
*/
var Props = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
oneOf: createEnumTypeChecker,
instanceOf: createInstanceTypeChecker
};
var ANONYMOUS = '<<anonymous>>';
function createPrimitiveTypeChecker(expectedType) {
function validatePrimitiveType(propValue, propName, componentName) {
var propType = typeof propValue;
if (propType === 'object' && Array.isArray(propValue)) {
propType = 'array';
}
invariant(
propType === expectedType,
'Invalid prop `%s` of type `%s` supplied to `%s`, expected `%s`.',
propName,
propType,
componentName,
expectedType
);
}
return createChainableTypeChecker(validatePrimitiveType);
}
function createEnumTypeChecker(expectedValues) {
var expectedEnum = createObjectFrom(expectedValues);
function validateEnumType(propValue, propName, componentName) {
invariant(
expectedEnum[propValue],
'Invalid prop `%s` supplied to `%s`, expected one of %s.',
propName,
componentName,
JSON.stringify(Object.keys(expectedEnum))
);
}
return createChainableTypeChecker(validateEnumType);
}
function createInstanceTypeChecker(expectedClass) {
function validateInstanceType(propValue, propName, componentName) {
invariant(
propValue instanceof expectedClass,
'Invalid prop `%s` supplied to `%s`, expected instance of `%s`.',
propName,
componentName,
expectedClass.name || ANONYMOUS
);
}
return createChainableTypeChecker(validateInstanceType);
}
function createChainableTypeChecker(validate) {
function createTypeChecker(isRequired) {
function checkType(props, propName, componentName) {
var propValue = props[propName];
if (propValue != null) {
// Only validate if there is a value to check.
validate(propValue, propName, componentName || ANONYMOUS);
} else {
invariant(
!isRequired,
'Required prop `%s` was not specified in `%s`.',
propName,
componentName || ANONYMOUS
);
}
}
if (!isRequired) {
checkType.isRequired = createTypeChecker(true);
}
return checkType;
}
return createTypeChecker(false);
}
module.exports = Props;
},{"./createObjectFrom":89,"./invariant":106}],61:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactReconcileTransaction
* @typechecks static-only
*/
"use strict";
var ExecutionEnvironment = require("./ExecutionEnvironment");
var PooledClass = require("./PooledClass");
var ReactEventEmitter = require("./ReactEventEmitter");
var ReactInputSelection = require("./ReactInputSelection");
var ReactMountReady = require("./ReactMountReady");
var Transaction = require("./Transaction");
var mixInto = require("./mixInto");
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactEventEmitter` before the
* reconciliation.
*/
initialize: function() {
var currentlyEnabled = ReactEventEmitter.isEnabled();
ReactEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of `ReactEventEmitter`
* before the reconciliation occured. `close` restores the previous value.
*/
close: function(previouslyEnabled) {
ReactEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a `ReactMountReady` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function() {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function() {
this.reactMountReady.notifyAll();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [
SELECTION_RESTORATION,
EVENT_SUPPRESSION,
ON_DOM_READY_QUEUEING
];
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction() {
this.reinitializeTransaction();
this.reactMountReady = ReactMountReady.getPooled(null);
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap proceedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function() {
if (ExecutionEnvironment.canUseDOM) {
return TRANSACTION_WRAPPERS;
} else {
return [];
}
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
* TODO: convert to ReactMountReady
*/
getReactMountReady: function() {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be resused.
*/
destructor: function() {
ReactMountReady.release(this.reactMountReady);
this.reactMountReady = null;
}
};
mixInto(ReactReconcileTransaction, Transaction.Mixin);
mixInto(ReactReconcileTransaction, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
},{"./ExecutionEnvironment":21,"./PooledClass":25,"./ReactEventEmitter":46,"./ReactInputSelection":49,"./ReactMountReady":54,"./Transaction":82,"./mixInto":118}],62:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks static-only
* @providesModule ReactServerRendering
*/
"use strict";
var ReactMarkupChecksum = require("./ReactMarkupChecksum");
var ReactReconcileTransaction = require("./ReactReconcileTransaction");
var ReactInstanceHandles = require("./ReactInstanceHandles");
/**
* @param {object} component
* @param {function} callback
*/
function renderComponentToString(component, callback) {
// We use a callback API to keep the API async in case in the future we ever
// need it, but in reality this is a synchronous operation.
var id = ReactInstanceHandles.createReactRootID();
var transaction = ReactReconcileTransaction.getPooled();
transaction.reinitializeTransaction();
try {
transaction.perform(function() {
var markup = component.mountComponent(id, transaction, 0);
markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
callback(markup);
}, null);
} finally {
ReactReconcileTransaction.release(transaction);
}
}
module.exports = {
renderComponentToString: renderComponentToString
};
},{"./ReactInstanceHandles":50,"./ReactMarkupChecksum":52,"./ReactReconcileTransaction":61}],63:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactStateSetters
*/
"use strict";
var ReactStateSetters = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* @param {ReactCompositeComponent} component
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(component, funcReturningState) {
return function(a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {ReactCompositeComponent} component
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
}
};
function createStateKeySetter(component, key) {
// Partial state is allocated outside of the function closure so it can be
// reused with every call, avoiding memory allocation when this function
// is called.
var partialState = {};
return function stateKeySetter(value) {
partialState[key] = value;
component.setState(partialState);
};
}
ReactStateSetters.Mixin = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateSetter(function(xValue) {
* return {x: xValue};
* })(1);
*
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateKeySetter('x')(1);
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
module.exports = ReactStateSetters;
},{}],64:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTextComponent
* @typechecks static-only
*/
"use strict";
var ReactComponent = require("./ReactComponent");
var ReactMount = require("./ReactMount");
var escapeTextForBrowser = require("./escapeTextForBrowser");
var mixInto = require("./mixInto");
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings in elements so that they can undergo
* the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactTextComponent
* @extends ReactComponent
* @internal
*/
var ReactTextComponent = function(initialText) {
this.construct({text: initialText});
};
mixInto(ReactTextComponent, ReactComponent.Mixin);
mixInto(ReactTextComponent, {
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
this,
rootID,
transaction,
mountDepth
);
return (
'<span ' + ReactMount.ATTR_NAME + '="' + rootID + '">' +
escapeTextForBrowser(this.props.text) +
'</span>'
);
},
/**
* Updates this component by updating the text content.
*
* @param {object} nextProps Contains the next text content.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveProps: function(nextProps, transaction) {
if (nextProps.text !== this.props.text) {
this.props.text = nextProps.text;
ReactComponent.DOMIDOperations.updateTextContentByID(
this._rootNodeID,
nextProps.text
);
}
}
});
module.exports = ReactTextComponent;
},{"./ReactComponent":28,"./ReactMount":53,"./escapeTextForBrowser":93,"./mixInto":118}],65:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTransitionEvents
*/
"use strict";
var ExecutionEnvironment = require("./ExecutionEnvironment");
var EVENT_NAME_MAP = {
transitionend: {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'mozTransitionEnd',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd'
},
animationend: {
'animation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'mozAnimationEnd',
'OAnimation': 'oAnimationEnd',
'msAnimation': 'MSAnimationEnd'
}
};
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
for (var baseEventName in EVENT_NAME_MAP) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
if (ExecutionEnvironment.canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function(node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function(endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function(endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
},{"./ExecutionEnvironment":21}],66:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTransitionGroup
*/
"use strict";
var React = require("./React");
var ReactTransitionableChild = require("./ReactTransitionableChild");
var ReactTransitionKeySet = require("./ReactTransitionKeySet");
var invariant = require("./invariant");
var ReactTransitionGroupMixin = {
componentWillMount: function() {
// _transitionGroupCurrentKeys stores the union of previous *and* next keys.
// If this were a component we'd store it as state, however, since this must
// be a mixin, we need to keep the result of the union of keys in each
// call to animateChildren() which happens in render(), so we can't
// call setState() in there.
this._transitionGroupCurrentKeys = {};
},
/**
* Render some children in a transitionable way.
*/
renderTransitionableChildren: function(sourceChildren) {
invariant(
this.getTransitionConfig,
'renderTransitionableChildren(): You must provide a ' +
'getTransitionConfig() method.'
);
var children = {};
var childMapping = ReactTransitionKeySet.getChildMapping(sourceChildren);
var transitionConfig = this.getTransitionConfig();
var currentKeys = ReactTransitionKeySet.mergeKeySets(
this._transitionGroupCurrentKeys,
ReactTransitionKeySet.getKeySet(sourceChildren)
);
for (var key in currentKeys) {
// Here is how we keep the nodes in the DOM. ReactTransitionableChild
// knows how to hold onto its child if it changes to undefined. Here, we
// may look up an old key in the new children, and it may switch to
// undefined. React's reconciler will keep the ReactTransitionableChild
// instance alive such that we can animate it.
if (childMapping[key] || transitionConfig.leave) {
children[key] = ReactTransitionableChild({
name: transitionConfig.name,
enter: transitionConfig.enter,
onDoneLeaving: this._handleDoneLeaving.bind(this, key)
}, childMapping[key]);
}
}
this._transitionGroupCurrentKeys = currentKeys;
return children;
},
_handleDoneLeaving: function(key) {
// When the leave animation finishes, we should blow away the actual DOM
// node.
delete this._transitionGroupCurrentKeys[key];
this.forceUpdate();
}
};
var ReactTransitionGroup = React.createClass({
mixins: [ReactTransitionGroupMixin],
getDefaultProps: function() {
return {
transitionEnter: true,
transitionLeave: true,
component: React.DOM.span
};
},
getTransitionConfig: function() {
return {
name: this.props.transitionName,
enter: this.props.transitionEnter,
leave: this.props.transitionLeave
};
},
render: function() {
return this.transferPropsTo(
this.props.component(
{
transitionName: null,
transitionEnter: null,
transitionLeave: null,
component: null
},
this.renderTransitionableChildren(this.props.children)
)
);
}
});
module.exports = ReactTransitionGroup;
},{"./React":26,"./ReactTransitionKeySet":67,"./ReactTransitionableChild":68,"./invariant":106}],67:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks static-only
* @providesModule ReactTransitionKeySet
*/
"use strict";
var ReactChildren = require("./ReactChildren");
var MERGE_KEY_SETS_TAIL_SENTINEL = {};
var ReactTransitionKeySet = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
* simple syntactic sugar around ReactChildren.map().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
getChildMapping: function(children) {
return ReactChildren.map(children, function(child) {
return child;
});
},
/**
* Simple syntactic sugar to get an object with keys of all of `children`.
* Does not have references to the children themselves.
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to the value "true"
*/
getKeySet: function(children) {
return ReactChildren.map(children, function() {
return true;
});
},
/**
* When you're adding or removing children some may be added or removed in the
* same render pass. We want ot show *both* since we want to simultaneously
* animate elements in and out. This function takes a previous set of keys
* and a new set of keys and merges them with its best guess of the correct
* ordering. In the future we may expose some of the utilities in
* ReactMultiChild to make this easy, but for now React itself does not
* directly have this concept of the union of prevChildren and nextChildren
* so we implement it here.
*
* @param {object} prev prev child keys as returned from
* `ReactTransitionKeySet.getKeySet()`.
* @param {object} next next child keys as returned from
* `ReactTransitionKeySet.getKeySet()`.
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
mergeKeySets: function(prev, next) {
var keySet = {};
var prevKeys = Object.keys(prev).concat([MERGE_KEY_SETS_TAIL_SENTINEL]);
var nextKeys = Object.keys(next).concat([MERGE_KEY_SETS_TAIL_SENTINEL]);
var i;
for (i = 0; i < prevKeys.length - 1; i++) {
var prevKey = prevKeys[i];
if (next[prevKey]) {
continue;
}
// This key is not in the new set. Place it in our
// best guess where it should go. We do this by searching
// for a key after the current one in prevKeys that is
// still in nextKeys, and inserting right before it.
// I know this is O(n^2), but this is not a particularly
// hot code path.
var insertPos = -1;
for (var j = i + 1; j < prevKeys.length; j++) {
insertPos = nextKeys.indexOf(prevKeys[j]);
if (insertPos >= 0) {
break;
}
}
// Insert before insertPos
nextKeys.splice(insertPos, 0, prevKey);
}
for (i = 0; i < nextKeys.length - 1; i++) {
keySet[nextKeys[i]] = true;
}
return keySet;
}
};
module.exports = ReactTransitionKeySet;
},{"./ReactChildren":27}],68:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTransitionableChild
*/
"use strict";
var React = require("./React");
var CSSCore = require("./CSSCore");
var ReactTransitionEvents = require("./ReactTransitionEvents");
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
var NO_EVENT_TIMEOUT = 5000;
var noEventListener = null;
if (true) {
noEventListener = function() {
console.warn(
'transition(): tried to perform an animation without ' +
'an animationend or transitionend event after timeout (' +
NO_EVENT_TIMEOUT + 'ms). You should either disable this ' +
'transition in JS or add a CSS animation/transition.'
);
};
}
/**
* This component is simply responsible for watching when its single child
* changes to undefined and animating the old child out. It does this by
* recording its old child in savedChildren when it detects this event is about
* to occur.
*/
var ReactTransitionableChild = React.createClass({
/**
* Perform an actual DOM transition. This takes care of a few things:
* - Adding the second CSS class to trigger the transition
* - Listening for the finish event
* - Cleaning up the css (unless noReset is true)
*/
transition: function(animationType, noReset, finishCallback) {
var node = this.getDOMNode();
var className = this.props.name + '-' + animationType;
var activeClassName = className + '-active';
var noEventTimeout = null;
var endListener = function() {
if (true) {
clearTimeout(noEventTimeout);
}
// If this gets invoked after the component is unmounted it's OK.
if (!noReset) {
// Usually this means you're about to remove the node if you want to
// leave it in its animated state.
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
}
ReactTransitionEvents.removeEndEventListener(node, endListener);
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
finishCallback && finishCallback();
};
ReactTransitionEvents.addEndEventListener(node, endListener);
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
if (true) {
noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
}
},
queueClass: function(className) {
this.classNameQueue.push(className);
if (this.props.runNextTick) {
this.props.runNextTick(this.flushClassNameQueue);
return;
}
if (!this.timeout) {
this.timeout = setTimeout(this.flushClassNameQueue, TICK);
}
},
flushClassNameQueue: function() {
if (this.isMounted()) {
this.classNameQueue.forEach(
CSSCore.addClass.bind(CSSCore, this.getDOMNode())
);
}
this.classNameQueue.length = 0;
this.timeout = null;
},
componentWillMount: function() {
this.classNameQueue = [];
},
componentWillUnmount: function() {
if (this.timeout) {
clearTimeout(this.timeout);
}
},
componentWillReceiveProps: function(nextProps) {
if (!nextProps.children && this.props.children) {
this.savedChildren = this.props.children;
}
},
componentDidMount: function(node) {
if (this.props.enter) {
this.transition('enter');
}
},
componentDidUpdate: function(prevProps, prevState, node) {
if (prevProps.children && !this.props.children) {
this.transition('leave', true, this.props.onDoneLeaving);
}
},
render: function() {
return this.props.children || this.savedChildren;
}
});
module.exports = ReactTransitionableChild;
},{"./CSSCore":2,"./React":26,"./ReactTransitionEvents":65}],69:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactUpdates
*/
"use strict";
var invariant = require("./invariant");
var dirtyComponents = [];
var batchingStrategy = null;
function ensureBatchingStrategy() {
invariant(batchingStrategy, 'ReactUpdates: must inject a batching strategy');
}
function batchedUpdates(callback, param) {
ensureBatchingStrategy();
batchingStrategy.batchedUpdates(callback, param);
}
/**
* Array comparator for ReactComponents by owner depth
*
* @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 mountDepthComparator(c1, c2) {
return c1._mountDepth - c2._mountDepth;
}
function runBatchedUpdates() {
// 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(mountDepthComparator);
for (var i = 0; i < dirtyComponents.length; i++) {
// If a component is unmounted before pending changes apply, ignore them
// TODO: Queue unmounts in the same list to avoid this happening at all
var component = dirtyComponents[i];
if (component.isMounted()) {
// 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;
component.performUpdateIfNecessary();
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
callbacks[j].call(component);
}
}
}
}
}
function clearDirtyComponents() {
dirtyComponents.length = 0;
}
function flushBatchedUpdates() {
// Run these in separate functions so the JIT can optimize
try {
runBatchedUpdates();
} catch (e) {
// IE 8 requires catch to use finally.
throw e;
} finally {
clearDirtyComponents();
}
}
/**
* 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, callback) {
invariant(
!callback || typeof callback === "function",
'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' +
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
'isn\'t callable.'
);
ensureBatchingStrategy();
if (!batchingStrategy.isBatchingUpdates) {
component.performUpdateIfNecessary();
callback && callback();
return;
}
dirtyComponents.push(component);
if (callback) {
if (component._pendingCallbacks) {
component._pendingCallbacks.push(callback);
} else {
component._pendingCallbacks = [callback];
}
}
}
var ReactUpdatesInjection = {
injectBatchingStrategy: function(_batchingStrategy) {
invariant(
_batchingStrategy,
'ReactUpdates: must provide a batching strategy'
);
invariant(
typeof _batchingStrategy.batchedUpdates === 'function',
'ReactUpdates: must provide a batchedUpdates() function'
);
invariant(
typeof _batchingStrategy.isBatchingUpdates === 'boolean',
'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
);
batchingStrategy = _batchingStrategy;
}
};
var ReactUpdates = {
batchedUpdates: batchedUpdates,
enqueueUpdate: enqueueUpdate,
flushBatchedUpdates: flushBatchedUpdates,
injection: ReactUpdatesInjection
};
module.exports = ReactUpdates;
},{"./invariant":106}],70:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactWithAddons
*/
/**
* This module exists purely in the open source project, and is meant as a way
* to create a separate standalone build of React. This build has "addons", or
* functionality we've built and think might be useful but doesn't have a good
* place to live inside React core.
*/
"use strict";
var LinkedStateMixin = require("./LinkedStateMixin");
var React = require("./React");
var ReactTransitionGroup = require("./ReactTransitionGroup");
var cx = require("./cx");
React.addons = {
classSet: cx,
LinkedStateMixin: LinkedStateMixin,
TransitionGroup: ReactTransitionGroup
};
module.exports = React;
},{"./LinkedStateMixin":22,"./React":26,"./ReactTransitionGroup":66,"./cx":90}],71:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SelectEventPlugin
*/
"use strict";
var EventConstants = require("./EventConstants");
var EventPluginHub = require("./EventPluginHub");
var EventPropagators = require("./EventPropagators");
var ExecutionEnvironment = require("./ExecutionEnvironment");
var ReactInputSelection = require("./ReactInputSelection");
var SyntheticEvent = require("./SyntheticEvent");
var getActiveElement = require("./getActiveElement");
var isEventSupported = require("./isEventSupported");
var isTextInputElement = require("./isTextInputElement");
var keyOf = require("./keyOf");
var shallowEqual = require("./shallowEqual");
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: keyOf({onSelect: null}),
captured: keyOf({onSelectCapture: null})
}
}
};
var useSelectionChange = false;
var useSelect = false;
if (ExecutionEnvironment.canUseDOM) {
useSelectionChange = 'onselectionchange' in document;
useSelect = isEventSupported('select');
}
var activeElement = null;
var activeElementID = null;
var activeNativeEvent = null;
var lastSelection = null;
var mouseDown = false;
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @param {object}
*/
function getSelection(node) {
if ('selectionStart' in node &&
ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
} else {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior).
if (mouseDown || activeElement != getActiveElement()) {
return;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(
eventTypes.select,
activeElementID,
nativeEvent
);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
}
/**
* Handle deferred event. And manually dispatch synthetic events.
*/
function dispatchDeferredSelectEvent() {
if (!activeNativeEvent) {
return;
}
var syntheticEvent = constructSelectEvent(activeNativeEvent);
activeNativeEvent = null;
// Enqueue and process the abstract event manually.
if (syntheticEvent) {
EventPluginHub.enqueueEvents(syntheticEvent);
EventPluginHub.processEventQueue();
}
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
if (isTextInputElement(topLevelTarget) ||
topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
activeElementID = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case topLevelTypes.topMouseDown:
mouseDown = true;
break;
case topLevelTypes.topMouseUp:
mouseDown = false;
return constructSelectEvent(nativeEvent);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't).
case topLevelTypes.topSelectionChange:
return constructSelectEvent(nativeEvent);
// Firefox doesn't support selectionchange, so check selection status
// after each key entry.
case topLevelTypes.topKeyDown:
if (!useSelectionChange) {
activeNativeEvent = nativeEvent;
setTimeout(dispatchDeferredSelectEvent, 0);
}
break;
}
}
};
module.exports = SelectEventPlugin;
},{"./EventConstants":15,"./EventPluginHub":17,"./EventPropagators":20,"./ExecutionEnvironment":21,"./ReactInputSelection":49,"./SyntheticEvent":75,"./getActiveElement":99,"./isEventSupported":107,"./isTextInputElement":109,"./keyOf":113,"./shallowEqual":124}],72:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SimpleEventPlugin
*/
"use strict";
var EventConstants = require("./EventConstants");
var EventPropagators = require("./EventPropagators");
var SyntheticClipboardEvent = require("./SyntheticClipboardEvent");
var SyntheticEvent = require("./SyntheticEvent");
var SyntheticFocusEvent = require("./SyntheticFocusEvent");
var SyntheticKeyboardEvent = require("./SyntheticKeyboardEvent");
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
var SyntheticTouchEvent = require("./SyntheticTouchEvent");
var SyntheticUIEvent = require("./SyntheticUIEvent");
var SyntheticWheelEvent = require("./SyntheticWheelEvent");
var invariant = require("./invariant");
var keyOf = require("./keyOf");
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
blur: {
phasedRegistrationNames: {
bubbled: keyOf({onBlur: true}),
captured: keyOf({onBlurCapture: true})
}
},
click: {
phasedRegistrationNames: {
bubbled: keyOf({onClick: true}),
captured: keyOf({onClickCapture: true})
}
},
copy: {
phasedRegistrationNames: {
bubbled: keyOf({onCopy: true}),
captured: keyOf({onCopyCapture: true})
}
},
cut: {
phasedRegistrationNames: {
bubbled: keyOf({onCut: true}),
captured: keyOf({onCutCapture: true})
}
},
doubleClick: {
phasedRegistrationNames: {
bubbled: keyOf({onDoubleClick: true}),
captured: keyOf({onDoubleClickCapture: true})
}
},
drag: {
phasedRegistrationNames: {
bubbled: keyOf({onDrag: true}),
captured: keyOf({onDragCapture: true})
}
},
dragEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onDragEnd: true}),
captured: keyOf({onDragEndCapture: true})
}
},
dragEnter: {
phasedRegistrationNames: {
bubbled: keyOf({onDragEnter: true}),
captured: keyOf({onDragEnterCapture: true})
}
},
dragExit: {
phasedRegistrationNames: {
bubbled: keyOf({onDragExit: true}),
captured: keyOf({onDragExitCapture: true})
}
},
dragLeave: {
phasedRegistrationNames: {
bubbled: keyOf({onDragLeave: true}),
captured: keyOf({onDragLeaveCapture: true})
}
},
dragOver: {
phasedRegistrationNames: {
bubbled: keyOf({onDragOver: true}),
captured: keyOf({onDragOverCapture: true})
}
},
dragStart: {
phasedRegistrationNames: {
bubbled: keyOf({onDragStart: true}),
captured: keyOf({onDragStartCapture: true})
}
},
drop: {
phasedRegistrationNames: {
bubbled: keyOf({onDrop: true}),
captured: keyOf({onDropCapture: true})
}
},
focus: {
phasedRegistrationNames: {
bubbled: keyOf({onFocus: true}),
captured: keyOf({onFocusCapture: true})
}
},
input: {
phasedRegistrationNames: {
bubbled: keyOf({onInput: true}),
captured: keyOf({onInputCapture: true})
}
},
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyDown: true}),
captured: keyOf({onKeyDownCapture: true})
}
},
keyPress: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyPress: true}),
captured: keyOf({onKeyPressCapture: true})
}
},
keyUp: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyUp: true}),
captured: keyOf({onKeyUpCapture: true})
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseDown: true}),
captured: keyOf({onMouseDownCapture: true})
}
},
mouseMove: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseMove: true}),
captured: keyOf({onMouseMoveCapture: true})
}
},
mouseUp: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseUp: true}),
captured: keyOf({onMouseUpCapture: true})
}
},
paste: {
phasedRegistrationNames: {
bubbled: keyOf({onPaste: true}),
captured: keyOf({onPasteCapture: true})
}
},
scroll: {
phasedRegistrationNames: {
bubbled: keyOf({onScroll: true}),
captured: keyOf({onScrollCapture: true})
}
},
submit: {
phasedRegistrationNames: {
bubbled: keyOf({onSubmit: true}),
captured: keyOf({onSubmitCapture: true})
}
},
touchCancel: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchCancel: true}),
captured: keyOf({onTouchCancelCapture: true})
}
},
touchEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchEnd: true}),
captured: keyOf({onTouchEndCapture: true})
}
},
touchMove: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchMove: true}),
captured: keyOf({onTouchMoveCapture: true})
}
},
touchStart: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchStart: true}),
captured: keyOf({onTouchStartCapture: true})
}
},
wheel: {
phasedRegistrationNames: {
bubbled: keyOf({onWheel: true}),
captured: keyOf({onWheelCapture: true})
}
}
};
var topLevelEventsToDispatchConfig = {
topBlur: eventTypes.blur,
topClick: eventTypes.click,
topCopy: eventTypes.copy,
topCut: eventTypes.cut,
topDoubleClick: eventTypes.doubleClick,
topDrag: eventTypes.drag,
topDragEnd: eventTypes.dragEnd,
topDragEnter: eventTypes.dragEnter,
topDragExit: eventTypes.dragExit,
topDragLeave: eventTypes.dragLeave,
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topScroll: eventTypes.scroll,
topSubmit: eventTypes.submit,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
topWheel: eventTypes.wheel
};
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
* Same as the default implementation, except cancels the event when return
* value is false.
*
* @param {object} Event to be dispatched.
* @param {function} Application-level callback.
* @param {string} domID DOM ID to pass to the callback.
*/
executeDispatch: function(event, listener, domID) {
var returnValue = listener(event, domID);
if (returnValue === false) {
event.stopPropagation();
event.preventDefault();
}
},
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch(topLevelType) {
case topLevelTypes.topInput:
case topLevelTypes.topSubmit:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyPress:
case topLevelTypes.topKeyUp:
EventConstructor = SyntheticKeyboardEvent;
break;
case topLevelTypes.topBlur:
case topLevelTypes.topFocus:
EventConstructor = SyntheticFocusEvent;
break;
case topLevelTypes.topClick:
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case topLevelTypes.topDoubleClick:
case topLevelTypes.topDrag:
case topLevelTypes.topDragEnd:
case topLevelTypes.topDragEnter:
case topLevelTypes.topDragExit:
case topLevelTypes.topDragLeave:
case topLevelTypes.topDragOver:
case topLevelTypes.topDragStart:
case topLevelTypes.topDrop:
case topLevelTypes.topMouseDown:
case topLevelTypes.topMouseMove:
case topLevelTypes.topMouseUp:
EventConstructor = SyntheticMouseEvent;
break;
case topLevelTypes.topTouchCancel:
case topLevelTypes.topTouchEnd:
case topLevelTypes.topTouchMove:
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
case topLevelTypes.topWheel:
EventConstructor = SyntheticWheelEvent;
break;
case topLevelTypes.topCopy:
case topLevelTypes.topCut:
case topLevelTypes.topPaste:
EventConstructor = SyntheticClipboardEvent;
break;
}
invariant(
EventConstructor,
'SimpleEventPlugin: Unhandled event type, `%s`.',
topLevelType
);
var event = EventConstructor.getPooled(
dispatchConfig,
topLevelTargetID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
};
module.exports = SimpleEventPlugin;
},{"./EventConstants":15,"./EventPropagators":20,"./SyntheticClipboardEvent":73,"./SyntheticEvent":75,"./SyntheticFocusEvent":76,"./SyntheticKeyboardEvent":77,"./SyntheticMouseEvent":78,"./SyntheticTouchEvent":79,"./SyntheticUIEvent":80,"./SyntheticWheelEvent":81,"./invariant":106,"./keyOf":113}],73:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticClipboardEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = require("./SyntheticEvent");
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: null
};
/**
* @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 SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
},{"./SyntheticEvent":75}],74:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticCompositionEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = require("./SyntheticEvent");
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @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 SyntheticCompositionEvent(
dispatchConfig,
dispatchMarker,
nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(
SyntheticCompositionEvent,
CompositionEventInterface
);
module.exports = SyntheticCompositionEvent;
},{"./SyntheticEvent":75}],75:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticEvent
* @typechecks static-only
*/
"use strict";
var PooledClass = require("./PooledClass");
var emptyFunction = require("./emptyFunction");
var getEventTarget = require("./getEventTarget");
var merge = require("./merge");
var mergeInto = require("./mergeInto");
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
target: getEventTarget,
currentTarget: null,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function(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 {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
this[propName] = nativeEvent[propName];
}
}
if (nativeEvent.defaultPrevented || nativeEvent.returnValue === false) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}
mergeInto(SyntheticEvent.prototype, {
preventDefault: function() {
this.defaultPrevented = true;
var event = this.nativeEvent;
event.preventDefault ? event.preventDefault() : event.returnValue = false;
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function() {
var event = this.nativeEvent;
event.stopPropagation ? event.stopPropagation() : 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() {
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() {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
}
this.dispatchConfig = null;
this.dispatchMarker = null;
this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function(Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
mergeInto(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = merge(Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
module.exports = SyntheticEvent;
},{"./PooledClass":25,"./emptyFunction":92,"./getEventTarget":100,"./merge":115,"./mergeInto":117}],76:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = require("./SyntheticUIEvent");
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @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 SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
},{"./SyntheticUIEvent":80}],77:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticKeyboardEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = require("./SyntheticUIEvent");
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
'char': null,
key: null,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
// Legacy Interface
charCode: null,
keyCode: null,
which: null
};
/**
* @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 SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
},{"./SyntheticUIEvent":80}],78:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticMouseEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = require("./SyntheticUIEvent");
var ViewportMetrics = require("./ViewportMetrics");
/**
* @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,
button: function(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(event) {
return event.relatedTarget || (
event.fromElement === event.srcElement ?
event.toElement :
event.fromElement
);
},
// "Proprietary" Interface.
pageX: function(event) {
return 'pageX' in event ?
event.pageX :
event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function(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) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
},{"./SyntheticUIEvent":80,"./ViewportMetrics":83}],79:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticTouchEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = require("./SyntheticUIEvent");
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null
};
/**
* @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 SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
},{"./SyntheticUIEvent":80}],80:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticUIEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = require("./SyntheticEvent");
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: null,
detail: null
};
/**
* @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) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
},{"./SyntheticEvent":75}],81:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticWheelEvent
* @typechecks static-only
*/
"use strict";
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function(event) {
// NOTE: IE<9 does not support x-axis delta.
return (
'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0
);
},
deltaY: function(event) {
return (
// Normalize (up is positive).
'deltaY' in event ? -event.deltaY :
// Fallback to `wheelDeltaY` for Webkit.
'wheelDeltaY' in event ? event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9.
'wheelDelta' in event ? event.wheelData : 0
);
},
deltaZ: null,
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
},{"./SyntheticMouseEvent":78}],82:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule Transaction
*/
"use strict";
var invariant = require("./invariant");
/**
* `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 ran while it is already being ran. 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>
*
* Bonus:
* - Reports timing metrics by method name and wrapper index.
*
* 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 `componentDidRender` 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 upates.
*
* 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 Mixin = {
/**
* 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() {
this.transactionWrappers = this.getTransactionWrappers();
if (!this.wrapperInitData) {
this.wrapperInitData = [];
} else {
this.wrapperInitData.length = 0;
}
if (!this.timingMetrics) {
this.timingMetrics = {};
}
this.timingMetrics.methodInvocationTime = 0;
if (!this.timingMetrics.wrapperInitTimes) {
this.timingMetrics.wrapperInitTimes = [];
} else {
this.timingMetrics.wrapperInitTimes.length = 0;
}
if (!this.timingMetrics.wrapperCloseTimes) {
this.timingMetrics.wrapperCloseTimes = [];
} else {
this.timingMetrics.wrapperCloseTimes.length = 0;
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function() {
return !!this._isInTransaction;
},
/**
* 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.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} args... Arguments to pass to the method (optional).
* Helps prevent need to bind in many cases.
* @return Return value from `method`.
*/
perform: function(method, scope, a, b, c, d, e, f) {
invariant(
!this.isInTransaction(),
'Transaction.perform(...): Cannot initialize a transaction when there ' +
'is already an outstanding transaction.'
);
var memberStart = Date.now();
var errorToThrow = null;
var ret;
try {
this.initializeAll();
ret = method.call(scope, a, b, c, d, e, f);
} catch (error) {
// IE8 requires `catch` in order to use `finally`.
errorToThrow = error;
} finally {
var memberEnd = Date.now();
this.methodInvocationTime += (memberEnd - memberStart);
try {
this.closeAll();
} catch (closeError) {
// If `method` throws, prefer to show that stack trace over any thrown
// by invoking `closeAll`.
errorToThrow = errorToThrow || closeError;
}
}
if (errorToThrow) {
throw errorToThrow;
}
return ret;
},
initializeAll: function() {
this._isInTransaction = true;
var transactionWrappers = this.transactionWrappers;
var wrapperInitTimes = this.timingMetrics.wrapperInitTimes;
var errorToThrow = null;
for (var i = 0; i < transactionWrappers.length; i++) {
var initStart = Date.now();
var wrapper = transactionWrappers[i];
try {
this.wrapperInitData[i] = wrapper.initialize ?
wrapper.initialize.call(this) :
null;
} catch (initError) {
// Prefer to show the stack trace of the first error.
errorToThrow = errorToThrow || initError;
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
} finally {
var curInitTime = wrapperInitTimes[i];
var initEnd = Date.now();
wrapperInitTimes[i] = (curInitTime || 0) + (initEnd - initStart);
}
}
if (errorToThrow) {
throw errorToThrow;
}
},
/**
* 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() {
invariant(
this.isInTransaction(),
'Transaction.closeAll(): Cannot close transaction when none are open.'
);
var transactionWrappers = this.transactionWrappers;
var wrapperCloseTimes = this.timingMetrics.wrapperCloseTimes;
var errorToThrow = null;
for (var i = 0; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
var closeStart = Date.now();
var initData = this.wrapperInitData[i];
try {
if (initData !== Transaction.OBSERVED_ERROR) {
wrapper.close && wrapper.close.call(this, initData);
}
} catch (closeError) {
// Prefer to show the stack trace of the first error.
errorToThrow = errorToThrow || closeError;
} finally {
var closeEnd = Date.now();
var curCloseTime = wrapperCloseTimes[i];
wrapperCloseTimes[i] = (curCloseTime || 0) + (closeEnd - closeStart);
}
}
this.wrapperInitData.length = 0;
this._isInTransaction = false;
if (errorToThrow) {
throw errorToThrow;
}
}
};
var Transaction = {
Mixin: Mixin,
/**
* Token to look for to determine if an error occured.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
},{"./invariant":106}],83:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ViewportMetrics
*/
"use strict";
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function() {
ViewportMetrics.currentScrollLeft =
document.body.scrollLeft + document.documentElement.scrollLeft;
ViewportMetrics.currentScrollTop =
document.body.scrollTop + document.documentElement.scrollTop;
}
};
module.exports = ViewportMetrics;
},{}],84:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule accumulate
*/
"use strict";
var invariant = require("./invariant");
/**
* Accumulates items that must not be null or undefined.
*
* This is used to conserve memory by avoiding array allocations.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulate(current, next) {
invariant(
next != null,
'accumulate(...): Accumulated items must be not be null or undefined.'
);
if (current == null) {
return next;
} else {
// 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).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray) {
return current.concat(next);
} else {
if (nextIsArray) {
return [current].concat(next);
} else {
return [current, next];
}
}
}
}
module.exports = accumulate;
},{"./invariant":106}],85:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule adler32
*/
/* jslint bitwise:true */
"use strict";
var MOD = 65521;
// This is a clean-room implementation of adler32 designed for detecting
// if markup is not what we expect it to be. It does not need to be
// cryptographically strong, only reasonable good at detecting if markup
// generated on the server is different than that on the client.
function adler32(data) {
var a = 1;
var b = 0;
for (var i = 0; i < data.length; i++) {
a = (a + data.charCodeAt(i)) % MOD;
b = (b + a) % MOD;
}
return a | (b << 16);
}
module.exports = adler32;
},{}],86:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule copyProperties
*/
/**
* Copy properties from one or more objects (up to 5) into the first object.
* This is a shallow copy. It mutates the first object and also returns it.
*
* NOTE: `arguments` has a very significant performance penalty, which is why
* we don't support unlimited arguments.
*/
function copyProperties(obj, a, b, c, d, e, f) {
obj = obj || {};
if (true) {
if (f) {
throw new Error('Too many arguments passed to copyProperties');
}
}
var args = [a, b, c, d, e];
var ii = 0, v;
while (args[ii]) {
v = args[ii++];
for (var k in v) {
obj[k] = v[k];
}
// IE ignores toString in object iteration.. See:
// webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html
if (v.hasOwnProperty && v.hasOwnProperty('toString') &&
(typeof v.toString != 'undefined') && (obj.toString !== v.toString)) {
obj.toString = v.toString;
}
}
return obj;
}
module.exports = copyProperties;
},{}],87:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule createArrayFrom
* @typechecks
*/
/**
* NOTE: if you are a previous user of this function, it has been considered
* unsafe because it's inconsistent across browsers for some inputs.
* Instead use `Array.isArray()`.
*
* 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()).
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return (
// not null/false
!!obj &&
// arrays are objects, NodeLists are functions in Safari
(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
(// HTMLCollection/NodeList
(Array.isArray(obj) ||
// arguments
('callee' in obj) || '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 createArrayFrom = require('createArrayFrom');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFrom(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* This is also good for converting certain pseudo-arrays, like `arguments` or
* HTMLCollections, into arrays.
*
* @param {*} obj
* @return {array}
*/
function createArrayFrom(obj) {
if (!hasArrayNature(obj)) {
return [obj];
}
if (obj.item) {
// IE does not support Array#slice on HTMLCollections
var l = obj.length, ret = new Array(l);
while (l--) { ret[l] = obj[l]; }
return ret;
}
return Array.prototype.slice.call(obj);
}
module.exports = createArrayFrom;
},{}],88:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule createNodesFromMarkup
* @typechecks
*/
/*jslint evil: true, sub: true */
var ExecutionEnvironment = require("./ExecutionEnvironment");
var createArrayFrom = require("./createArrayFrom");
var getMarkupWrap = require("./getMarkupWrap");
var invariant = require("./invariant");
/**
* 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;
invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized');
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) {
invariant(
handleScript,
'createNodesFromMarkup(...): Unexpected <script> element rendered.'
);
createArrayFrom(scripts).forEach(handleScript);
}
var nodes = createArrayFrom(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
},{"./ExecutionEnvironment":21,"./createArrayFrom":87,"./getMarkupWrap":101,"./invariant":106}],89:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule createObjectFrom
*/
/**
* Construct an object from an array of keys
* and optionally specified value or list of values.
*
* >>> createObjectFrom(['a','b','c']);
* {a: true, b: true, c: true}
*
* >>> createObjectFrom(['a','b','c'], false);
* {a: false, b: false, c: false}
*
* >>> createObjectFrom(['a','b','c'], 'monkey');
* {c:'monkey', b:'monkey' c:'monkey'}
*
* >>> createObjectFrom(['a','b','c'], [1,2,3]);
* {a: 1, b: 2, c: 3}
*
* >>> createObjectFrom(['women', 'men'], [true, false]);
* {women: true, men: false}
*
* @param Array list of keys
* @param mixed optional value or value array. defaults true.
* @returns object
*/
function createObjectFrom(keys, values /* = true */) {
if (true) {
if (!Array.isArray(keys)) {
throw new TypeError('Must pass an array of keys.');
}
}
var object = {};
var isArray = Array.isArray(values);
if (typeof values == 'undefined') {
values = true;
}
for (var ii = keys.length; ii--;) {
object[keys[ii]] = isArray ? values[ii] : values;
}
return object;
}
module.exports = createObjectFrom;
},{}],90:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule cx
*/
/**
* This function is used to mark string literals representing CSS class names
* so that they can be transformed statically. This allows for modularization
* and minification of CSS class names.
*
* In static_upstream, this function is actually implemented, but it should
* eventually be replaced with something more descriptive, and the transform
* that is used in the main stack should be ported for use elsewhere.
*
* @param string|object className to modularize, or an object of key/values.
* In the object case, the values are conditions that
* determine if the className keys should be included.
* @param [string ...] Variable list of classNames in the string case.
* @return string Renderable space-separated CSS className.
*/
function cx(classNames) {
if (typeof classNames == 'object') {
return Object.keys(classNames).map(function(className) {
return classNames[className] ? className : '';
}).join(' ');
} else {
return Array.prototype.join.call(arguments, ' ');
}
}
module.exports = cx;
},{}],91:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule dangerousStyleValue
* @typechecks static-only
*/
"use strict";
var CSSProperty = require("./CSSProperty");
/**
* Convert a value into the proper css writable value. The `styleName` name
* name should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} styleName CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(styleName, value) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || CSSProperty.isUnitlessNumber[styleName]) {
return '' + value; // cast to string
}
return value + 'px';
}
module.exports = dangerousStyleValue;
},{"./CSSProperty":3}],92:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule emptyFunction
*/
var copyProperties = require("./copyProperties");
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.
*/
function emptyFunction() {}
copyProperties(emptyFunction, {
thatReturns: makeEmptyFunction,
thatReturnsFalse: makeEmptyFunction(false),
thatReturnsTrue: makeEmptyFunction(true),
thatReturnsNull: makeEmptyFunction(null),
thatReturnsThis: function() { return this; },
thatReturnsArgument: function(arg) { return arg; }
});
module.exports = emptyFunction;
},{"./copyProperties":86}],93:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule escapeTextForBrowser
* @typechecks static-only
*/
"use strict";
var ESCAPE_LOOKUP = {
"&": "&",
">": ">",
"<": "<",
"\"": """,
"'": "'",
"/": "/"
};
var ESCAPE_REGEX = /[&><"'\/]/g;
function escaper(match) {
return ESCAPE_LOOKUP[match];
}
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextForBrowser(text) {
return ('' + text).replace(ESCAPE_REGEX, escaper);
}
module.exports = escapeTextForBrowser;
},{}],94:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ex
* @typechecks
* @nostacktrace
*/
/**
* This function transforms error message with arguments into plain text error
* message, so that it can be passed to window.onerror without losing anything.
* It can then be transformed back by `erx()` function.
*
* Usage:
* throw new Error(ex('Error %s from %s', errorCode, userID));
*
* @param {string} errorMessage
*/
var ex = function(errorMessage/*, arg1, arg2, ...*/) {
var args = Array.prototype.slice.call(arguments).map(function(arg) {
return String(arg);
});
var expectedLength = errorMessage.split('%s').length - 1;
if (expectedLength !== args.length - 1) {
// something wrong with the formatting string
return ex('ex args number mismatch: %s', JSON.stringify(args));
}
return ex._prefix + JSON.stringify(args) + ex._suffix;
};
ex._prefix = '<![EX[';
ex._suffix = ']]>';
module.exports = ex;
},{}],95:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule filterAttributes
* @typechecks static-only
*/
/*jslint evil: true */
'use strict';
/**
* Like filter(), but for a DOM nodes attributes. Returns an array of
* the filter DOMAttribute objects. Does some perf related this like
* caching attributes.length.
*
* @param {DOMElement} node Node whose attributes you want to filter
* @return {array} array of DOM attribute objects.
*/
function filterAttributes(node, func, context) {
var attributes = node.attributes;
var numAttributes = attributes.length;
var accumulator = [];
for (var i = 0; i < numAttributes; i++) {
var attr = attributes.item(i);
if (func.call(context, attr)) {
accumulator.push(attr);
}
}
return accumulator;
}
module.exports = filterAttributes;
},{}],96:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule flattenChildren
*/
"use strict";
var invariant = require("./invariant");
var traverseAllChildren = require("./traverseAllChildren");
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
*/
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
invariant(
!result.hasOwnProperty(name),
'flattenChildren(...): Encountered two children with the same key, `%s`. ' +
'Children keys must be unique.',
name
);
result[name] = child;
}
/**
* Flattens children that are typically specified as `props.children`.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children) {
if (children == null) {
return children;
}
var result = {};
traverseAllChildren(children, flattenSingleChildIntoContext, result);
return result;
}
module.exports = flattenChildren;
},{"./invariant":106,"./traverseAllChildren":125}],97:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule forEachAccumulated
*/
"use strict";
/**
* @param {array} 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).
*/
var forEachAccumulated = function(arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
};
module.exports = forEachAccumulated;
},{}],98:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ge
*/
/**
* Find a node by ID. Optionally search a sub-tree outside of the document
*
* Use ge if you're not sure whether or not the element exists. You can test
* for existence yourself in your application code.
*
* If your application code depends on the existence of the element, use $
* instead, which will throw in DEV if the element doesn't exist.
*/
function ge(arg, root, tag) {
return typeof arg != 'string' ? arg :
!root ? document.getElementById(arg) :
_geFromSubtree(arg, root, tag);
}
function _geFromSubtree(id, root, tag) {
var elem, children, ii;
if (_getNodeID(root) == id) {
return root;
} else if (root.getElementsByTagName) {
// All Elements implement this, which does an iterative DFS, which is
// faster than recursion and doesn't run into stack depth issues.
children = root.getElementsByTagName(tag || '*');
for (ii = 0; ii < children.length; ii++) {
if (_getNodeID(children[ii]) == id) {
return children[ii];
}
}
} else {
// DocumentFragment does not implement getElementsByTagName, so
// recurse over its children. Its children must be Elements, so
// each child will use the getElementsByTagName case instead.
children = root.childNodes;
for (ii = 0; ii < children.length; ii++) {
elem = _geFromSubtree(id, children[ii]);
if (elem) {
return elem;
}
}
}
return null;
}
/**
* Return the ID value for a given node. This allows us to avoid issues
* with forms that contain inputs with name="id".
*
* @return string (null if attribute not set)
*/
function _getNodeID(node) {
// #document and #document-fragment do not have getAttributeNode.
var id = node.getAttributeNode && node.getAttributeNode('id');
return id ? id.value : null;
}
module.exports = ge;
},{}],99:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getActiveElement
* @typechecks
*/
/**
* 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.
*/
function getActiveElement() /*?DOMElement*/ {
try {
return document.activeElement;
} catch (e) {
return null;
}
}
module.exports = getActiveElement;
},{}],100:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
"use strict";
/**
* 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;
// 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;
},{}],101:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getMarkupWrap
*/
var ExecutionEnvironment = require("./ExecutionEnvironment");
var invariant = require("./invariant");
/**
* 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 = {
// Force wrapping for SVG elements because if they get created inside a <div>,
// they will be initialized in the wrong namespace (and will not display).
'circle': true,
'g': true,
'line': true,
'path': true,
'polyline': true,
'rect': true,
'text': true
};
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>', '</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,
'circle': svgWrap,
'g': svgWrap,
'line': svgWrap,
'path': svgWrap,
'polyline': svgWrap,
'rect': svgWrap,
'text': svgWrap
};
/**
* 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) {
invariant(!!dummyNode, 'Markup wrapping node not initialized');
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;
},{"./ExecutionEnvironment":21,"./invariant":106}],102:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getNodeForCharacterOffset
*/
"use strict";
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType == 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
},{}],103:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getReactRootElementInContainer
*/
"use strict";
var DOC_NODE_TYPE = 9;
/**
* @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;
}
}
module.exports = getReactRootElementInContainer;
},{}],104:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getTextContentAccessor
*/
"use strict";
var ExecutionEnvironment = require("./ExecutionEnvironment");
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) {
contentKey = 'innerText' in document.createElement('div') ?
'innerText' :
'textContent';
}
return contentKey;
}
module.exports = getTextContentAccessor;
},{"./ExecutionEnvironment":21}],105:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule hyphenate
* @typechecks
*/
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
},{}],106:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule invariant
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf style format 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.
*/
function invariant(condition) {
if (!condition) {
throw new Error('Invariant Violation');
}
}
module.exports = invariant;
if (true) {
var invariantDev = function(condition, format, a, b, c, d, e, f) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
if (!condition) {
var args = [a, b, c, d, e, f];
var argIndex = 0;
throw new Error(
'Invariant Violation: ' +
format.replace(/%s/g, function() { return args[argIndex++]; })
);
}
};
module.exports = invariantDev;
}
},{}],107:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isEventSupported
*/
"use strict";
var ExecutionEnvironment = require("./ExecutionEnvironment");
var testNode, useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
testNode = document.createElement('div');
useHasFeature =
document.implementation &&
document.implementation.hasFeature &&
// `hasFeature` always returns true in Firefox 19+.
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 (!testNode || (capture && !testNode.addEventListener)) {
return false;
}
var element = document.createElement('div');
var eventName = 'on' + eventNameSuffix;
var isSupported = eventName in element;
if (!isSupported) {
element.setAttribute(eventName, 'return;');
isSupported = typeof element[eventName] === 'function';
if (typeof element[eventName] !== 'undefined') {
element[eventName] = undefined;
}
element.removeAttribute(eventName);
}
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');
}
element = null;
return isSupported;
}
module.exports = isEventSupported;
},{"./ExecutionEnvironment":21}],108:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isNode
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
function isNode(object) {
return !!(object && (
typeof Node !== 'undefined' ? object instanceof Node :
typeof object === 'object' &&
typeof object.nodeType === 'number' &&
typeof object.nodeName === 'string'
));
}
module.exports = isNode;
},{}],109:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isTextInputElement
*/
"use strict";
/**
* @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) {
return elem && (
(elem.nodeName === 'INPUT' && supportedInputTypes[elem.type]) ||
elem.nodeName === 'TEXTAREA'
);
}
module.exports = isTextInputElement;
},{}],110:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isTextNode
* @typechecks
*/
var isNode = require("./isNode");
/**
* @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;
},{"./isNode":108}],111:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule joinClasses
* @typechecks static-only
*/
"use strict";
/**
* Combines multiple className strings into one.
* http://jsperf.com/joinclasses-args-vs-array
*
* @param {...?string} classes
* @return {string}
*/
function joinClasses(className/*, ... */) {
if (!className) {
className = '';
}
var nextClass;
var argLength = arguments.length;
if (argLength > 1) {
for (var ii = 1; ii < argLength; ii++) {
nextClass = arguments[ii];
nextClass && (className += ' ' + nextClass);
}
}
return className;
}
module.exports = joinClasses;
},{}],112:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule keyMirror
* @typechecks static-only
*/
"use strict";
var invariant = require("./invariant");
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function(obj) {
var ret = {};
var key;
invariant(
obj instanceof Object && !Array.isArray(obj),
'keyMirror(...): Argument must be an object.'
);
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
},{"./invariant":106}],113:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule keyOf
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without loosing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
var keyOf = function(oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
},{}],114:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule memoizeStringOnly
* @typechecks static-only
*/
"use strict";
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeStringOnly(callback) {
var cache = {};
return function(string) {
if (cache.hasOwnProperty(string)) {
return cache[string];
} else {
return cache[string] = callback.call(this, string);
}
};
}
module.exports = memoizeStringOnly;
},{}],115:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule merge
*/
"use strict";
var mergeInto = require("./mergeInto");
/**
* Shallow merges two structures into a return value, without mutating either.
*
* @param {?object} one Optional object with properties to merge from.
* @param {?object} two Optional object with properties to merge from.
* @return {object} The shallow extension of one by two.
*/
var merge = function(one, two) {
var result = {};
mergeInto(result, one);
mergeInto(result, two);
return result;
};
module.exports = merge;
},{"./mergeInto":117}],116:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mergeHelpers
*
* requiresPolyfills: Array.isArray
*/
"use strict";
var invariant = require("./invariant");
var keyMirror = require("./keyMirror");
/**
* Maximum number of levels to traverse. Will catch circular structures.
* @const
*/
var MAX_MERGE_DEPTH = 36;
/**
* We won't worry about edge cases like new String('x') or new Boolean(true).
* Functions are considered terminals, and arrays are not.
* @param {*} o The item/object/value to test.
* @return {boolean} true iff the argument is a terminal.
*/
var isTerminal = function(o) {
return typeof o !== 'object' || o === null;
};
var mergeHelpers = {
MAX_MERGE_DEPTH: MAX_MERGE_DEPTH,
isTerminal: isTerminal,
/**
* Converts null/undefined values into empty object.
*
* @param {?Object=} arg Argument to be normalized (nullable optional)
* @return {!Object}
*/
normalizeMergeArg: function(arg) {
return arg === undefined || arg === null ? {} : arg;
},
/**
* If merging Arrays, a merge strategy *must* be supplied. If not, it is
* likely the caller's fault. If this function is ever called with anything
* but `one` and `two` being `Array`s, it is the fault of the merge utilities.
*
* @param {*} one Array to merge into.
* @param {*} two Array to merge from.
*/
checkMergeArrayArgs: function(one, two) {
invariant(
Array.isArray(one) && Array.isArray(two),
'Critical assumptions about the merge functions have been violated. ' +
'This is the fault of the merge functions themselves, not necessarily ' +
'the callers.'
);
},
/**
* @param {*} one Object to merge into.
* @param {*} two Object to merge from.
*/
checkMergeObjectArgs: function(one, two) {
mergeHelpers.checkMergeObjectArg(one);
mergeHelpers.checkMergeObjectArg(two);
},
/**
* @param {*} arg
*/
checkMergeObjectArg: function(arg) {
invariant(
!isTerminal(arg) && !Array.isArray(arg),
'Critical assumptions about the merge functions have been violated. ' +
'This is the fault of the merge functions themselves, not necessarily ' +
'the callers.'
);
},
/**
* Checks that a merge was not given a circular object or an object that had
* too great of depth.
*
* @param {number} Level of recursion to validate against maximum.
*/
checkMergeLevel: function(level) {
invariant(
level < MAX_MERGE_DEPTH,
'Maximum deep merge depth exceeded. You may be attempting to merge ' +
'circular structures in an unsupported way.'
);
},
/**
* Checks that the supplied merge strategy is valid.
*
* @param {string} Array merge strategy.
*/
checkArrayStrategy: function(strategy) {
invariant(
strategy === undefined || strategy in mergeHelpers.ArrayStrategies,
'You must provide an array strategy to deep merge functions to ' +
'instruct the deep merge how to resolve merging two arrays.'
);
},
/**
* Set of possible behaviors of merge algorithms when encountering two Arrays
* that must be merged together.
* - `clobber`: The left `Array` is ignored.
* - `indexByIndex`: The result is achieved by recursively deep merging at
* each index. (not yet supported.)
*/
ArrayStrategies: keyMirror({
Clobber: true,
IndexByIndex: true
})
};
module.exports = mergeHelpers;
},{"./invariant":106,"./keyMirror":112}],117:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mergeInto
* @typechecks static-only
*/
"use strict";
var mergeHelpers = require("./mergeHelpers");
var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg;
/**
* Shallow merges two structures by mutating the first parameter.
*
* @param {object} one Object to be merged into.
* @param {?object} two Optional object with properties to merge from.
*/
function mergeInto(one, two) {
checkMergeObjectArg(one);
if (two != null) {
checkMergeObjectArg(two);
for (var key in two) {
if (!two.hasOwnProperty(key)) {
continue;
}
one[key] = two[key];
}
}
}
module.exports = mergeInto;
},{"./mergeHelpers":116}],118:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mixInto
*/
"use strict";
/**
* Simply copies properties to the prototype.
*/
var mixInto = function(constructor, methodBag) {
var methodName;
for (methodName in methodBag) {
if (!methodBag.hasOwnProperty(methodName)) {
continue;
}
constructor.prototype[methodName] = methodBag[methodName];
}
};
module.exports = mixInto;
},{}],119:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mutateHTMLNodeWithMarkup
* @typechecks static-only
*/
/*jslint evil: true */
'use strict';
var createNodesFromMarkup = require("./createNodesFromMarkup");
var filterAttributes = require("./filterAttributes");
var invariant = require("./invariant");
/**
* You can't set the innerHTML of a document. Unless you have
* this function.
*
* @param {DOMElement} node with tagName == 'html'
* @param {string} markup markup string including <html>.
*/
function mutateHTMLNodeWithMarkup(node, markup) {
invariant(
node.tagName.toLowerCase() === 'html',
'mutateHTMLNodeWithMarkup(): node must have tagName of "html", got %s',
node.tagName
);
markup = markup.trim();
invariant(
markup.toLowerCase().indexOf('<html') === 0,
'mutateHTMLNodeWithMarkup(): markup must start with <html'
);
// First let's extract the various pieces of markup.
var htmlOpenTagEnd = markup.indexOf('>') + 1;
var htmlCloseTagStart = markup.lastIndexOf('<');
var htmlOpenTag = markup.substring(0, htmlOpenTagEnd);
var innerHTML = markup.substring(htmlOpenTagEnd, htmlCloseTagStart);
// Now for the fun stuff. Pass through both sets of attributes and
// bring them up-to-date. We get the new set by creating a markup
// fragment.
var shouldExtractAttributes = htmlOpenTag.indexOf(' ') > -1;
var attributeHolder = null;
if (shouldExtractAttributes) {
// We extract the attributes by creating a <span> and evaluating
// the node.
attributeHolder = createNodesFromMarkup(
htmlOpenTag.replace('html ', 'span ') + '</span>'
)[0];
// Add all attributes present in attributeHolder
var attributesToSet = filterAttributes(
attributeHolder,
function(attr) {
return node.getAttributeNS(attr.namespaceURI, attr.name) !== attr.value;
}
);
attributesToSet.forEach(function(attr) {
node.setAttributeNS(attr.namespaceURI, attr.name, attr.value);
});
}
// Remove all attributes not present in attributeHolder
var attributesToRemove = filterAttributes(
node,
function(attr) {
// Remove all attributes if attributeHolder is null or if it does not have
// the desired attribute.
return !(
attributeHolder &&
attributeHolder.hasAttributeNS(attr.namespaceURI, attr.name)
);
}
);
attributesToRemove.forEach(function(attr) {
node.removeAttributeNS(attr.namespaceURI, attr.name);
});
// Finally, set the inner HTML. No tricks needed. Do this last to
// minimize likelihood of triggering reflows.
node.innerHTML = innerHTML;
}
module.exports = mutateHTMLNodeWithMarkup;
},{"./createNodesFromMarkup":88,"./filterAttributes":95,"./invariant":106}],120:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule nodeContains
* @typechecks
*/
var isTextNode = require("./isTextNode");
/*jslint bitwise:true */
/**
* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
function nodeContains(outerNode, innerNode) {
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
return nodeContains(outerNode, innerNode.parentNode);
} else if (outerNode.contains) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
module.exports = nodeContains;
},{"./isTextNode":110}],121:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule objMap
*/
"use strict";
/**
* For each key/value pair, invokes callback func and constructs a resulting
* object which contains, for every key in obj, values that are the result of
* of invoking the function:
*
* func(value, key, iteration)
*
* @param {?object} obj Object to map keys over
* @param {function} func Invoked for each key/val pair.
* @param {?*} context
* @return {?object} Result of mapping or null if obj is falsey
*/
function objMap(obj, func, context) {
if (!obj) {
return null;
}
var i = 0;
var ret = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
ret[key] = func.call(context, obj[key], key, i++);
}
}
return ret;
}
module.exports = objMap;
},{}],122:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule objMapKeyVal
*/
"use strict";
/**
* Behaves the same as `objMap` but invokes func with the key first, and value
* second. Use `objMap` unless you need this special case.
* Invokes func as:
*
* func(key, value, iteration)
*
* @param {?object} obj Object to map keys over
* @param {!function} func Invoked for each key/val pair.
* @param {?*} context
* @return {?object} Result of mapping or null if obj is falsey
*/
function objMapKeyVal(obj, func, context) {
if (!obj) {
return null;
}
var i = 0;
var ret = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
ret[key] = func.call(context, key, obj[key], i++);
}
}
return ret;
}
module.exports = objMapKeyVal;
},{}],123:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule performanceNow
* @typechecks static-only
*/
"use strict";
var ExecutionEnvironment = require("./ExecutionEnvironment");
/**
* 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 due to Facebook's webdriver
* infrastructure.
*/
var performance = null;
if (ExecutionEnvironment.canUseDOM) {
performance = window.performance || window.webkitPerformance;
}
if (!performance || !performance.now) {
performance = Date;
}
var performanceNow = performance.now.bind(performance);
module.exports = performanceNow;
},{"./ExecutionEnvironment":21}],124:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule shallowEqual
*/
"use strict";
/**
* Performs equality by iterating through keys on an object and returning
* false when any key has values which are not strictly equal between
* objA and objB. Returns true when the values of all keys are strictly equal.
*
* @return {boolean}
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var key;
// Test for A's keys different from B.
for (key in objA) {
if (objA.hasOwnProperty(key) &&
(!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
return false;
}
}
// Test for B'a keys missing from A.
for (key in objB) {
if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
},{}],125:[function(require,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule traverseAllChildren
*/
"use strict";
var ReactComponent = require("./ReactComponent");
var ReactTextComponent = require("./ReactTextComponent");
var invariant = require("./invariant");
/**
* TODO: Test that:
* 1. `mapChildren` transforms strings and numbers into `ReactTextComponent`.
* 2. it('should fail when supplied duplicate key', function() {
* 3. That a single child and an array with one item have the same key pattern.
* });
*/
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!number} indexSoFar Number of children encountered until this point.
* @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.
*/
var traverseAllChildrenImpl =
function(children, nameSoFar, indexSoFar, callback, traverseContext) {
var subtreeCount = 0; // Count of children found in the current subtree.
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var child = children[i];
var nextName = nameSoFar + ReactComponent.getKey(child, i);
var nextIndex = indexSoFar + subtreeCount;
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
nextIndex,
callback,
traverseContext
);
}
} else {
var type = typeof children;
var isOnlyChild = nameSoFar === '';
// 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
var storageName = isOnlyChild ?
ReactComponent.getKey(children, 0):
nameSoFar;
if (children === null || children === undefined || type === 'boolean') {
// All of the above are perceived as null.
callback(traverseContext, null, storageName, indexSoFar);
subtreeCount = 1;
} else if (children.mountComponentIntoNode) {
callback(traverseContext, children, storageName, indexSoFar);
subtreeCount = 1;
} else {
if (type === 'object') {
invariant(
!children || children.nodeType !== 1,
'traverseAllChildren(...): Encountered an invalid child; DOM ' +
'elements are not valid children of React components.'
);
for (var key in children) {
if (children.hasOwnProperty(key)) {
subtreeCount += traverseAllChildrenImpl(
children[key],
nameSoFar + '{' + key + '}',
indexSoFar + subtreeCount,
callback,
traverseContext
);
}
}
} else if (type === 'string') {
var normalizedText = new ReactTextComponent(children);
callback(traverseContext, normalizedText, storageName, indexSoFar);
subtreeCount += 1;
} else if (type === 'number') {
var normalizedNumber = new ReactTextComponent('' + children);
callback(traverseContext, normalizedNumber, storageName, indexSoFar);
subtreeCount += 1;
}
}
}
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.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children !== null && children !== undefined) {
traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
}
}
module.exports = traverseAllChildren;
},{"./ReactComponent":28,"./ReactTextComponent":64,"./invariant":106}]},{},[70])
(70)
});
; |
src/svg-icons/maps/local-play.js | pomerantsev/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalPlay = (props) => (
<SvgIcon {...props}>
<path d="M20 12c0-1.1.9-2 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-1.99.9-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2zm-4.42 4.8L12 14.5l-3.58 2.3 1.08-4.12-3.29-2.69 4.24-.25L12 5.8l1.54 3.95 4.24.25-3.29 2.69 1.09 4.11z"/>
</SvgIcon>
);
MapsLocalPlay = pure(MapsLocalPlay);
MapsLocalPlay.displayName = 'MapsLocalPlay';
MapsLocalPlay.muiName = 'SvgIcon';
export default MapsLocalPlay;
|
src/routes/Spots/components/SpotEditForm/PhotosField.js | ZeusTheTrueGod/WindsurfingNetwork-client | // @flow
import React from 'react';
import { Form, Button, Glyphicon } from 'react-bootstrap';
import { AddPhoto } from './AddPhoto';
import { type Photo } from '../../modules/spotEdit';
import { MonthSelectorField } from './MonthSelectorField';
import { Field } from 'redux-form';
type Props = {|
fields: any,
onRotateLeft: (options: {| path: string, filename: string |}) => void,
onRotateRight: (options: {| path: string, filename: string |}) => void,
|};
export const PhotosField = ({ fields, onRotateLeft, onRotateRight }: Props): React$Element<any> => {
return (
<div>
{fields.map((photoPath: string, index: number) => {
const record: () => Photo = () => fields.get(index);
console.info(record);
return (
<div
key={index}
className='thumbnail'
style={{
width: 300,
height: 300,
margin: '10px 10px',
display: 'inline-block',
position: 'relative',
overflow: 'hidden',
}}
>
<Field
name={`${photoPath}.filename`}
component={({ input }: { input: any }) => (
<div
className='photo'
style={{
position: 'absolute',
top: 0,
left: 0,
width: 300,
height: 300,
display: 'inline-block',
zIndex: 0,
backgroundImage: `url("/api/usercontent/${record().filename}")`,
}}
/>
)}
/>
<Form style={{ position: 'relative', zIndex: 1 }} inline>
<Button bsStyle='danger' onClick={() => fields.remove(index)}><Glyphicon glyph='trash' /></Button>
<Button onClick={() => onRotateLeft({ path: photoPath, filename: record().filename })}>
<Glyphicon glyph='arrow-left' />
</Button>
<Button onClick={() => onRotateRight({ path: photoPath, filename: record().filename })}>
<Glyphicon glyph='arrow-right' />
</Button>
<div className='pull-right'>
<Field name={`${photoPath}.month`} component={MonthSelectorField} />
</div>
</Form>
</div>
);
})}
{<AddPhoto onAdd={(record: Photo) => fields.push(record)} />}
</div>
);
};
|
dva/wd/src/components/CocktailCard.js | imuntil/React | import React from 'react';
import { Icon } from 'antd-mobile'
import styles from './CocktailCard.css';
function CocktailCard({ more, width = '45%', data = {} }) {
return (
<div className={styles.normal} style={{ width }}>
<img src={data.src || require('../assets/ig-dir/cocktail-1.jpg')} alt="" />
<p className="en">{data.en || 'negroni'}</p>
<p className="cn">{data.cn || '内格罗尼'}</p>
{
more
? <a href="javascript:;">查看更多 <Icon type="right" /></a>
: null
}
</div>
);
}
export default CocktailCard;
|
app/javascript/mastodon/features/ui/components/modal_root.js | WitchesTown/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import BundleContainer from '../containers/bundle_container';
import BundleModalError from './bundle_modal_error';
import ModalLoading from './modal_loading';
import ActionsModal from './actions_modal';
import MediaModal from './media_modal';
import VideoModal from './video_modal';
import BoostModal from './boost_modal';
import ConfirmationModal from './confirmation_modal';
import FocalPointModal from './focal_point_modal';
import {
OnboardingModal,
MuteModal,
ReportModal,
EmbedModal,
ListEditor,
} from '../../../features/ui/util/async-components';
const MODAL_COMPONENTS = {
'MEDIA': () => Promise.resolve({ default: MediaModal }),
'ONBOARDING': OnboardingModal,
'VIDEO': () => Promise.resolve({ default: VideoModal }),
'BOOST': () => Promise.resolve({ default: BoostModal }),
'CONFIRM': () => Promise.resolve({ default: ConfirmationModal }),
'MUTE': MuteModal,
'REPORT': ReportModal,
'ACTIONS': () => Promise.resolve({ default: ActionsModal }),
'EMBED': EmbedModal,
'LIST_EDITOR': ListEditor,
'FOCAL_POINT': () => Promise.resolve({ default: FocalPointModal }),
};
export default class ModalRoot extends React.PureComponent {
static propTypes = {
type: PropTypes.string,
props: PropTypes.object,
onClose: PropTypes.func.isRequired,
};
state = {
revealed: false,
};
handleKeyUp = (e) => {
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
&& !!this.props.type) {
this.props.onClose();
}
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false);
}
componentWillReceiveProps (nextProps) {
if (!!nextProps.type && !this.props.type) {
this.activeElement = document.activeElement;
this.getSiblings().forEach(sibling => sibling.setAttribute('inert', true));
} else if (!nextProps.type) {
this.setState({ revealed: false });
}
}
componentDidUpdate (prevProps) {
if (!this.props.type && !!prevProps.type) {
this.getSiblings().forEach(sibling => sibling.removeAttribute('inert'));
this.activeElement.focus();
this.activeElement = null;
}
if (this.props.type) {
requestAnimationFrame(() => {
this.setState({ revealed: true });
});
}
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp);
}
getSiblings = () => {
return Array(...this.node.parentElement.childNodes).filter(node => node !== this.node);
}
setRef = ref => {
this.node = ref;
}
renderLoading = modalId => () => {
return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
}
renderError = (props) => {
const { onClose } = this.props;
return <BundleModalError {...props} onClose={onClose} />;
}
render () {
const { type, props, onClose } = this.props;
const { revealed } = this.state;
const visible = !!type;
if (!visible) {
return (
<div className='modal-root' ref={this.setRef} style={{ opacity: 0 }} />
);
}
return (
<div className='modal-root' ref={this.setRef} style={{ opacity: revealed ? 1 : 0 }}>
<div style={{ pointerEvents: visible ? 'auto' : 'none' }}>
<div role='presentation' className='modal-root__overlay' onClick={onClose} />
<div role='dialog' className='modal-root__container'>
{visible && (
<BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}>
{(SpecificComponent) => <SpecificComponent {...props} onClose={onClose} />}
</BundleContainer>
)}
</div>
</div>
</div>
);
}
}
|
src/svg-icons/action/restore.js | lawrence-yu/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionRestore = (props) => (
<SvgIcon {...props}>
<path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"/>
</SvgIcon>
);
ActionRestore = pure(ActionRestore);
ActionRestore.displayName = 'ActionRestore';
ActionRestore.muiName = 'SvgIcon';
export default ActionRestore;
|
src/components/MessageInput/MessageRow.js | nambawan/g-old | import React from 'react';
import PropTypes from 'prop-types';
// import { FormattedRelative } from 'react-intl';
import TableRow from '../TableRow';
function MessageRow({ messageType, messageObject, onClickMenu }) {
/* eslint-disable react/no-danger */
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
if (!messageObject) return null;
return (
<TableRow onClick={() => onClickMenu(messageObject)}>
<td>
<div dangerouslySetInnerHTML={{ __html: messageObject.content }} />
</td>
<td> {messageType}</td>
<td>{messageObject.keyword}</td>
<td>{messageObject.category}</td>
<td>{messageObject.isPublished ? 'yes' : 'no'}</td>
</TableRow>
);
}
MessageRow.propTypes = {
onClickMenu: PropTypes.func.isRequired,
messageObject: PropTypes.shape({
content: PropTypes.string,
keyword: PropTypes.string,
category: PropTypes.string,
isPublished: PropTypes.bool,
}).isRequired,
messageType: PropTypes.string.isRequired,
};
export default MessageRow;
|
demo/demolist/Demo4.js | tinper-bee/bee-tabs | /**
*
* @title 位置
* @description tab页签头的位置,可以在['top','bottom','left','right']中选择。当页签宽度超过容器宽度时,可以左右、上下滑动,容纳更多标签。
*
*/
import React, { Component } from 'react';
import Select from "bee-select";
import Tabs from '../../src';
const {TabPane} = Tabs;
const {Option} = Select;
class Demo4 extends Component {
constructor(props) {
super(props);
this.state = ({
activeKey: "1",
start: 0,
tabBarPosition: "left"
})
}
onChange = (activeKey) => {
console.log(`onChange ${activeKey}o-^-o`);
this.setState({
activeKey,
});
}
onTabClick = (key) => {
console.log(`onTabClick ${key}o^o`);
if (key === this.state.activeKey) {
this.setState({
activeKey: '',
});
}
}
changeTabPosition = (tabBarPosition) => {
this.setState({ tabBarPosition });
}
render() {
return (
<div className="demo4">
<div style={{ marginBottom: 16 }}>
Tab position:
<Select
value={this.state.tabBarPosition}
onChange={this.changeTabPosition}
>
<Option value="top">top</Option>
<Option value="bottom">bottom</Option>
<Option value="left">left</Option>
<Option value="right">right</Option>
</Select>
</div>
<Tabs
activeKey={this.state.activeKey}
tabBarPosition={this.state.tabBarPosition}
onChange={this.onChange}
defaultActiveKey="1"
className="demo4-tabs"
onTabClick={this.onTabClick}
>
<TabPane tab='Tab 1' key="1">Content of Tab Pane 1</TabPane>
<TabPane tab='Tab 2' key="2">Content of Tab Pane 2</TabPane>
<TabPane tab='Tab 3' key="3">Content of Tab Pane 3</TabPane>
<TabPane tab='Tab 4' key="4">Content of Tab Pane 4</TabPane>
<TabPane tab='Tab 5' key="5">Content of Tab Pane 5</TabPane>
<TabPane tab='Tab 6' key="6">Content of Tab Pane 6</TabPane>
<TabPane tab='Tab 7' key="7">Content of Tab Pane 7</TabPane>
<TabPane tab='Tab 8' key="8">Content of Tab Pane 8</TabPane>
</Tabs>
</div>
)
}
}
export default Demo4; |
src/components/common/forms/MarkdownEditor.js | ESTEBANMURUZABAL/my-ecommerce-template | /**
* Imports
*/
import React from 'react';
// Flux
import ApplicationStore from '../../../stores/Application/ApplicationStore';
// Required components
import FormLabel from './FormLabel';
import Textarea from './Textarea';
// Instantiate logger
let debug = require('debug')('tienda765');
/**
* Component
*/
class MarkdownEditor extends React.Component {
static contextTypes = {
getStore: React.PropTypes.func.isRequired
};
//*** Initial State ***//
state = {
text: 'Fusce dapibus, tellus ac cursus commodo'
};
//*** Component Lifecycle ***//
componentDidMount() {
// Component styles
require('./MarkdownEditor.scss');
}
//*** View Controllers ***//
handleChange = (text, medium) => {
this.setState({text: text});
};
//*** Template ***//
render() {
let id = `markdown-editor-${this.context.getStore(ApplicationStore).uniqueId()}`;
return (
<div className="markdown-editor">
{this.props.label ?
<div className="markdown-editor__label">
<FormLabel for={id}>{this.props.label}</FormLabel>
</div>
:
null
}
<Textarea rows="20"
value={this.props.value}
onChange={this.props.onChange} />
</div>
);
}
}
/**
* Default Props
*/
MarkdownEditor.defaultProps = {
onChange: function (value) { debug(`onChange not defined. Value: ${value}`); }
};
/**
* Exports
*/
export default MarkdownEditor;
|
ajax/libs/material-ui/4.9.6/esm/test-utils/getClasses.js | cdnjs/cdnjs | import * as React from 'react';
import createShallow from './createShallow';
var shallow = createShallow(); // Helper function to extract the classes from a styleSheet.
export default function getClasses(element) {
var useStyles = element.type.useStyles;
var classes;
function Listener() {
classes = useStyles(element.props);
return null;
}
shallow(React.createElement(Listener, null));
return classes;
} |
priv/frontend/index.js | losch/phoestit | 'use strict';
import 'babel-core/polyfill';
import React from 'react';
import ReactDom from 'react-dom';
import { Router, Route } from 'react-router'
import { combineReducers, createStore } from 'redux';
import { Provider } from 'react-redux';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import App from './containers/App';
import * as reducers from './reducers';
let injectTapEventPlugin = require('react-tap-event-plugin');
injectTapEventPlugin();
let notesApp = combineReducers(reducers);
let store = createStore(notesApp);
let rootElement = document.getElementById('root');
ReactDom.render(
<Provider store={store}>
<Router history={createBrowserHistory()}>
<Route path="/" component={App} />
<Route path="/:view" component={App} />
</Router>
</Provider>,
rootElement
);
|
ajax/libs/primereact/6.5.1/megamenu/megamenu.esm.js | cdnjs/cdnjs | import React, { Component } from 'react';
import { DomHandler, classNames, Ripple, ObjectUtils } from 'primereact/core';
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var MegaMenu = /*#__PURE__*/function (_Component) {
_inherits(MegaMenu, _Component);
var _super = _createSuper(MegaMenu);
function MegaMenu(props) {
var _this;
_classCallCheck(this, MegaMenu);
_this = _super.call(this, props);
_this.state = {
activeItem: null
};
_this.onLeafClick = _this.onLeafClick.bind(_assertThisInitialized(_this));
return _this;
}
_createClass(MegaMenu, [{
key: "onLeafClick",
value: function onLeafClick(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
if (!item.url) {
event.preventDefault();
}
if (item.command) {
item.command({
originalEvent: event,
item: item
});
}
this.setState({
activeItem: null
});
}
}, {
key: "onCategoryMouseEnter",
value: function onCategoryMouseEnter(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
if (this.state.activeItem) {
this.setState({
activeItem: item
});
}
}
}, {
key: "onCategoryClick",
value: function onCategoryClick(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
if (!item.url) {
event.preventDefault();
}
if (item.command) {
item.command({
originalEvent: event,
item: this.props.item
});
}
if (item.items) {
if (this.state.activeItem && this.state.activeItem === item) {
this.setState({
activeItem: null
});
} else {
this.setState({
activeItem: item
});
}
}
event.preventDefault();
}
}, {
key: "onCategoryKeyDown",
value: function onCategoryKeyDown(event, item) {
var listItem = event.currentTarget.parentElement;
switch (event.which) {
//down
case 40:
if (this.isHorizontal()) this.expandMenu(item);else this.navigateToNextItem(listItem);
event.preventDefault();
break;
//up
case 38:
if (this.isVertical()) this.navigateToPrevItem(listItem);else if (item.items && item === this.state.activeItem) this.collapseMenu();
event.preventDefault();
break;
//right
case 39:
if (this.isHorizontal()) this.navigateToNextItem(listItem);else this.expandMenu(item);
event.preventDefault();
break;
//left
case 37:
if (this.isHorizontal()) this.navigateToPrevItem(listItem);else if (item.items && item === this.state.activeItem) this.collapseMenu();
event.preventDefault();
break;
}
}
}, {
key: "expandMenu",
value: function expandMenu(item) {
if (item.items) {
this.setState({
activeItem: item
});
}
}
}, {
key: "collapseMenu",
value: function collapseMenu(item) {
this.setState({
activeItem: null
});
}
}, {
key: "findNextItem",
value: function findNextItem(item) {
var nextItem = item.nextElementSibling;
if (nextItem) return DomHandler.hasClass(nextItem, 'p-disabled') || !DomHandler.hasClass(nextItem, 'p-menuitem') ? this.findNextItem(nextItem) : nextItem;else return null;
}
}, {
key: "findPrevItem",
value: function findPrevItem(item) {
var prevItem = item.previousElementSibling;
if (prevItem) return DomHandler.hasClass(prevItem, 'p-disabled') || !DomHandler.hasClass(prevItem, 'p-menuitem') ? this.findPrevItem(prevItem) : prevItem;else return null;
}
}, {
key: "navigateToNextItem",
value: function navigateToNextItem(listItem) {
var nextItem = this.findNextItem(listItem);
if (nextItem) {
nextItem.children[0].focus();
}
}
}, {
key: "navigateToPrevItem",
value: function navigateToPrevItem(listItem) {
var prevItem = this.findPrevItem(listItem);
if (prevItem) {
prevItem.children[0].focus();
}
}
}, {
key: "isHorizontal",
value: function isHorizontal() {
return this.props.orientation === 'horizontal';
}
}, {
key: "isVertical",
value: function isVertical() {
return this.props.orientation === 'vertical';
}
}, {
key: "getColumnClassName",
value: function getColumnClassName(category) {
var length = category.items ? category.items.length : 0;
var columnClass;
switch (length) {
case 2:
columnClass = 'p-megamenu-col-6';
break;
case 3:
columnClass = 'p-megamenu-col-4';
break;
case 4:
columnClass = 'p-megamenu-col-3';
break;
case 6:
columnClass = 'p-megamenu-col-2';
break;
default:
columnClass = 'p-megamenu-col-12';
break;
}
return columnClass;
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
if (!this.documentClickListener) {
this.documentClickListener = function (event) {
if (_this2.container && !_this2.container.contains(event.target)) {
_this2.setState({
activeItem: null
});
}
};
document.addEventListener('click', this.documentClickListener);
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.documentClickListener) {
document.removeEventListener('click', this.documentClickListener);
this.documentClickListener = null;
}
}
}, {
key: "renderSeparator",
value: function renderSeparator(index) {
return /*#__PURE__*/React.createElement("li", {
key: 'separator_' + index,
className: "p-menu-separator",
role: "separator"
});
}
}, {
key: "renderSubmenuIcon",
value: function renderSubmenuIcon(item) {
if (item.items) {
var className = classNames('p-submenu-icon pi', {
'pi-angle-down': this.isHorizontal(),
'pi-angle-right': this.isVertical()
});
return /*#__PURE__*/React.createElement("span", {
className: className
});
}
return null;
}
}, {
key: "renderSubmenuItem",
value: function renderSubmenuItem(item, index) {
var _this3 = this;
if (item.separator) {
return this.renderSeparator(index);
} else {
var className = classNames('p-menuitem', item.className);
var linkClassName = classNames('p-menuitem-link', {
'p-disabled': item.disabled
});
var iconClassName = classNames(item.icon, 'p-menuitem-icon');
var icon = item.icon && /*#__PURE__*/React.createElement("span", {
className: iconClassName
});
var label = item.label && /*#__PURE__*/React.createElement("span", {
className: "p-menuitem-text"
}, item.label);
var content = /*#__PURE__*/React.createElement("a", {
href: item.url || '#',
className: linkClassName,
target: item.target,
onClick: function onClick(event) {
return _this3.onLeafClick(event, item);
},
role: "menuitem",
"aria-disabled": item.disabled
}, icon, label, /*#__PURE__*/React.createElement(Ripple, null));
if (item.template) {
var defaultContentOptions = {
onClick: function onClick(event) {
return _this3.onLeafClick(event, item);
},
className: linkClassName,
labelClassName: 'p-menuitem-text',
iconClassName: iconClassName,
element: content,
props: this.props
};
content = ObjectUtils.getJSXElement(item.template, item, defaultContentOptions);
}
return /*#__PURE__*/React.createElement("li", {
key: item.label + '_' + index,
className: className,
style: item.style,
role: "none"
}, content);
}
}
}, {
key: "renderSubmenu",
value: function renderSubmenu(submenu) {
var _this4 = this;
var className = classNames('p-megamenu-submenu-header', {
'p-disabled': submenu.disabled
}, submenu.className);
var items = submenu.items.map(function (item, index) {
return _this4.renderSubmenuItem(item, index);
});
return /*#__PURE__*/React.createElement(React.Fragment, {
key: submenu.label
}, /*#__PURE__*/React.createElement("li", {
className: className,
style: submenu.style,
role: "presentation",
"aria-disabled": submenu.disabled
}, submenu.label), items);
}
}, {
key: "renderSubmenus",
value: function renderSubmenus(column) {
var _this5 = this;
return column.map(function (submenu, index) {
return _this5.renderSubmenu(submenu, index);
});
}
}, {
key: "renderColumn",
value: function renderColumn(category, column, index, columnClassName) {
var submenus = this.renderSubmenus(column);
return /*#__PURE__*/React.createElement("div", {
key: category.label + '_column_' + index,
className: columnClassName
}, /*#__PURE__*/React.createElement("ul", {
className: "p-megamenu-submenu",
role: "menu"
}, submenus));
}
}, {
key: "renderColumns",
value: function renderColumns(category) {
var _this6 = this;
if (category.items) {
var columnClassName = this.getColumnClassName(category);
return category.items.map(function (column, index) {
return _this6.renderColumn(category, column, index, columnClassName);
});
}
return null;
}
}, {
key: "renderCategoryPanel",
value: function renderCategoryPanel(category) {
if (category.items) {
var columns = this.renderColumns(category);
return /*#__PURE__*/React.createElement("div", {
className: "p-megamenu-panel"
}, /*#__PURE__*/React.createElement("div", {
className: "p-megamenu-grid"
}, columns));
}
return null;
}
}, {
key: "renderCategory",
value: function renderCategory(category, index) {
var _this7 = this;
var className = classNames('p-menuitem', {
'p-menuitem-active': category === this.state.activeItem
}, category.className);
var linkClassName = classNames('p-menuitem-link', {
'p-disabled': category.disabled
});
var iconClassName = classNames('p-menuitem-icon', category.icon);
var icon = category.icon && /*#__PURE__*/React.createElement("span", {
className: iconClassName
});
var label = category.label && /*#__PURE__*/React.createElement("span", {
className: "p-menuitem-text"
}, category.label);
var itemContent = category.template ? ObjectUtils.getJSXElement(category.template, category) : null;
var submenuIcon = this.renderSubmenuIcon(category);
var panel = this.renderCategoryPanel(category);
return /*#__PURE__*/React.createElement("li", {
key: category.label + '_' + index,
className: className,
style: category.style,
onMouseEnter: function onMouseEnter(e) {
return _this7.onCategoryMouseEnter(e, category);
},
role: "none"
}, /*#__PURE__*/React.createElement("a", {
href: category.url || '#',
className: linkClassName,
target: category.target,
onClick: function onClick(e) {
return _this7.onCategoryClick(e, category);
},
onKeyDown: function onKeyDown(e) {
return _this7.onCategoryKeyDown(e, category);
},
role: "menuitem",
"aria-haspopup": category.items != null
}, icon, label, itemContent, submenuIcon, /*#__PURE__*/React.createElement(Ripple, null)), panel);
}
}, {
key: "renderMenu",
value: function renderMenu() {
var _this8 = this;
if (this.props.model) {
return this.props.model.map(function (item, index) {
return _this8.renderCategory(item, index, true);
});
}
return null;
}
}, {
key: "renderCustomContent",
value: function renderCustomContent() {
if (this.props.children) {
return /*#__PURE__*/React.createElement("div", {
className: "p-megamenu-custom"
}, this.props.children);
}
return null;
}
}, {
key: "render",
value: function render() {
var _this9 = this;
var className = classNames('p-megamenu p-component', {
'p-megamenu-horizontal': this.props.orientation === 'horizontal',
'p-megamenu-vertical': this.props.orientation === 'vertical'
}, this.props.className);
var menu = this.renderMenu();
var customContent = this.renderCustomContent();
return /*#__PURE__*/React.createElement("div", {
ref: function ref(el) {
return _this9.container = el;
},
id: this.props.id,
className: className,
style: this.props.style
}, /*#__PURE__*/React.createElement("ul", {
className: "p-megamenu-root-list",
role: "menubar"
}, menu), customContent);
}
}]);
return MegaMenu;
}(Component);
_defineProperty(MegaMenu, "defaultProps", {
id: null,
model: null,
style: null,
className: null,
orientation: 'horizontal'
});
export { MegaMenu };
|
packages/cxx/src/root.js | wangzuo/cxx | import React from 'react';
import { connect } from 'react-redux';
const Root = ({ router }) => <router.component />;
const select = state => ({
router: state.router
});
export default connect(select)(Root);
|
src/svg-icons/editor/show-chart.js | lawrence-yu/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorShowChart = (props) => (
<SvgIcon {...props}>
<path d="M3.5 18.49l6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"/>
</SvgIcon>
);
EditorShowChart = pure(EditorShowChart);
EditorShowChart.displayName = 'EditorShowChart';
EditorShowChart.muiName = 'SvgIcon';
export default EditorShowChart;
|
app/src/components/modals/ErrorModal.js | OpenTrons/opentrons_sdk | // @flow
import * as React from 'react'
import { Link } from 'react-router-dom'
import { AlertModal } from '@opentrons/components'
import { Portal } from '../portal'
import styles from './styles.css'
type Props = {|
heading?: ?string,
description: string,
close?: () => mixed,
closeUrl?: string,
error: { message?: string, ... },
|}
const DEFAULT_HEADING = 'Unexpected Error'
const AN_UNKNOWN_ERROR_OCCURRED = 'An unknown error occurred'
export function ErrorModal(props: Props): React.Node {
const { description, error } = props
const heading = props.heading || DEFAULT_HEADING
let closeButtonProps = { children: 'close', onClick: props.close }
if (props.closeUrl) {
closeButtonProps = {
...closeButtonProps,
Component: Link,
to: props.closeUrl,
}
}
return (
<Portal>
<AlertModal heading={heading} buttons={[closeButtonProps]} alertOverlay>
<p className={styles.error_modal_message}>
{error.message ?? AN_UNKNOWN_ERROR_OCCURRED}
</p>
<p>{description}</p>
<p>
If you keep getting this message, try restarting your app and/or
robot. If this does not resolve the issue please contact Opentrons
Support.
</p>
</AlertModal>
</Portal>
)
}
|